From a05f11ba10e48ec99e1df204d3b1e60b15858809 Mon Sep 17 00:00:00 2001
From: Xubin Ren <52506698+Re-bin@users.noreply.github.com>
Date: Sun, 20 Sep 2026 15:51:08 +0800
Subject: [PATCH] fix(webui): notify chats when a fallback model responds
---
docs/providers.md | 3 +
.../components/thread/ModelFallbackNotice.tsx | 44 +++++++++++++
webui/src/components/thread/ThreadShell.tsx | 32 ++++++++++
webui/src/i18n/locales/en/common.json | 2 +
webui/src/i18n/locales/es/common.json | 2 +
webui/src/i18n/locales/fr/common.json | 2 +
webui/src/i18n/locales/id/common.json | 2 +
webui/src/i18n/locales/ja/common.json | 2 +
webui/src/i18n/locales/ko/common.json | 2 +
webui/src/i18n/locales/pt-BR/common.json | 2 +
webui/src/i18n/locales/vi/common.json | 2 +
webui/src/i18n/locales/zh-CN/common.json | 2 +
webui/src/i18n/locales/zh-TW/common.json | 2 +
webui/src/tests/i18n-chat-resources.test.ts | 1 +
webui/src/tests/thread-shell.test.tsx | 61 +++++++++++++++++++
15 files changed, 161 insertions(+)
create mode 100644 webui/src/components/thread/ModelFallbackNotice.tsx
diff --git a/docs/providers.md b/docs/providers.md
index 83da39e93..de2415635 100644
--- a/docs/providers.md
+++ b/docs/providers.md
@@ -12,6 +12,9 @@ cache. Network, rate-limit, and service failures instead ask you to try again
later (failed refreshes are cached briefly). Existing presets and manual model
IDs remain available. A successful chat may have used a fallback preset and
does not prove that the selected provider's authorization is still valid.
+When a live chat uses a fallback model, a dismissible notice above the composer
+names that model and links to model settings. It does not change your selected
+preset or assume that every fallback means the login expired.
For every setup, answer three questions:
diff --git a/webui/src/components/thread/ModelFallbackNotice.tsx b/webui/src/components/thread/ModelFallbackNotice.tsx
new file mode 100644
index 000000000..c8bd92291
--- /dev/null
+++ b/webui/src/components/thread/ModelFallbackNotice.tsx
@@ -0,0 +1,44 @@
+import { ArrowRightLeft, X } from "lucide-react";
+import { useTranslation } from "react-i18next";
+
+import { Button } from "@/components/ui/button";
+
+/** A live fallback is informative, not a failed message or a changed preset. */
+export function ModelFallbackNotice({ model, onDismiss, onOpenSettings }: {
+ model: string;
+ onDismiss: () => void;
+ onOpenSettings?: () => void;
+}) {
+ const { t } = useTranslation();
+ return (
+