(aiDataDir: string, id: string)
| 179 | } |
| 180 | |
| 181 | export function deleteLlmConfig(aiDataDir: string, id: string): { success: boolean; error?: string } { |
| 182 | const storeForSave = loadRawConfigStore(aiDataDir) |
| 183 | const index = storeForSave.configs.findIndex((c) => c.id === id) |
| 184 | |
| 185 | if (index === -1) { |
| 186 | return { success: false, error: 'Config not found' } |
| 187 | } |
| 188 | |
| 189 | storeForSave.configs.splice(index, 1) |
| 190 | |
| 191 | const fallback = storeForSave.configs[0] |
| 192 | if (storeForSave.defaultAssistant?.configId === id) { |
| 193 | storeForSave.defaultAssistant = fallback ? { configId: fallback.id, modelId: fallback.model || '' } : null |
| 194 | } |
| 195 | if (storeForSave.fastModel?.configId === id) { |
| 196 | storeForSave.fastModel = fallback ? { configId: fallback.id, modelId: fallback.model || '' } : null |
| 197 | } |
| 198 | |
| 199 | saveLlmConfig(aiDataDir, storeForSave) |
| 200 | return { success: true } |
| 201 | } |
| 202 | |
| 203 | export function setDefaultAssistantSlot( |
| 204 | aiDataDir: string, |
nothing calls this directly
no test coverage detected