mirror of
https://github.com/Yanyutin753/ChatGPT-Next-Web-LangChain-Gpt-4-All.git
synced 2025-10-15 15:41:23 +00:00
fix: gemini authentication error
This commit is contained in:
@@ -28,7 +28,12 @@ export function auth(req: NextRequest, modelProvider: ModelProvider) {
|
||||
const authToken = req.headers.get("Authorization") ?? "";
|
||||
|
||||
// check if it is openai api key or user token
|
||||
const { accessCode, apiKey } = parseApiKey(authToken);
|
||||
let { accessCode, apiKey } = parseApiKey(authToken);
|
||||
|
||||
if (modelProvider === ModelProvider.GeminiPro) {
|
||||
const googleAuthToken = req.headers.get("x-goog-api-key") ?? "";
|
||||
apiKey = googleAuthToken.trim().replaceAll("Bearer ", "").trim();
|
||||
}
|
||||
|
||||
const hashedCode = md5.hash(accessCode ?? "").trim();
|
||||
|
||||
|
Reference in New Issue
Block a user