mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-14 02:37:29 +08:00
daily summary ui/api: add task daily summary endpoint and dashboard card in task audit
This commit is contained in:
@@ -31,6 +31,8 @@ const resources = {
|
||||
createTask: 'Create',
|
||||
updateTask: 'Update',
|
||||
deleteTask: 'Delete',
|
||||
dailySummary: 'Daily Summary',
|
||||
noDailySummary: 'No autonomy daily summary yet.',
|
||||
error: 'Error',
|
||||
noTaskAudit: 'No task audit records',
|
||||
selectTask: 'Select a task from the left list',
|
||||
@@ -196,6 +198,8 @@ const resources = {
|
||||
createTask: '新建',
|
||||
updateTask: '更新',
|
||||
deleteTask: '删除',
|
||||
dailySummary: '日报摘要',
|
||||
noDailySummary: '暂无自治日报。',
|
||||
error: '错误',
|
||||
noTaskAudit: '暂无任务审计记录',
|
||||
selectTask: '请从左侧选择任务',
|
||||
|
||||
@@ -33,6 +33,7 @@ const TaskAudit: React.FC = () => {
|
||||
const [sourceFilter, setSourceFilter] = useState('all');
|
||||
const [statusFilter, setStatusFilter] = useState('all');
|
||||
const [draft, setDraft] = useState<any>({ id: '', content: '', priority: 'normal', status: 'todo', source: 'manual', due_at: '' });
|
||||
const [dailyReport, setDailyReport] = useState<string>('');
|
||||
|
||||
const fetchData = async () => {
|
||||
setLoading(true);
|
||||
@@ -45,6 +46,13 @@ const TaskAudit: React.FC = () => {
|
||||
const sorted = arr.sort((a: any, b: any) => String(b.time || '').localeCompare(String(a.time || '')));
|
||||
setItems(sorted);
|
||||
if (sorted.length > 0) setSelected(sorted[0]);
|
||||
const dr = await fetch(`/webui/api/task_daily_summary${q}`);
|
||||
if (dr.ok) {
|
||||
const dj = await dr.json();
|
||||
setDailyReport(String(dj.report || ''));
|
||||
} else {
|
||||
setDailyReport('');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
setItems([]);
|
||||
@@ -116,6 +124,11 @@ const TaskAudit: React.FC = () => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="border border-zinc-800 rounded-xl bg-zinc-900/40 p-3 text-sm">
|
||||
<div className="text-xs text-zinc-400 uppercase tracking-wider mb-2">{t('dailySummary')}</div>
|
||||
<div className="whitespace-pre-wrap text-zinc-200">{dailyReport || t('noDailySummary')}</div>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 min-h-0 grid grid-cols-1 lg:grid-cols-[360px_1fr] gap-4">
|
||||
<div className="border border-zinc-800 rounded-xl bg-zinc-900/40 overflow-hidden flex flex-col min-h-0">
|
||||
<div className="px-3 py-2 border-b border-zinc-800 text-xs text-zinc-400 uppercase tracking-wider">{t('taskQueue')}</div>
|
||||
|
||||
Reference in New Issue
Block a user