fix(webui): align fallback notice and clarify settings action

This commit is contained in:
Xubin Ren committed 2026-09-21 00:13:46 +08:00
1 parent 8473538e7a
commit 1bfb4f6fc7
13 files changed
+24 -14

No files matched your search

+11 -1
View File
@@ -5,10 +5,20 @@ import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
import { __clearLogoFallbackCacheForTests } from "@/hooks/useLogoFallback";
import { providerBrand } from "@/lib/provider-brand";
describe("model fallback notice logos", () => {
describe("model fallback notice", () => {
beforeEach(__clearLogoFallbackCacheForTests);
afterEach(cleanup);
it("centers the notice contents and labels its model-settings destination", () => {
const onOpenSettings = vi.fn();
render(<ModelFallbackNotice model="xai-grok/grok-4.5" reauthProvider="openai_codex"
reauthProviderLabel="OpenAI Codex" onDismiss={vi.fn()} onOpenSettings={onOpenSettings} />);
expect(screen.getByRole("status")).toHaveClass("items-center");
expect(screen.getByRole("status")).not.toHaveClass("items-start");
fireEvent.click(screen.getByRole("button", { name: "Open model settings" }));
expect(onOpenSettings).toHaveBeenCalledOnce();
});
it.each(["openai_codex", "xai_grok", "github_copilot"])("shows the rejected %s provider, not the backup", (provider) => {
render(<ModelFallbackNotice model="deepseek/deepseek-chat" reauthProvider={provider}
reauthProviderLabel={provider} onDismiss={vi.fn()} />);
+1 -1
View File
@@ -1246,7 +1246,7 @@ describe("ThreadShell", () => {
expect(title).toBeVisible();
expect(screen.getByText("A fallback model handled this response.")).toBeVisible();
expect(screen.queryByText(/This response used a fallback model/)).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Open sign-in settings" }));
fireEvent.click(screen.getByRole("button", { name: "Open model settings" }));
expect(openSettings).toHaveBeenCalledOnce();
fireEvent.click(within(title.closest('[role="status"]') as HTMLElement).getByRole("button", { name: "Dismiss" }));
emit("openai_codex");