🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(task): add start-scheduling button in automation popover (#14323)
Arvin Xuf59954137aaf
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.jsonindex d00bb5d164a..c8be2343fbb 100644--- a/locales/en-US/chat.json+++ b/locales/en-US/chat.json@@ -599,6 +599,7 @@"taskSchedule.scheduleType.weekly": "Weekly","taskSchedule.scheduler": "Scheduler","taskSchedule.schedulerTab": "Scheduled",+ "taskSchedule.startScheduling": "Start scheduling","taskSchedule.summary.daily": "Daily at {{time}}","taskSchedule.summary.disabled": "Automation is off","taskSchedule.summary.everyNHours": "Every {{count}} hours{{minute}}",diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.jsonindex a43a33401fe..f3b6f9d7d1f 100644--- a/locales/zh-CN/chat.json+++ b/locales/zh-CN/chat.json@@ -599,6 +599,7 @@"taskSchedule.scheduleType.weekly": "每周","taskSchedule.scheduler": "定时任务","taskSchedule.schedulerTab": "定时任务",+ "taskSchedule.startScheduling": "启动定时","taskSchedule.summary.daily": "每天 {{time}} 运行","taskSchedule.summary.disabled": "自动化未启用","taskSchedule.summary.everyNHours": "每 {{count}} 小时{{minute}}",diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsxindex dfbb1b5b004..5dc928631ab 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskScheduleConfig.tsx@@ -2,6 +2,7 @@ import type { TaskAutomationMode } from '@lobechat/types';import {ActionIcon,Avatar,+ Button,Flexbox,Icon,InputNumber,@@ -13,7 +14,7 @@ import {import { Switch } from 'antd';import { createStaticStyles, cssVar } from 'antd-style';import dayjs from 'dayjs';-import { CalendarDays, Clock, RefreshCw, TimerIcon, Zap } from 'lucide-react';+import { CalendarClockIcon, CalendarDays, Clock, RefreshCw, TimerIcon, Zap } from 'lucide-react';import type { ReactNode } from 'react';import { memo, useCallback, useEffect, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -189,6 +190,8 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({const activeTaskInterval = useTaskStore(taskDetailSelectors.activeTaskPeriodicInterval);const automationMode = useTaskStore(taskDetailSelectors.activeTaskAutomationMode);const setAutomationMode = useTaskStore((s) => s.setAutomationMode);+ const updateTaskStatus = useTaskStore((s) => s.updateTaskStatus);+ const status = useTaskStore(taskDetailSelectors.activeTaskStatus);const detail = useTaskStore(taskDetailSelectors.activeTaskDetail);const schedulePattern = useTaskStore(taskDetailSelectors.activeTaskSchedulePattern);const scheduleTimezone = useTaskStore(taskDetailSelectors.activeTaskScheduleTimezone);@@ -197,6 +200,15 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({const finalCurrentInterval = currentInterval ?? activeTaskInterval;const enabled = !!automationMode;+ const [isStartingSchedule, setIsStartingSchedule] = useState(false);+ // Heartbeat tasks are re-armed only by maybeRearmHeartbeat after a topic+ // completes; there is no dispatcher that picks up `scheduled` heartbeat tasks,+ // so flipping one to `scheduled` from here would leave it dormant.+ const canStartSchedule =+ automationMode === 'schedule' &&+ !!finalTaskId &&+ status !== 'scheduled' &&+ status !== 'running';const summary = useMemo<{ primary: string; secondary?: string } | null>(() => {if (automationMode === 'heartbeat' && finalCurrentInterval > 0) {@@ -266,6 +278,16 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({[finalTaskId, setAutomationMode],);+ const handleStartScheduling = useCallback(async () => {+ if (!finalTaskId) return;+ setIsStartingSchedule(true);+ try {+ await updateTaskStatus(finalTaskId, 'scheduled');+ } finally {+ setIsStartingSchedule(false);+ }+ }, [finalTaskId, updateTaskStatus]);+const content = (<Flexbox gap={16} style={{ padding: 4, width: 440 }} onClick={(e) => e.stopPropagation()}><Flexbox horizontal align="center" gap={12}>@@ -330,6 +352,17 @@ const TaskScheduleConfig = memo(function TaskScheduleConfig({<IntervalTab currentInterval={finalCurrentInterval} taskId={finalTaskId} />)}{automationMode === 'schedule' && <SchedulerTab taskId={finalTaskId} />}+ {canStartSchedule && (+ <Button+ block+ icon={CalendarClockIcon}+ loading={isStartingSchedule}+ type="primary"+ onClick={handleStartScheduling}+ >+ {t('taskSchedule.startScheduling')}+ </Button>+ )}</>)}</Flexbox>diff --git a/src/locales/default/chat.ts b/src/locales/default/chat.tsindex 5f02b6006d7..fdd94a4687a 100644--- a/src/locales/default/chat.ts+++ b/src/locales/default/chat.ts@@ -528,6 +528,7 @@ export default {'taskSchedule.scheduleType.weekly': 'Weekly','taskSchedule.scheduler': 'Scheduler','taskSchedule.schedulerTab': 'Scheduled',+ 'taskSchedule.startScheduling': 'Start scheduling','taskSchedule.summary.daily': 'Daily at {{time}}','taskSchedule.summary.disabled': 'Automation is off','taskSchedule.summary.everyNHours': 'Every {{count}} hours{{minute}}',