google api using x-google-api-key header

This commit is contained in:
lloydzhou
2024-09-26 23:21:42 +08:00
parent 23f2b6213c
commit 702e17c96b
3 changed files with 15 additions and 9 deletions

View File

@@ -48,10 +48,6 @@ export class GeminiProApi implements LLMApi {
let chatPath = [baseUrl, path].join("/");
chatPath += chatPath.includes("?") ? "&alt=sse" : "?alt=sse";
// if chatPath.startsWith('http') then add key in query string
if (chatPath.startsWith("http") && accessStore.googleApiKey) {
chatPath += `&key=${accessStore.googleApiKey}`;
}
return chatPath;
}
extractMessage(res: any) {