diff --git a/src/components/providers/AddProviderDialog.tsx b/src/components/providers/AddProviderDialog.tsx index b1eef9bd8..179f71cd2 100644 --- a/src/components/providers/AddProviderDialog.tsx +++ b/src/components/providers/AddProviderDialog.tsx @@ -60,14 +60,6 @@ export function AddProviderDialog({ async (provider: UniversalProvider) => { try { await universalProvidersApi.upsert(provider); - toast.success( - t("universalProvider.addSuccess", { - defaultValue: "统一供应商添加成功", - }), - ); - setUniversalFormOpen(false); - setSelectedUniversalPreset(null); - onOpenChange(false); } catch (error) { console.error( "[AddProviderDialog] Failed to save universal provider", @@ -78,7 +70,31 @@ export function AddProviderDialog({ defaultValue: "统一供应商添加失败", }), ); + return; } + + try { + await universalProvidersApi.sync(provider.id); + toast.success( + t("universalProvider.addedAndSynced", { + defaultValue: "统一供应商已添加并同步", + }), + ); + } catch (error) { + console.error( + "[AddProviderDialog] Provider saved but sync failed", + error, + ); + toast.warning( + t("universalProvider.addedButSyncFailed", { + defaultValue: "统一供应商已添加,但同步失败", + }), + ); + } + + setUniversalFormOpen(false); + setSelectedUniversalPreset(null); + onOpenChange(false); }, [t, onOpenChange], ); diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index fcad23b3f..f6d011efd 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -2688,9 +2688,9 @@ "noAppsEnabled": "No apps enabled", "added": "Universal provider added", "addedAndSynced": "Universal provider added and synced", + "addedButSyncFailed": "Universal provider added, but sync failed", "updated": "Universal provider updated", "deleted": "Universal provider deleted", - "addSuccess": "Universal provider added successfully", "addFailed": "Failed to add universal provider", "hint": "Cross-app unified config, auto-sync to Claude/Codex/Gemini", "manage": "Manage", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index 46c3b51fc..cee1c1f85 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -2688,9 +2688,9 @@ "noAppsEnabled": "有効なアプリがありません", "added": "統合プロバイダーを追加しました", "addedAndSynced": "統合プロバイダーを追加して同期しました", + "addedButSyncFailed": "統合プロバイダーを追加しましたが、同期に失敗しました", "updated": "統合プロバイダーを更新しました", "deleted": "統合プロバイダーを削除しました", - "addSuccess": "統合プロバイダーを追加しました", "addFailed": "統合プロバイダーの追加に失敗しました", "hint": "クロスアプリ統合設定。Claude/Codex/Gemini に自動同期します", "manage": "管理", diff --git a/src/i18n/locales/zh-TW.json b/src/i18n/locales/zh-TW.json index feaddbbb0..db85f5027 100644 --- a/src/i18n/locales/zh-TW.json +++ b/src/i18n/locales/zh-TW.json @@ -2660,9 +2660,9 @@ "noAppsEnabled": "未啟用任何應用程式", "added": "通用供應商已新增", "addedAndSynced": "通用供應商已新增並同步", + "addedButSyncFailed": "通用供應商已新增,但同步失敗", "updated": "通用供應商已更新", "deleted": "通用供應商已刪除", - "addSuccess": "通用供應商新增成功", "addFailed": "通用供應商新增失敗", "hint": "跨應用程式通用設定,自動同步至 Claude/Codex/Gemini", "manage": "管理", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index c58366488..7e254de70 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -2688,9 +2688,9 @@ "noAppsEnabled": "未启用任何应用", "added": "统一供应商已添加", "addedAndSynced": "统一供应商已添加并同步", + "addedButSyncFailed": "统一供应商已添加,但同步失败", "updated": "统一供应商已更新", "deleted": "统一供应商已删除", - "addSuccess": "统一供应商添加成功", "addFailed": "统一供应商添加失败", "hint": "跨应用统一配置,自动同步到 Claude/Codex/Gemini", "manage": "管理",