fix(notifications): remove duplicate toast when switching to proxy providers

When switching to Copilot/ChatGPT/OpenAI-format providers with the proxy
not running, two toasts appeared: a "proxy required" warning followed by
a "switch success" toast. Unify the post-switch toast logic so that all
provider types show a single success toast, and skip it entirely when
a proxy-required warning was already shown.
This commit is contained in:
Jason
2026-04-09 15:16:35 +08:00
parent 8669879ad0
commit bafe9e820d
+2 -21
View File
@@ -200,27 +200,8 @@ export function useProviderActions(activeApp: AppId, isProxyRunning?: boolean) {
);
}
// 根据供应商类型显示不同的成功提示
if (
!proxyRequiredReason &&
activeApp === "claude" &&
provider.category !== "official" &&
(isCopilotProvider ||
provider.meta?.apiFormat === "openai_chat" ||
provider.meta?.apiFormat === "openai_responses")
) {
// OpenAI format provider: show proxy hint (skip if warning already shown)
toast.info(
isCopilotProvider
? t("notifications.copilotProxyHint")
: t("notifications.openAIFormatHint"),
{
duration: 5000,
closeButton: true,
},
);
} else {
// 普通供应商:显示切换成功
// 若已弹过 proxyRequired 警告则不再弹 success
if (!proxyRequiredReason) {
// OpenCode/OpenClaw: show "added to config" message instead of "switched"
const isMultiProviderApp =
activeApp === "opencode" || activeApp === "openclaw";