File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -373,9 +373,14 @@ export function ProviderForm({
373373 const generateJsonFromFields = useCallback ( ( ) => {
374374 const env : Record < string , string > = { } ;
375375 if ( apiKey ) {
376+ // 同时设置两个 API Key,支持 OpenAI 和 Anthropic 两种协议
376377 env . ANTHROPIC_API_KEY = apiKey ;
378+ env . OPENAI_API_KEY = apiKey ;
379+ }
380+ if ( baseUrl ) {
381+ env . ANTHROPIC_BASE_URL = baseUrl ;
382+ env . OPENAI_BASE_URL = baseUrl ;
377383 }
378- if ( baseUrl ) env . ANTHROPIC_BASE_URL = baseUrl ;
379384 if ( primaryModel ) env . ANTHROPIC_MODEL = primaryModel ;
380385 if ( haikuModel ) env . ANTHROPIC_DEFAULT_HAIKU_MODEL = haikuModel ;
381386 if ( sonnetModel ) env . ANTHROPIC_DEFAULT_SONNET_MODEL = sonnetModel ;
Original file line number Diff line number Diff line change @@ -345,9 +345,14 @@ export function ProviderForm({
345345 const generateJsonFromFields = useCallback ( ( ) => {
346346 const env : Record < string , string > = { } ;
347347 if ( apiKey ) {
348+ // 同时设置两个 API Key,支持 OpenAI 和 Anthropic 两种协议
348349 env . ANTHROPIC_API_KEY = apiKey ;
350+ env . OPENAI_API_KEY = apiKey ;
351+ }
352+ if ( baseUrl ) {
353+ env . ANTHROPIC_BASE_URL = baseUrl ;
354+ env . OPENAI_BASE_URL = baseUrl ;
349355 }
350- if ( baseUrl ) env . ANTHROPIC_BASE_URL = baseUrl ;
351356 if ( primaryModel ) env . ANTHROPIC_MODEL = primaryModel ;
352357 if ( haikuModel ) env . ANTHROPIC_DEFAULT_HAIKU_MODEL = haikuModel ;
353358 if ( sonnetModel ) env . ANTHROPIC_DEFAULT_SONNET_MODEL = sonnetModel ;
You can’t perform that action at this time.
0 commit comments