feat(webui): forward generation overrides into run snapshots
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -342,4 +342,53 @@ describe("conversation run route", () => {
|
||||
);
|
||||
expect(snapshotCreations).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("forwards generation overrides into the run snapshot request", async () => {
|
||||
const deployment = scopedDeployment();
|
||||
deployment.threadClient.threads.get.mockResolvedValue({
|
||||
thread_id: "thread-a",
|
||||
metadata: {
|
||||
workspace_scope_id: "00000000-0000-4000-8000-000000000010",
|
||||
model_selection: {
|
||||
primary: { provider_id: "zhipu-glm", model_key: "glm-5.2" },
|
||||
reasoning_effort: null,
|
||||
temperature: 1.2,
|
||||
top_p: 0.5,
|
||||
},
|
||||
model_selection_revision: 3,
|
||||
},
|
||||
});
|
||||
mocks.getActiveDeployment.mockResolvedValue(deployment);
|
||||
|
||||
const request = new Request(
|
||||
"http://localhost/api/conversations/thread-a/runs",
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
input: { messages: [{ type: "human", content: "hello" }] },
|
||||
}),
|
||||
}
|
||||
);
|
||||
const response = await routes.POST(
|
||||
request as unknown as NextRequest,
|
||||
context
|
||||
);
|
||||
expect(response.status).toBe(201);
|
||||
|
||||
const snapshotCall = mocks.configApiFetch.mock.calls.find(
|
||||
([, path, options]) =>
|
||||
path === "/api/runtime-snapshots" &&
|
||||
(options as { method?: string })?.method === "POST"
|
||||
);
|
||||
expect(snapshotCall).toBeDefined();
|
||||
const body = (snapshotCall![2] as { body: Record<string, unknown> }).body;
|
||||
expect(body).toMatchObject({
|
||||
primary: { provider_id: "zhipu-glm", model_key: "glm-5.2" },
|
||||
reasoning_effort: null,
|
||||
temperature: 1.2,
|
||||
top_p: 0.5,
|
||||
model_selection_revision: 3,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -228,6 +228,14 @@ export async function POST(request: NextRequest, context: RouteContext) {
|
||||
selectionRef === "inherit"
|
||||
? null
|
||||
: (selectionRef.reasoning_effort ?? null),
|
||||
temperature:
|
||||
selectionRef === "inherit"
|
||||
? null
|
||||
: (selectionRef.temperature ?? null),
|
||||
top_p:
|
||||
selectionRef === "inherit"
|
||||
? null
|
||||
: (selectionRef.top_p ?? null),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user