This commit is contained in:
Yifei Zhang 2023-03-29 17:53:36 +00:00
parent 447dec9444
commit cd9799588d

View File

@ -31,6 +31,7 @@ export function middleware(req: NextRequest) {
// inject api key
if (!token) {
const apiKey = process.env.OPENAI_API_KEY;
console.log("apiKey", apiKey);
if (apiKey) {
req.headers.set("token", apiKey);
} else {
@ -46,5 +47,9 @@ export function middleware(req: NextRequest) {
}
}
return NextResponse.next();
return NextResponse.next({
request: {
headers: req.headers,
},
});
}