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

Function deleteConfig

apps/desktop/main/ai/llm/index.ts:345–365  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

343}
344
345export 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) */
368export function setDefaultAssistantModel(configId: string, modelId: string): { success: boolean; error?: string } {

Callers

nothing calls this directly

Calls 3

tFunction · 0.90
loadConfigStoreFunction · 0.85
saveConfigStoreFunction · 0.85

Tested by

no test coverage detected