Skip to content

Commit

Permalink
fix: [ChatGPTNextWeb#5308] gemini对话总结
Browse files Browse the repository at this point in the history
  • Loading branch information
DDMeaqua committed Nov 13, 2024
1 parent 819d249 commit 7eda14f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/client/platforms/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ export class GeminiProApi implements LLMApi {
console.log("[Proxy Endpoint] ", baseUrl, path);

let chatPath = [baseUrl, path].join("/");
if (!chatPath.includes("gemini-pro")) {
chatPath += chatPath.includes("?") ? "&alt=sse" : "?alt=sse";
}

chatPath += chatPath.includes("?") ? "&alt=sse" : "?alt=sse";
return chatPath;
}
extractMessage(res: any) {
console.log("[Response] gemini-pro response: ", res);

return (
res?.candidates?.at(0)?.content?.parts.at(0)?.text ||
res?.at(0)?.candidates?.at(0)?.content?.parts.at(0)?.text ||
res?.error?.message ||
""
);
Expand Down Expand Up @@ -167,6 +170,7 @@ export class GeminiProApi implements LLMApi {
try {
// https://github.com/google-gemini/cookbook/blob/main/quickstarts/rest/Streaming_REST.ipynb
const chatPath = this.path(Google.ChatPath(modelConfig.model));
console.log("[Chat Path] ", chatPath);

const chatPayload = {
method: "POST",
Expand Down

0 comments on commit 7eda14f

Please sign in to comment.