@@ -322,8 +322,8 @@ export function useTextModelManager() {
322322 const providerMeta = providers . value . find ( p => p . id === providerId )
323323 if ( providerMeta ?. defaultBaseURL ) {
324324 form . value . connectionConfig = {
325- ... form . value . connectionConfig ,
326- baseURL : providerMeta . defaultBaseURL
325+ baseURL : form . value . connectionConfig . baseURL || providerMeta . defaultBaseURL ,
326+ ... form . value . connectionConfig
327327 }
328328 }
329329
@@ -411,8 +411,8 @@ export function useTextModelManager() {
411411 try {
412412 const providerTemplateId = form . value . providerId || currentProviderType . value || 'custom'
413413 const connectionConfig : TextConnectionConfig = {
414- ...form . value . connectionConfig ,
415414 baseURL,
415+ ...form . value . connectionConfig ,
416416 apiKey : form . value . displayMaskedKey && form . value . originalApiKey
417417 ? form . value . originalApiKey
418418 : form . value . connectionConfig . apiKey
@@ -494,8 +494,8 @@ export function useTextModelManager() {
494494 }
495495
496496 const connectionConfig : TextConnectionConfig = {
497- ... form . value . connectionConfig ,
498- baseURL : ( form . value . connectionConfig . baseURL as string ) ?. trim ( ) || existingConfig . connectionConfig ?. baseURL
497+ baseURL : ( form . value . connectionConfig . baseURL as string ) ?. trim ( ) || existingConfig . connectionConfig ?. baseURL ,
498+ ... form . value . connectionConfig
499499 }
500500
501501 if ( form . value . displayMaskedKey ) {
@@ -586,16 +586,12 @@ export function useTextModelManager() {
586586 : undefined
587587
588588 const connectionConfig : TextConnectionConfig = {
589+ baseURL : baseURL || existingConfig . connectionConfig ?. baseURL ,
589590 ...existingConfig . connectionConfig ,
590591 ...form . value . connectionConfig ,
591- baseURL : baseURL || existingConfig . connectionConfig ?. baseURL ,
592592 apiKey : form . value . displayMaskedKey && form . value . originalApiKey
593593 ? form . value . originalApiKey
594- : form . value . connectionConfig . apiKey
595- }
596-
597- if ( ! connectionConfig . apiKey && existingConfig . connectionConfig ?. apiKey ) {
598- connectionConfig . apiKey = existingConfig . connectionConfig . apiKey
594+ : ( form . value . connectionConfig . apiKey || existingConfig . connectionConfig ?. apiKey )
599595 }
600596
601597 const tempConfig : TextModelConfig = {
0 commit comments