auto-sync: 2026-05-20 22:40:27
This commit is contained in:
@@ -66,15 +66,18 @@ export default function NotificationCenter({ onClose }: { onClose: () => void })
|
||||
'agent_completed', 'agent_spawned',
|
||||
];
|
||||
if (importantTypes.includes(e.type || data.event_type)) {
|
||||
setSseEvents(prev => [{
|
||||
id: data.id || `sse-${Date.now()}`,
|
||||
type: (e.type === 'task_failed' ? 'error' : e.type === 'task_completed' ? 'success' : 'info') as NotifItem['type'],
|
||||
title: data.title || data.event_type || e.type,
|
||||
message: data.detail || JSON.stringify(data).slice(0, 100),
|
||||
time: data.timestamp || new Date().toISOString(),
|
||||
read: false,
|
||||
source: 'event' as const,
|
||||
}, ...prev].slice(0, 20)]);
|
||||
setSseEvents(prev => {
|
||||
const item: NotifItem = {
|
||||
id: data.id || `sse-${Date.now()}`,
|
||||
type: e.type === 'task_failed' ? 'error' : e.type === 'task_completed' ? 'success' : 'info',
|
||||
title: data.title || data.event_type || e.type || 'Event',
|
||||
message: data.detail || JSON.stringify(data).slice(0, 100),
|
||||
time: data.timestamp || new Date().toISOString(),
|
||||
read: false,
|
||||
source: 'event',
|
||||
};
|
||||
return [item, ...prev].slice(0, 20);
|
||||
});
|
||||
}
|
||||
} catch { /* ignore parse errors */ }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user