mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-11 04:26:37 +08:00
Merge branch 'ChatGPTNextWeb:main' into main
This commit is contained in:
commit
6178eaaee8
@ -9,10 +9,21 @@ 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 =
|
var authValue,
|
||||||
req.headers.get("Authorization")?.trim().replaceAll("Bearer ", "").trim() ??
|
authHeaderName = "";
|
||||||
"";
|
if (serverConfig.isAzure) {
|
||||||
const authHeaderName = serverConfig.isAzure ? "api-key" : "Authorization";
|
authValue =
|
||||||
|
req.headers
|
||||||
|
.get("Authorization")
|
||||||
|
?.trim()
|
||||||
|
.replaceAll("Bearer ", "")
|
||||||
|
.trim() ?? "";
|
||||||
|
|
||||||
|
authHeaderName = "api-key";
|
||||||
|
} else {
|
||||||
|
authValue = req.headers.get("Authorization") ?? "";
|
||||||
|
authHeaderName = "Authorization";
|
||||||
|
}
|
||||||
|
|
||||||
let path = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll(
|
let path = `${req.nextUrl.pathname}${req.nextUrl.search}`.replaceAll(
|
||||||
"/api/openai/",
|
"/api/openai/",
|
||||||
|
Loading…
Reference in New Issue
Block a user