From 6fb43cc4d23f3fcd47a98a9735cbd00ef802b4a9 Mon Sep 17 00:00:00 2001 From: Dotta Date: Wed, 29 Apr 2026 11:43:01 -0500 Subject: [PATCH] Mock cheap-model adapter endpoints in Storybook fixtures The AgentConfigForm cheap-model section reads /api/adapters and /api/companies/:id/adapters/:type/{models,model-profiles}. Mocking these in the Storybook preview lets stories render the new section against realistic adapter capability data instead of falling back to the client-side defaults. Co-Authored-By: Paperclip --- ui/storybook/.storybook/preview.tsx | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/ui/storybook/.storybook/preview.tsx b/ui/storybook/.storybook/preview.tsx index 46a01e9e5ca..3d0397d2033 100644 --- a/ui/storybook/.storybook/preview.tsx +++ b/ui/storybook/.storybook/preview.tsx @@ -87,6 +87,63 @@ function installStorybookApiFixtures() { }); } + if (url.pathname === "/api/adapters") { + return Response.json([ + { + type: "claude_local", + label: "Claude Local", + source: "builtin", + modelsCount: 2, + loaded: true, + disabled: false, + capabilities: { + supportsInstructionsBundle: true, + supportsSkills: true, + supportsLocalAgentJwt: true, + requiresMaterializedRuntimeSkills: false, + supportsModelProfiles: true, + }, + }, + { + type: "codex_local", + label: "Codex Local", + source: "builtin", + modelsCount: 3, + loaded: true, + disabled: false, + capabilities: { + supportsInstructionsBundle: true, + supportsSkills: true, + supportsLocalAgentJwt: true, + requiresMaterializedRuntimeSkills: false, + supportsModelProfiles: true, + }, + }, + ]); + } + + const adapterModelsMatch = url.pathname.match( + /^\/api\/companies\/[^/]+\/adapters\/([^/]+)\/(models|model-profiles)$/, + ); + if (adapterModelsMatch) { + const [, , resource] = adapterModelsMatch; + if (resource === "models") { + return Response.json([ + { id: "claude-opus-4-7", label: "Claude Opus 4.7" }, + { id: "claude-sonnet-4-6", label: "Claude Sonnet 4.6" }, + { id: "claude-haiku-4-5", label: "Claude Haiku 4.5" }, + ]); + } + return Response.json([ + { + key: "cheap", + label: "Cheap", + adapterConfig: { model: "claude-sonnet-4-6" }, + source: "adapter_default", + }, + ]); + } + if (url.pathname === "/api/plugins/ui-contributions") { return Response.json([]); }