Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bots): 例行任务保存后给出成功反馈
Leng Jingxuf0d39542da7a
diff --git a/apps/desktop/src/renderer/features/bots/BotRoutines.tsx b/apps/desktop/src/renderer/features/bots/BotRoutines.tsxindex 32091cfcb7..40480e49cf 100644--- a/apps/desktop/src/renderer/features/bots/BotRoutines.tsx+++ b/apps/desktop/src/renderer/features/bots/BotRoutines.tsx@@ -22,6 +22,7 @@ import { Switch } from '@/components/ui/switch';import { useConfirmDialog } from '@/components/ui/confirm-dialog-provider';import { Spinner } from '@/components/ui/spinner';import { useBotSettingsTarget } from './useBotSettingsTarget';+import { toast } from '@/lib/toast';import {DropdownMenu,DropdownMenuTrigger,@@ -598,6 +599,7 @@ export function BotRoutines({);setSelected(saved.id);setDraft(saved);+ toast.success(t('routines.saved'));});}}>diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botRoutines.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/botRoutines.test.tsxindex e6008bfae0..830fa2331b 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botRoutines.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/botRoutines.test.tsx@@ -11,10 +11,13 @@ vi.mock('react-i18next', () => ({}));const { confirm } = vi.hoisted(() => ({ confirm: vi.fn(async () => true) }));vi.mock('@/components/ui/confirm-dialog-provider', () => ({ useConfirmDialog: () => ({ confirm }) }));+const { toastSuccess } = vi.hoisted(() => ({ toastSuccess: vi.fn() }));+vi.mock('@/lib/toast', () => ({ toast: { success: toastSuccess, error: vi.fn(), info: vi.fn(), warning: vi.fn() } }));import { BotRoutines } from '../BotRoutines';afterEach(() => {cleanup();vi.unstubAllGlobals();+ toastSuccess.mockClear();});it('saves the visible edited instructions before running, and preserves every trigger', async () => {const routine: Routine = {@@ -134,6 +137,7 @@ it('saves enabled state and does not run a routine just by saving', async () =>fireEvent.click(screen.getByRole('switch', { name: 'routines.enabled' }));fireEvent.click(screen.getByRole('button', { name: 'routines.save' }));await waitFor(() => expect(api.save).toHaveBeenCalledWith('bot', expect.objectContaining({ enabled: false }), 'daily'));+ expect(toastSuccess).toHaveBeenCalledWith('routines.saved');expect(api.runNow).not.toHaveBeenCalled();await waitFor(() => expect((screen.getByRole('button', { name: 'routines.back' }) as HTMLButtonElement).disabled).toBe(false));fireEvent.click(screen.getByRole('button', { name: 'routines.back' }));diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex 46e29467ea..e489ab0fd5 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -16371,6 +16371,7 @@"timezone": "Time Zone","delete": "Delete Routine","save": "Save Routine",+ "saved": "Routine saved","deleteConfirm": "Delete this routine and cancel its pending runs?","keep": "Keep Routine","openTask": "Open Session",diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 33a1a4a002..dff7d46899 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -16315,6 +16315,7 @@"timezone": "タイムゾーン","delete": "ルーティンを削除","save": "ルーティンを保存",+ "saved": "ルーティンを保存しました","deleteConfirm": "このルーティンを削除し、待機中の実行をキャンセルしますか?","keep": "ルーティンを残す","openTask": "セッションを開く",diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex d79b3ed3d2..59179d1045 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -16315,6 +16315,7 @@"timezone": "시간대","delete": "루틴 삭제","save": "루틴 저장",+ "saved": "루틴을 저장했습니다","deleteConfirm": "이 루틴을 삭제하고 대기 중인 실행을 취소할까요?","keep": "루틴 유지","openTask": "세션 열기",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 88fd2309e8..b71f2f0139 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -16315,6 +16315,7 @@"timezone": "时区","delete": "删除例行任务","save": "保存例行任务",+ "saved": "例行任务已保存","deleteConfirm": "删除这条例行任务,并取消等待中的运行?","keep": "保留例行任务","openTask": "查看任务",diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 2d119bbbea..5ea40830a9 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -16315,6 +16315,7 @@"timezone": "時區","delete": "刪除例行任務","save": "儲存例行任務",+ "saved": "例行任務已儲存","deleteConfirm": "刪除這條例行任務,並取消等待中的執行?","keep": "保留例行任務","openTask": "查看任務",