Files
windmill/ai_evals/adapters/frontend/aiProviderModels.vitest.ts
GuilhemandClaude Opus 5 449b1a6933 fix: ground the chat's AI agent provider in the workspace's models (#10774)
* fix: ground the chat's AI agent provider in the workspace's models

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: never reject an AI agent model the catalog could not confirm

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test: benchmark AI agent provider grounding in ai_evals

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: only reject an AI agent model an exhaustive listing rules out

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep instance-level AI settings out of the workspace provider catalog

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep untrusted model ids out of the chat's context

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor: carry completeness on the model listing itself

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* docs: correct two comments left behind by the catalog rework

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: bound the model listing and verify the default against it

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: honour a workspace default a filtered listing names

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: recognise a workspace default past the prompt's model cap

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep an aliasing provider's unlisted model ids permissive

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 10:42:02 +02:00

37 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
handleBenchmarkApiFetch,
hasBenchmarkApiHandler,
registerBenchmarkWorkspaceRunnables,
unregisterBenchmarkWorkspace
} from './mockBackend'
// A global eval run registers its workspace under a mkdtemp path, so the workspace id the
// frontend interpolates into the models URL carries slashes. A handler that assumed a single
// path segment silently fell through to the network, and every run took the offline fallback.
const WORKSPACE = '/tmp/wmill-frontend-global-benchmark-abc123'
const RESOURCE = 'f/evals/global/anthropic_main'
const URL_FOR = (workspace: string) =>
`http://benchmark.local/api/w/${workspace}/ai/proxy/models`
describe('benchmark /ai/proxy/models', () => {
it('serves the seeded listing for a workspace id that is a path', async () => {
registerBenchmarkWorkspaceRunnables(WORKSPACE, {
aiProviders: [
{ path: RESOURCE, kind: 'anthropic', models: ['claude-sonnet-5', 'claude-opus-5'] }
]
})
try {
expect(hasBenchmarkApiHandler(URL_FOR(WORKSPACE))).toBe(true)
const response = handleBenchmarkApiFetch(URL_FOR(WORKSPACE), {
headers: { 'X-Resource-Path': RESOURCE, 'X-Provider': 'anthropic' }
})
await expect(response.json()).resolves.toEqual({
data: [{ id: 'claude-sonnet-5' }, { id: 'claude-opus-5' }]
})
} finally {
unregisterBenchmarkWorkspace(WORKSPACE)
}
})
})