mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
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 <noreply@paperclip.ing>
This commit is contained in:
1 parent
36a84ca38b
commit
6fb43cc4d2
1 file changed
+57
@@ -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([]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user