@@ -78,6 +78,24 @@ type OAuthStatus =
7878 isLoadingModels : boolean ;
7979 statusMessage ?: string ;
8080 } // Gemini Generate Content API platform
81+ | {
82+ state : 'local_llm_setup' ;
83+ runnerType : 'ollama' | 'lmstudio' | 'jan' | 'localai' | 'custom' ;
84+ baseUrl : string ;
85+ apiKey ?: string ;
86+ modelName : string ;
87+ activeField : 'runner_type' | 'base_url' | 'api_key' | 'model_name' | 'custom_model_name' ;
88+ availableModels : string [ ] ;
89+ isLoadingModels : boolean ;
90+ statusMessage ?: string ;
91+ }
92+ | {
93+ state : 'local_llm_pulling' ;
94+ baseUrl : string ;
95+ modelName : string ;
96+ status : string ;
97+ percentage ?: number ;
98+ }
8199 | { state : 'china_provider_select' ; activeIndex : number } // China LLM: pick provider
82100 | { state : 'china_mode_select' ; provider : ProviderPreset ; activeIndex : number } // China LLM: pick access mode
83101 | { state : 'china_model_select' ; provider : ProviderPreset ; mode : 'api' | 'coding-plan' ; activeIndex : number } // China LLM: pick model
@@ -977,7 +995,7 @@ function OAuthStatusMessage({
977995 } ) ) ,
978996 { label : 'Custom (Type your own)' , value : '__custom__' } ,
979997 ] }
980- onChange = { val => {
998+ onChange = { ( val : string ) => {
981999 if ( val === '__custom__' ) {
9821000 const nextState = buildLocalState ( 'model_name' , '' , 'custom_model_name' ) ;
9831001 setOAuthStatus ( nextState ) ;
@@ -1745,36 +1763,6 @@ function OAuthStatusMessage({
17451763 return ;
17461764 }
17471765
1748- const env : Record < string , string > = { } ;
1749- if ( finalVals . base_url ) env . GEMINI_BASE_URL = finalVals . base_url ;
1750- if ( finalVals . api_key ) env . GEMINI_API_KEY = finalVals . api_key ;
1751- if ( finalVals . haiku_model ) env . GEMINI_DEFAULT_HAIKU_MODEL = finalVals . haiku_model ;
1752- if ( finalVals . sonnet_model ) env . GEMINI_DEFAULT_SONNET_MODEL = finalVals . sonnet_model ;
1753- if ( finalVals . opus_model ) env . GEMINI_DEFAULT_OPUS_MODEL = finalVals . opus_model ;
1754- const { error } = updateSettingsForSource ( 'userSettings' , {
1755- modelType : 'gemini' ,
1756- env,
1757- } as unknown as Parameters < typeof updateSettingsForSource > [ 1 ] ) ;
1758- if ( error ) {
1759- setOAuthStatus ( {
1760- state : 'error' ,
1761- message : `Failed to save: ${ error . message } ` ,
1762- toRetry : {
1763- state : 'gemini_api' ,
1764- baseUrl : '' ,
1765- apiKey : '' ,
1766- haikuModel : '' ,
1767- sonnetModel : '' ,
1768- opusModel : '' ,
1769- activeField : 'base_url' ,
1770- } ,
1771- } ) ;
1772- } else {
1773- for ( const [ k , v ] of Object . entries ( env ) ) process . env [ k ] = v ;
1774- setOAuthStatus ( { state : 'success' } ) ;
1775- void onDone ( ) ;
1776- }
1777-
17781766 const idx = GEMINI_FIELDS . indexOf ( activeField as any ) ;
17791767 if ( idx === GEMINI_FIELDS . length - 1 ) {
17801768 const nextState = buildGeminiState ( activeField , geminiInputValue ) ;
0 commit comments