fix(webui): keep schema defaults out of model presets

This commit is contained in:
Xubin Ren committed 2026-09-02 16:25:07 +08:00
1 parent 94d62f86a0
commit 0274c11bfb
7 files changed
+169 -6

No files matched your search

+43
View File
@@ -690,6 +690,7 @@ describe("Settings models", () => {
model_presets: [defaultPreset],
model_call_order: [],
model_call_order_editable: false,
model_configuration_migratable: true,
};
const fetchMock = vi.fn(async (input: RequestInfo | URL) => {
const url = String(input);
@@ -725,6 +726,48 @@ describe("Settings models", () => {
expect(screen.queryByText("Default")).not.toBeInTheDocument();
});
it("starts fresh users with an empty preset list instead of legacy conversion", async () => {
const base = settingsPayload();
const freshPayload: SettingsPayload = {
...base,
agent: {
...base.agent,
model: "anthropic/claude-opus-4-5",
provider: "auto",
resolved_provider: null,
has_api_key: false,
model_preset: "default",
},
model_presets: [
{
...base.model_presets[0],
name: "default",
label: "Default",
active: true,
is_default: true,
model: "anthropic/claude-opus-4-5",
provider: "auto",
resolved_provider: null,
},
],
model_call_order: [],
model_call_order_editable: false,
model_configuration_migratable: false,
providers: [],
};
vi.stubGlobal("fetch", vi.fn(() => new Promise<Response>(() => {})));
renderSettingsView({ initialSection: "models", initialSettings: freshPayload });
expect(
await screen.findByRole("button", { name: "New model preset" }),
).toBeInTheDocument();
expect(
screen.queryByRole("button", { name: "Convert to presets" }),
).not.toBeInTheDocument();
expect(screen.queryByText("claude-opus-4-5")).not.toBeInTheDocument();
});
it("does not expose the synthetic default configuration as a WebUI preset", async () => {
const base = settingsPayload();
const payload: SettingsPayload = {