fix(desktop): use model catalog config shape
This commit is contained in:
@@ -31,8 +31,8 @@
|
|||||||
apiKey: !!js process.env.DEEPSEEK_API_KEY
|
apiKey: !!js process.env.DEEPSEEK_API_KEY
|
||||||
baseURL: !!js process.env.DEEPSEEK_BASE_URL
|
baseURL: !!js process.env.DEEPSEEK_BASE_URL
|
||||||
models:
|
models:
|
||||||
- deepseek-v4-flash
|
- id: deepseek-v4-flash
|
||||||
- deepseek-v4-pro
|
- id: deepseek-v4-pro
|
||||||
# Showcase default: pin thinking on so the reasoning fold — our headline
|
# Showcase default: pin thinking on so the reasoning fold — our headline
|
||||||
# visualization — is visible out of the box for a first-run user. The
|
# visualization — is visible out of the box for a first-run user. The
|
||||||
# provider default is already "enabled", but a future flip would silently
|
# provider default is already "enabled", but a future flip would silently
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
apiKey: !!js process.env.DEEPSEEK_API_KEY
|
apiKey: !!js process.env.DEEPSEEK_API_KEY
|
||||||
baseURL: !!js process.env.DEEPSEEK_BASE_URL
|
baseURL: !!js process.env.DEEPSEEK_BASE_URL
|
||||||
models:
|
models:
|
||||||
- deepseek-v4-pro
|
- id: deepseek-v4-pro
|
||||||
- deepseek-v4-flash
|
- id: deepseek-v4-flash
|
||||||
|
|
||||||
- id: bash
|
- id: bash
|
||||||
name: '@deepseek-ai/dsh-bash-local'
|
name: '@deepseek-ai/dsh-bash-local'
|
||||||
|
|||||||
@@ -69,11 +69,9 @@ test('modelsFor: the profile default model IS in its supported list (no self-mis
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Source-of-truth check: PROFILE_MODELS mirrors each yml leaf's `models:`
|
// PROFILE_MODELS mirrors the `id` fields in each DeepSeek model catalog so
|
||||||
// block, so a future yaml edit that adds/removes a model can't drift
|
// the renderer cannot drift from the runtime's validated configuration.
|
||||||
// silently. We parse the yaml the shell-way — one leaf per profile — and
|
test('PROFILE_MODELS: each entry matches its yml leaf model catalog', () => {
|
||||||
// compare the `models:` list line-by-line.
|
|
||||||
test('PROFILE_MODELS: each entry matches its yml leaf models: block', () => {
|
|
||||||
const leafFor = {
|
const leafFor = {
|
||||||
'daemon-echo': null, // mock-llm — no models: block in yaml, always mock-echo
|
'daemon-echo': null, // mock-llm — no models: block in yaml, always mock-echo
|
||||||
'stdio-echo': null, // mock-llm — ditto
|
'stdio-echo': null, // mock-llm — ditto
|
||||||
@@ -91,11 +89,8 @@ test('PROFILE_MODELS: each entry matches its yml leaf models: block', () => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const yaml = fs.readFileSync(leafPath, 'utf8')
|
const yaml = fs.readFileSync(leafPath, 'utf8')
|
||||||
// Find the `models:` block under `llm-deepseek` and collect its
|
// Catalog entries must use the object form required by llm-deepseek's
|
||||||
// `- <name>` entries. The block is 6-space-indented, sits inside a
|
// schema. A scalar entry leaves yamlModels empty and fails this test.
|
||||||
// `config:` map, and terminates when the indent drops back to a
|
|
||||||
// 2-space `- id:` list item. Bail early at the first line whose
|
|
||||||
// trim doesn't start with `- ` after the models: header.
|
|
||||||
const lines = yaml.split('\n')
|
const lines = yaml.split('\n')
|
||||||
let inBlock = false
|
let inBlock = false
|
||||||
const yamlModels = []
|
const yamlModels = []
|
||||||
@@ -104,13 +99,12 @@ test('PROFILE_MODELS: each entry matches its yml leaf models: block', () => {
|
|||||||
if (/^\s+models:\s*$/.test(rawLine)) { inBlock = true; continue }
|
if (/^\s+models:\s*$/.test(rawLine)) { inBlock = true; continue }
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Inside the block: entries look like ` - deepseek-v4-flash`.
|
const m = /^\s+-\s+id:\s+([\w-]+)\s*$/.exec(rawLine)
|
||||||
const m = /^\s+-\s+([\w-]+)\s*$/.exec(rawLine)
|
|
||||||
if (m) { yamlModels.push(m[1]); continue }
|
if (m) { yamlModels.push(m[1]); continue }
|
||||||
// Any other non-empty line terminates the block.
|
// Any other non-empty line terminates the block.
|
||||||
if (rawLine.trim() !== '') break
|
if (rawLine.trim() !== '') break
|
||||||
}
|
}
|
||||||
assert.ok(yamlModels.length > 0, `${leafPath}: parsed empty models: block`)
|
assert.ok(yamlModels.length > 0, `${leafPath}: models must contain object entries with id fields`)
|
||||||
assert.deepEqual(expected.slice().sort(), yamlModels.slice().sort(),
|
assert.deepEqual(expected.slice().sort(), yamlModels.slice().sort(),
|
||||||
`${profileName} PROFILE_MODELS drift vs ${path.basename(leafPath)}: expected ${JSON.stringify(yamlModels)}, got ${JSON.stringify(expected)}`)
|
`${profileName} PROFILE_MODELS drift vs ${path.basename(leafPath)}: expected ${JSON.stringify(yamlModels)}, got ${JSON.stringify(expected)}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user