forked from XiaoMo/ChatGPT-Next-Web
fixup
This commit is contained in:
parent
447dec9444
commit
cd9799588d
@ -31,6 +31,7 @@ export function middleware(req: NextRequest) {
|
|||||||
// inject api key
|
// inject api key
|
||||||
if (!token) {
|
if (!token) {
|
||||||
const apiKey = process.env.OPENAI_API_KEY;
|
const apiKey = process.env.OPENAI_API_KEY;
|
||||||
|
console.log("apiKey", apiKey);
|
||||||
if (apiKey) {
|
if (apiKey) {
|
||||||
req.headers.set("token", apiKey);
|
req.headers.set("token", apiKey);
|
||||||
} else {
|
} else {
|
||||||
@ -46,5 +47,9 @@ export function middleware(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NextResponse.next();
|
return NextResponse.next({
|
||||||
|
request: {
|
||||||
|
headers: req.headers,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user