(id: string)
| 343 | } |
| 344 | |
| 345 | export function deleteConfig(id: string): { success: boolean; error?: string } { |
| 346 | const store = loadConfigStore() |
| 347 | const index = store.configs.findIndex((c) => c.id === id) |
| 348 | |
| 349 | if (index === -1) { |
| 350 | return { success: false, error: t('llm.configNotFound') } |
| 351 | } |
| 352 | |
| 353 | store.configs.splice(index, 1) |
| 354 | |
| 355 | const fallback = store.configs[0] |
| 356 | if (store.defaultAssistant?.configId === id) { |
| 357 | store.defaultAssistant = fallback ? { configId: fallback.id, modelId: fallback.model || '' } : null |
| 358 | } |
| 359 | if (store.fastModel?.configId === id) { |
| 360 | store.fastModel = fallback ? { configId: fallback.id, modelId: fallback.model || '' } : null |
| 361 | } |
| 362 | |
| 363 | saveConfigStore(store) |
| 364 | return { success: true } |
| 365 | } |
| 366 | |
| 367 | /** 设置默认助手模型(configId + modelId) */ |
| 368 | export function setDefaultAssistantModel(configId: string, modelId: string): { success: boolean; error?: string } { |
nothing calls this directly
no test coverage detected