File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ import { RequestPayload } from "./openai";
2929import { fetch } from "@/app/utils/stream" ;
3030
3131export 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" ,
You can’t perform that action at this time.
0 commit comments