feat(claude): show proxy hint when switching to OpenAI Chat format provider

Display an info toast when switching to a provider that uses OpenAI Chat
format (apiFormat === "openai_chat"), reminding users to enable the proxy
service. Move toast logic from mutation to useProviderActions for better
control over notification content based on provider properties.
This commit is contained in:
Jason
2026-01-30 16:33:49 +08:00
parent 1ed122a8bd
commit 57713dd336
5 changed files with 42 additions and 16 deletions
+2 -11
View File
@@ -171,17 +171,8 @@ export const useSwitchProviderMutation = (appId: AppId) => {
);
}
// OpenCode: show "added to config" message instead of "switched"
const messageKey =
appId === "opencode"
? "notifications.addToConfigSuccess"
: "notifications.switchSuccess";
const defaultMessage =
appId === "opencode" ? "已添加到配置" : "切换供应商成功";
toast.success(t(messageKey, { defaultValue: defaultMessage }), {
closeButton: true,
});
// Note: Success toast is handled by useProviderActions.switchProvider
// to allow customization based on provider properties (e.g., apiFormat)
},
onError: (error: Error) => {
const detail = extractErrorMessage(error) || t("common.unknown");