Skip to content

Commit b41c012

Browse files
committed
chore: shouldStream
1 parent 0628ddf commit b41c012

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/client/platforms/google.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { RequestPayload } from "./openai";
2929
import { fetch } from "@/app/utils/stream";
3030

3131
export class GeminiProApi implements LLMApi {
32-
path(path: string): string {
32+
path(path: string, shouldStream = false): string {
3333
const accessStore = useAccessStore.getState();
3434

3535
let baseUrl = "";
@@ -51,7 +51,7 @@ export class GeminiProApi implements LLMApi {
5151
console.log("[Proxy Endpoint] ", baseUrl, path);
5252

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

@@ -169,7 +169,10 @@ export class GeminiProApi implements LLMApi {
169169
options.onController?.(controller);
170170
try {
171171
// https://github.com/google-gemini/cookbook/blob/main/quickstarts/rest/Streaming_REST.ipynb
172-
const chatPath = this.path(Google.ChatPath(modelConfig.model));
172+
const chatPath = this.path(
173+
Google.ChatPath(modelConfig.model),
174+
shouldStream,
175+
);
173176

174177
const chatPayload = {
175178
method: "POST",

0 commit comments

Comments
 (0)