fix(webui): keep the reasoning slider visible while levels load (#6707)
This commit is contained in:
1 parent
f6f49ccca5
commit
d1e1d7bc5e
6 files changed
+65
-14
No files matched your search
@@ -12,6 +12,7 @@ import { createStreamClient } from "@/tests/stream-client";
|
||||
const params = new URLSearchParams(location.search);
|
||||
const isChinese = params.get("lang")?.startsWith("zh");
|
||||
const showSettings = params.has("settings");
|
||||
const loadCodexCatalog = params.has("codex-catalog");
|
||||
const providers = {
|
||||
openai_codex: { label: "OpenAI Codex", auth_type: "oauth", codex_fast_mode_supported: true, codex_ultrafast_models: ["gpt-6.2-sol"] },
|
||||
github_copilot: { label: "GitHub Copilot", auth_type: "oauth" },
|
||||
@@ -69,13 +70,15 @@ const groups = [
|
||||
] },
|
||||
];
|
||||
const group = groups.find(({ id }) => id === params.get("group")) ?? groups[0]!;
|
||||
const base = group.id === "oauth" ? (params.has("ultrafast") ? ultrafastCodex : standardCodex) : group.presets[0]!;
|
||||
const base = loadCodexCatalog
|
||||
? preset("Review", "openai_codex", "openai-codex/gpt-6.2-sol", "xhigh", ["low", "medium", "high"], { default: false, ultrafast_supported: true })
|
||||
: group.id === "oauth" ? (params.has("ultrafast") ? ultrafastCodex : standardCodex) : group.presets[0]!;
|
||||
const settings: SettingsPayload = {
|
||||
...baseSettings,
|
||||
agent: { ...baseSettings.agent, model: base.model, provider: base.provider, resolved_provider: base.provider,
|
||||
reasoning_effort: base.reasoning_effort },
|
||||
providers: Object.entries(providers).map(([name, provider]) => ({
|
||||
name, configured: true, model_catalog: "unsupported", ...provider,
|
||||
name, configured: true, model_catalog: loadCodexCatalog && name === "openai_codex" ? "hybrid" : "unsupported", ...provider,
|
||||
})),
|
||||
model_presets: [{ ...base, name: "default", label: "Default", active: true, is_default: true }, ...group.presets],
|
||||
model_call_order: group.presets.map(({ name }) => name),
|
||||
@@ -109,8 +112,10 @@ function FixtureNav() {
|
||||
|
||||
/** Fully task-local fixture: no real gateway, authentication, or network mutations. */
|
||||
export function installModelOptionsPreviewApi() {
|
||||
window.fetch = async (input) => {
|
||||
const fetch = window.fetch.bind(window);
|
||||
window.fetch = async (input, init) => {
|
||||
const url = String(input);
|
||||
if (loadCodexCatalog && url.includes("/api/settings/provider-models?")) return fetch(input, init);
|
||||
if (url.includes("/webui-thread")) return Response.json({ schemaVersion: 3, projection: "events", events: [] });
|
||||
if (url.includes("/commands")) return Response.json({ commands: [] });
|
||||
if (url.includes("/api/settings")) return Response.json(settings);
|
||||
|
||||
@@ -195,6 +195,35 @@ test("provider examples switch from Codex to direct API and gateway capabilities
|
||||
await expect(reasoning).toHaveAttribute("aria-valuetext", "Auto");
|
||||
});
|
||||
|
||||
test("keeps the reasoning slider track visible while a Codex preset awaits its effort levels", async ({ page }) => {
|
||||
const catalogUrl = /\/api\/settings\/provider-models\?provider=openai_codex$/;
|
||||
let releaseCatalog!: () => void;
|
||||
const catalogGated = new Promise<void>((resolve) => { releaseCatalog = resolve; });
|
||||
await page.route(catalogUrl, async (route) => {
|
||||
await catalogGated;
|
||||
await route.fulfill({ json: {
|
||||
provider: "openai_codex", label: "OpenAI Codex", status: "available", catalog_kind: "hybrid", source: "remote", model_count: 1,
|
||||
models: [{ id: "openai-codex/gpt-6.2-sol", reasoning_efforts: ["low", "medium", "high", "xhigh", "max", "ultra"] }],
|
||||
} });
|
||||
});
|
||||
await page.goto("/browser/fixture.html?case=model-options&codex-catalog");
|
||||
const dialog = page.getByRole("dialog", { name: "Switch model", exact: true });
|
||||
const effort = dialog.getByRole("slider", { name: "Reasoning effort" });
|
||||
try {
|
||||
await Promise.all([page.waitForRequest(catalogUrl), page.getByRole("button", { name: "Default", exact: true }).click()]);
|
||||
await expect(dialog.locator(".reasoning-effort-track")).toBeVisible();
|
||||
await expect(dialog.getByText("xhigh", { exact: true })).toBeVisible();
|
||||
await expect(dialog.getByRole("combobox", { name: "Reasoning effort" })).toHaveCount(0);
|
||||
await expect(effort).toHaveCount(0);
|
||||
await expect(dialog.getByRole("button", { name: "Fast", exact: true })).toBeEnabled();
|
||||
} finally {
|
||||
releaseCatalog();
|
||||
}
|
||||
await expect(effort).toHaveAttribute("aria-valuetext", "xhigh");
|
||||
await effort.press("ArrowLeft");
|
||||
await expect(effort).toHaveAttribute("aria-valuetext", "high");
|
||||
});
|
||||
|
||||
test("keeps the custom reasoning effort as a concrete value for a self-hosted preset", async ({ page }) => {
|
||||
await page.goto("/browser/fixture.html?case=model-options&group=local");
|
||||
await page.getByRole("button", { name: "Default", exact: true }).click();
|
||||
|
||||
Reference in new issue
Block a user