From bafe9e820dce9e1200b65e30ff03f5ccd2208502 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 9 Apr 2026 15:16:35 +0800 Subject: [PATCH] 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. --- src/hooks/useProviderActions.ts | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/hooks/useProviderActions.ts b/src/hooks/useProviderActions.ts index 346de6e5b..85d125c34 100644 --- a/src/hooks/useProviderActions.ts +++ b/src/hooks/useProviderActions.ts @@ -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";