(input: Omit<ModelDefinition, 'builtin' | 'editable'>)
| 40 | } |
| 41 | |
| 42 | export 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 | |
| 60 | export function updateCustomModel( |
| 61 | providerId: string, |
nothing calls this directly
no test coverage detected