Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): a model named the way a person says it is found for a workflow (C60-S5)

purple0bf5000af8d4
diff --git a/src/api/mcp/__tests__/workflow-tools.test.ts b/src/api/mcp/__tests__/workflow-tools.test.ts
index d4d35205..0a4921b1 100644
--- a/src/api/mcp/__tests__/workflow-tools.test.ts
+++ b/src/api/mcp/__tests__/workflow-tools.test.ts
@@ -99,7 +99,7 @@ beforeEach(() => {
vi.clearAllMocks()
useWorkflowCardStore.setState({ queue: [] })
useWorkflowStore.setState({ installedWorkflows: [], modelNameAssignments: {}, modelTypeAssignments: {} })
- h.checkpoints.mockResolvedValue(['sd15.safetensors', 'flux1-dev.safetensors'])
+ h.checkpoints.mockResolvedValue(['sd15.safetensors', 'flux1-dev.safetensors', 'Realistic_Vision_V6.0_NV_B1_fp16.safetensors'])
h.backendCall.mockResolvedValue({ status: 'ok' })
h.startModelDownload.mockResolvedValue({ status: 'started', id: 'd1' })
h.restart.mockResolvedValue(undefined)
@@ -306,6 +306,14 @@ describe('workflow_assign', () => {
expect(await executeWorkflowAssign({ workflow: 'Flux Upscale', model: 'flux1-dev' }, run())).toMatch(/^Refused: the user did not ask/)
})
+ it('a model named the way a person says it is found', async () => {
+ userSays('nutze den Flux Upscale Workflow für Realistic Vision')
+ const pending = executeWorkflowAssign({ workflow: 'Flux Upscale', model: 'Realistic Vision' }, run())
+ const req = await answerCard(true)
+ expect(req.assign?.model).toBe('Realistic_Vision_V6.0_NV_B1_fp16.safetensors')
+ expect(await pending).toMatch(/now generates with "Flux Upscale"/)
+ })
+
it('card, yes, assigned; an unknown model is refused', async () => {
userSays('nutze den Flux Upscale Workflow für flux1-dev')
expect(await executeWorkflowAssign({ workflow: 'Flux Upscale', model: 'nope' }, run())).toMatch(/There is no installed model/)
diff --git a/src/api/mcp/workflow-tools.ts b/src/api/mcp/workflow-tools.ts
index c7b3e04e..2a449bf0 100644
--- a/src/api/mcp/workflow-tools.ts
+++ b/src/api/mcp/workflow-tools.ts
@@ -192,7 +192,11 @@ async function resolveModel(raw: string): Promise<{ ok: true; name: string } | {
const want = raw.trim().toLowerCase()
const exact = names.find((n) => n.toLowerCase() === want)
if (exact) return { ok: true, name: exact }
- const near = names.filter((n) => n.toLowerCase().includes(want) || want.includes(n.toLowerCase().replace(/\.[^.]+$/, '')))
+ // "Realistic Vision" is how a person names Realistic_Vision_V6.0_NV_B1_fp16.safetensors:
+ // separators and the extension do not count.
+ const norm = (t: string) => t.toLowerCase().replace(/\.(safetensors|sft|gguf|ckpt|pt|pth|bin)$/, '').replace(/[\s_\-./\\]+/g, ' ').trim()
+ const w = norm(raw)
+ const near = w.length < 3 ? [] : names.filter((n) => norm(n).includes(w) || w.includes(norm(n)))
if (near.length === 1) return { ok: true, name: near[0] }
return { ok: false, reply: `There is no installed model "${cleanName(raw, 80)}".${near.length ? ` Closest: ${near.slice(0, 4).join(', ')}.` : ''} Nothing changed.` }
}