File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 33import { GoogleGenAI } from "@google/genai" ;
44
55export async function generateContent ( prompt : string ) {
6+ const params = {
7+ model : "gemini-2.5-flash" ,
8+ contents : prompt ,
9+ } ;
10+
611 const ai = new GoogleGenAI ( { apiKey : process . env . API_KEY ! } ) ;
712
813 try {
9- return await ai . models . generateContent ( {
10- model : "gemini-2.5-flash" ,
11- contents : prompt ,
12- } ) ;
14+ return await ai . models . generateContent ( params ) ;
1315 } catch ( e : unknown ) {
1416 if ( String ( e ) . includes ( "User location is not supported" ) ) {
1517 // For the new API, we can use httpOptions to set a custom baseUrl
@@ -19,10 +21,7 @@ export async function generateContent(prompt: string) {
1921 baseUrl : "https://gemini-proxy.utcode.net" ,
2022 } ,
2123 } ) ;
22- return await aiWithProxy . models . generateContent ( {
23- model : "gemini-2.5-flash" ,
24- contents : prompt ,
25- } ) ;
24+ return await aiWithProxy . models . generateContent ( params ) ;
2625 } else {
2726 throw e ;
2827 }
You can’t perform that action at this time.
0 commit comments