File tree Expand file tree Collapse file tree 3 files changed +3
-17
lines changed
Expand file tree Collapse file tree 3 files changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,7 @@ use serde::{Deserialize, Serialize};
66use std:: collections:: HashMap ;
77use std:: time:: Duration ;
88
9- // Accept common OpenAI chat models. Keep minimal allowlist but include the requested one.
10- const SUPPORTED_MODELS : & [ & str ] = & [ "gpt-5-nano" , "gpt-5" , "gpt-4.1-2025-04-14" ] ;
11-
129pub struct OpenAIProvider {
13- #[ allow( dead_code) ]
1410 api_key : String ,
1511 model : String ,
1612 client : Client ,
@@ -24,11 +20,7 @@ impl OpenAIProvider {
2420 model : String ,
2521 mut options : HashMap < String , serde_json:: Value > ,
2622 ) -> Result < Self , AIError > {
27- // Validate model (allow if in list; otherwise accept for forward compatibility)
28- if !SUPPORTED_MODELS . contains ( & model. as_str ( ) ) {
29- // Don’t hard fail; just log a warning and continue
30- log:: warn!( "OpenAI model not in local allowlist: {}" , model) ;
31- }
23+ // Do not restrict model IDs; accept any OpenAI-compatible model string
3224
3325 // Determine if auth is required
3426 let no_auth = options
Original file line number Diff line number Diff line change @@ -65,14 +65,11 @@ export function OpenAICompatConfigModal({
6565 try {
6666 const computedNoAuth = apiKey . trim ( ) === "" ;
6767 await invoke ( "test_openai_endpoint" , {
68- // Provide both snake_case and camelCase for compatibility with backend param names
68+ // Standardize to snake_case for Tauri command args
6969 base_url : baseUrl . trim ( ) ,
70- baseUrl : baseUrl . trim ( ) ,
7170 model : model . trim ( ) ,
7271 api_key : computedNoAuth ? undefined : apiKey . trim ( ) ,
73- apiKey : computedNoAuth ? undefined : apiKey . trim ( ) ,
7472 no_auth : computedNoAuth ,
75- noAuth : computedNoAuth ,
7673 } ) ;
7774 setTestResult ( { ok : true , message : "Connection successful" } ) ;
7875 } catch ( e : any ) {
Original file line number Diff line number Diff line change @@ -115,14 +115,11 @@ export const saveOpenAIKeyWithConfig = async (
115115
116116 await invoke ( 'validate_and_cache_api_key' , {
117117 provider,
118- // Send both camelCase and snake_case keys for compatibility
119- apiKey : apiKey || undefined ,
118+ // Standardize to snake_case for Tauri commands
120119 api_key : apiKey || undefined ,
121120 base_url : baseUrl ,
122- baseUrl : baseUrl ,
123121 model,
124122 no_auth : noAuth || ! apiKey ?. trim ( ) ,
125- noAuth : noAuth || ! apiKey ?. trim ( ) ,
126123 } ) ;
127124
128125 // Persist provider + model selection
You can’t perform that action at this time.
0 commit comments