@@ -118,10 +118,9 @@ export default function SettingsModal() {
118118 set ( 'mcpConfig' , localMcpConfig )
119119 set ( 'enableFileLogging' , localEnableFileLogging )
120120
121- // 批量更新所有 provider configs
122- for ( const [ providerId , config ] of Object . entries ( finalProviderConfigs ) ) {
123- setProvider ( providerId , config )
124- }
121+ // 同步 providerConfigs:先删除不存在于 localProviderConfigs 的,再更新/添加
122+ // 使用 set 直接替换整个 providerConfigs,确保删除的配置也被移除
123+ set ( 'providerConfigs' , finalProviderConfigs )
125124
126125 // 编辑器配置统一保存 - 合并 editorSettings 和 advancedEditorConfig
127126 const finalEditorConfig = {
@@ -186,16 +185,16 @@ export default function SettingsModal() {
186185 } , [ localConfig , localLanguage , localAutoApprove , localPromptTemplateId , localAgentConfig , localAiInstructions , localWebSearchConfig , localMcpConfig , localEnableFileLogging , localProviderConfigs , editorSettings , advancedEditorConfig , set , setProvider , save ] )
187186
188187 // 使用 useMemo 缓存计算结果
189- const providers = useMemo ( ( ) =>
188+ const providers = useMemo ( ( ) =>
190189 Object . entries ( PROVIDERS ) . map ( ( [ id , p ] ) => ( {
191190 id,
192191 name : p . displayName ,
193192 models : [ ...( p . models || [ ] ) , ...( providerConfigs [ id ] ?. customModels || [ ] ) ]
194193 } ) ) ,
195194 [ providerConfigs ]
196195 )
197-
198- const selectedProvider = useMemo ( ( ) =>
196+
197+ const selectedProvider = useMemo ( ( ) =>
199198 providers . find ( p => p . id === localConfig . provider ) ,
200199 [ providers , localConfig . provider ]
201200 )
@@ -235,8 +234,8 @@ export default function SettingsModal() {
235234 key = { tab . id }
236235 onClick = { ( ) => setActiveTab ( tab . id ) }
237236 className = { `w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200 group ${ activeTab === tab . id
238- ? 'bg-accent text-white shadow-md shadow-accent/20'
239- : 'text-text-secondary hover:bg-surface-hover hover:text-text-primary'
237+ ? 'bg-accent text-white shadow-md shadow-accent/20'
238+ : 'text-text-secondary hover:bg-surface-hover hover:text-text-primary'
240239 } `}
241240 >
242241 < span className = { `transition-colors duration-200 ${ activeTab === tab . id ? 'text-white' : 'text-text-muted group-hover:text-text-primary' } ` } >
@@ -337,8 +336,8 @@ export default function SettingsModal() {
337336 variant = { saved ? 'success' : 'primary' }
338337 onClick = { handleSave }
339338 className = { `min-w-[140px] shadow-lg transition-all duration-300 rounded-xl ${ saved
340- ? 'bg-status-success hover:bg-status-success/90 text-white'
341- : 'bg-accent hover:bg-accent-hover text-white shadow-accent/20'
339+ ? 'bg-status-success hover:bg-status-success/90 text-white'
340+ : 'bg-accent hover:bg-accent-hover text-white shadow-accent/20'
342341 } `}
343342 >
344343 { saved ? (
0 commit comments