forked from XiaoMo/ChatGPT-Next-Web
fix: fix removing bearer header
This commit is contained in:
parent
7ad1e246a0
commit
f5ed1604aa
@ -57,12 +57,6 @@ export function auth(req: NextRequest, modelProvider: ModelProvider) {
|
|||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
const serverConfig = getServerSideConfig();
|
const serverConfig = getServerSideConfig();
|
||||||
|
|
||||||
// const systemApiKey = serverConfig.isAzure
|
|
||||||
// ? serverConfig.azureApiKey
|
|
||||||
// : serverConfig.isGoogle
|
|
||||||
// ? serverConfig.googleApiKey
|
|
||||||
// : serverConfig.apiKey;
|
|
||||||
|
|
||||||
const systemApiKey =
|
const systemApiKey =
|
||||||
modelProvider === ModelProvider.GeminiPro
|
modelProvider === ModelProvider.GeminiPro
|
||||||
? serverConfig.googleApiKey
|
? serverConfig.googleApiKey
|
||||||
|
@ -9,7 +9,9 @@ const serverConfig = getServerSideConfig();
|
|||||||
export async function requestOpenai(req: NextRequest) {
|
export async function requestOpenai(req: NextRequest) {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
|
|
||||||
const authValue = req.headers.get("Authorization") ?? "";
|
const authValue =
|
||||||
|
req.headers.get("Authorization")?.trim().replaceAll("Bearer ", "").trim() ??
|
||||||
|
"";
|
||||||
const authHeaderName = serverConfig.isAzure ? "api-key" : "Authorization";
|
const authHeaderName = serverConfig.isAzure ? "api-key" : "Authorization";
|
||||||
|
|
||||||
let path = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll(
|
let path = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll(
|
||||||
|
Loading…
Reference in New Issue
Block a user