forked from XiaoMo/ChatGPT-Next-Web
fix: return bearer header when using openai
This commit is contained in:
parent
bd1e311674
commit
19137b79bc
@ -9,9 +9,16 @@ const serverConfig = getServerSideConfig();
|
|||||||
export async function requestOpenai(req: NextRequest) {
|
export async function requestOpenai(req: NextRequest) {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
|
|
||||||
|
if (serverConfig.isAzure) {
|
||||||
const authValue =
|
const authValue =
|
||||||
req.headers.get("Authorization")?.trim().replaceAll("Bearer ", "").trim() ??
|
req.headers
|
||||||
"";
|
.get("Authorization")
|
||||||
|
?.trim()
|
||||||
|
.replaceAll("Bearer ", "")
|
||||||
|
.trim() ?? "";
|
||||||
|
} else {
|
||||||
|
const authValue = req.headers.get("Authorization") ?? "";
|
||||||
|
}
|
||||||
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