diff --git a/frontend-modern/src/components/AI/__tests__/aiChatUtils.test.ts b/frontend-modern/src/components/AI/__tests__/aiChatUtils.test.ts index 95e8fe73f..3da5d7dd8 100644 --- a/frontend-modern/src/components/AI/__tests__/aiChatUtils.test.ts +++ b/frontend-modern/src/components/AI/__tests__/aiChatUtils.test.ts @@ -49,14 +49,19 @@ describe('aiChatUtils', () => { it('prefers the server-supplied provider over the id heuristic (#1320)', () => { const models: ModelInfo[] = [ - // Opaque ids that the id heuristic cannot attribute, but with provider set. - { id: 'llama3-8b', name: 'Llama 3 8B', provider: 'ollama' }, - { id: 'qwen3.5-27b', name: 'Qwen', provider: 'ollama' }, + // The id heuristic would MIS-detect these (gpt -> openai, claude -> + // anthropic); the server-supplied provider must win. + { id: 'gpt-oss-20b', name: 'GPT-OSS 20B', provider: 'ollama' }, + { id: 'my-claude-clone', name: 'Clone', provider: 'ollama' }, ]; const grouped = utils.groupModelsByProvider(models); - expect(grouped.get('ollama')?.length).toBe(2); - expect(grouped.has('llama3-8b')).toBe(false); + expect(grouped.get('ollama')?.map((m) => m.id).sort()).toEqual([ + 'gpt-oss-20b', + 'my-claude-clone', + ]); + expect(grouped.has('openai')).toBe(false); + expect(grouped.has('anthropic')).toBe(false); }); }); diff --git a/frontend-modern/src/utils/__tests__/patrolFormat.test.ts b/frontend-modern/src/utils/__tests__/patrolFormat.test.ts index e0732a78b..05764abd6 100644 --- a/frontend-modern/src/utils/__tests__/patrolFormat.test.ts +++ b/frontend-modern/src/utils/__tests__/patrolFormat.test.ts @@ -250,14 +250,15 @@ describe('patrolFormat', () => { it('prefers the server-supplied provider over the id prefix (#1320)', () => { const models = [ - // Opaque id (no recognizable provider prefix) but an explicit provider. - { id: 'llama3-8b', name: 'Llama 3 8B', provider: 'ollama' }, - { id: 'qwen3.5-27b', name: 'Qwen', provider: 'ollama' }, + // The id prefix/heuristic would mis-group these; provider must win. + { id: 'gpt-oss-20b', name: 'GPT-OSS 20B', provider: 'ollama' }, + { id: 'my-claude-clone', name: 'Clone', provider: 'ollama' }, ]; const groups = groupModelsByProvider(models); expect(groups.get('ollama')).toHaveLength(2); - expect(groups.has('llama3-8b')).toBe(false); + expect(groups.has('gpt-oss-20b')).toBe(false); + expect(groups.has('my-claude-clone')).toBe(false); }); }); });