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

Function addCustomModel

apps/desktop/main/ai/llm/custom-model-store.ts:42–58  ·  view source on GitHub ↗
(input: Omit<ModelDefinition, 'builtin' | 'editable'>)

Source from the content-addressed store, hash-verified

40}
41
42export function addCustomModel(input: Omit<ModelDefinition, 'builtin' | 'editable'>): ModelDefinition {
43 const models = readStore()
44
45 const existing = models.find((m) => m.id === input.id && m.providerId === input.providerId)
46 if (existing) {
47 throw new Error(`Model "${input.id}" already exists under provider "${input.providerId}"`)
48 }
49
50 const newModel: ModelDefinition = {
51 ...input,
52 builtin: false,
53 editable: true,
54 }
55 models.push(newModel)
56 writeStore(models)
57 return newModel
58}
59
60export function updateCustomModel(
61 providerId: string,

Callers

nothing calls this directly

Calls 2

readStoreFunction · 0.70
writeStoreFunction · 0.70

Tested by

no test coverage detected