fix(webui): route first-run model setup choices

This commit is contained in:
Xubin Ren
2026-09-02 16:25:07 +08:00
parent b47f0980f1
commit 9a4781982e
12 changed files with 329 additions and 73 deletions
+28 -2
View File
@@ -887,6 +887,7 @@ describe("ThreadShell", () => {
fireEvent.click(screen.getByRole("button", { name: "Close" }));
const input = screen.getByRole("textbox", { name: "Message input" });
await waitFor(() => expect(input).toHaveFocus());
fireEvent.change(input, {
target: { value: "hello" },
});
@@ -896,12 +897,37 @@ describe("ThreadShell", () => {
expect(input).toHaveValue("hello");
fireEvent.click(screen.getByRole("button", { name: "Use an API key" }));
expect(onOpenModelSettings).toHaveBeenCalledTimes(1);
expect(onOpenModelSettings).toHaveBeenCalledWith("apiKey");
expect(input).toHaveValue("hello");
await waitFor(() => expect(input).toHaveFocus());
expect(input).not.toHaveFocus();
expect(client.sendMessage).not.toHaveBeenCalled();
});
it("focuses the composer when returning from model setup", async () => {
const client = makeClient();
const settings = modelSettings("openai-codex/gpt-5.1-codex", "openai_codex");
settings.agent.has_api_key = false;
const view = (focusComposerRequest: number) => wrap(
client,
<ThreadShell
session={session("setup-focus")}
title="Setup focus"
onToggleSidebar={() => {}}
settingsSnapshot={settings}
focusComposerRequest={focusComposerRequest}
/>,
"openai-codex/gpt-5.1-codex",
);
const { rerender } = render(view(0));
const input = await screen.findByRole("textbox", { name: "Message input" });
input.blur();
expect(input).not.toHaveFocus();
rerender(view(1));
await waitFor(() => expect(input).toHaveFocus());
});
it("keeps image generation controls out of the composer", async () => {
const client = makeClient();
const disabledSettings = modelSettings("deepseek-v4-pro", "deepseek");