mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-08 17:44:57 +08:00
feat: support set api key from client side
This commit is contained in:
@@ -43,7 +43,9 @@ async function handle(
|
||||
10 * 60 * 1000,
|
||||
);
|
||||
|
||||
const key = req.nextUrl.searchParams.get("key") ?? serverConfig.googleApiKey;
|
||||
const bearToken = req.headers.get("Authorization") ?? "";
|
||||
const token = bearToken.trim().replaceAll("Bearer ", "").trim();
|
||||
const key = token ?? serverConfig.googleApiKey;
|
||||
const fetchUrl = `${baseUrl}/${path}?key=${key}`;
|
||||
|
||||
const fetchOptions: RequestInit = {
|
||||
|
Reference in New Issue
Block a user