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";
29
29
import { fetch } from "@/app/utils/stream" ;
30
30
31
31
export class GeminiProApi implements LLMApi {
32
- path ( path : string ) : string {
32
+ path ( path : string , shouldStream = false ) : string {
33
33
const accessStore = useAccessStore . getState ( ) ;
34
34
35
35
let baseUrl = "" ;
@@ -51,7 +51,7 @@ export class GeminiProApi implements LLMApi {
51
51
console . log ( "[Proxy Endpoint] " , baseUrl , path ) ;
52
52
53
53
let chatPath = [ baseUrl , path ] . join ( "/" ) ;
54
- if ( ! chatPath . includes ( "gemini-pro" ) ) {
54
+ if ( shouldStream ) {
55
55
chatPath += chatPath . includes ( "?" ) ? "&alt=sse" : "?alt=sse" ;
56
56
}
57
57
@@ -169,7 +169,10 @@ export class GeminiProApi implements LLMApi {
169
169
options . onController ?.( controller ) ;
170
170
try {
171
171
// 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
+ ) ;
173
176
174
177
const chatPayload = {
175
178
method : "POST" ,
You can’t perform that action at this time.
0 commit comments