Skip to content

Commit

Permalink
chore: shouldStream
Browse files Browse the repository at this point in the history
  • Loading branch information
DDMeaqua committed Nov 13, 2024
1 parent 0628ddf commit b41c012
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/client/platforms/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { RequestPayload } from "./openai";
import { fetch } from "@/app/utils/stream";

export class GeminiProApi implements LLMApi {
path(path: string): string {
path(path: string, shouldStream = false): string {
const accessStore = useAccessStore.getState();

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

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

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

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

0 comments on commit b41c012

Please sign in to comment.