MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / deleteLlmConfig

Function deleteLlmConfig

apps/cli/src/ai/llm-config.ts:181–201  ·  view source on GitHub ↗
(aiDataDir: string, id: string)

Source from the content-addressed store, hash-verified

179}
180
181export 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
203export function setDefaultAssistantSlot(
204 aiDataDir: string,

Callers

nothing calls this directly

Calls 2

loadRawConfigStoreFunction · 0.85
saveLlmConfigFunction · 0.85

Tested by

no test coverage detected