mirror of
https://mirror.skon.top/github.com/cft0808/edict
synced 2026-04-20 21:00:16 +08:00
fix: normalize timestamps in SessionsPanel and server lastActive (#278 cherry-pick)
Cherry-pick the SessionsPanel.tsx and server.py fixes from PR #278 that were not covered by the merged #282: - SessionsPanel: use shared formatDashboardTime for activity timestamps - server.py: convert lastActive to local timezone in get_task_activity()
This commit is contained in:
@@ -1978,13 +1978,24 @@ def get_task_activity(task_id):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
last_active = None
|
||||
if updated_at:
|
||||
try:
|
||||
dt = _parse_iso(updated_at)
|
||||
if dt:
|
||||
last_active = dt.astimezone().strftime('%Y-%m-%d %H:%M:%S')
|
||||
else:
|
||||
last_active = updated_at[:19].replace('T', ' ')
|
||||
except Exception:
|
||||
last_active = updated_at[:19].replace('T', ' ')
|
||||
|
||||
result = {
|
||||
'ok': True,
|
||||
'taskId': task_id,
|
||||
'taskMeta': task_meta,
|
||||
'agentId': agent_id,
|
||||
'agentLabel': _STATE_LABELS.get(state, state),
|
||||
'lastActive': updated_at[:19].replace('T', ' ') if updated_at else None,
|
||||
'lastActive': last_active,
|
||||
'activity': activity,
|
||||
'activitySource': 'progress+session',
|
||||
'relatedAgents': sorted(list(related_agents)),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useStore, isEdict, STATE_LABEL, timeAgo } from '../store';
|
||||
import type { Task } from '../api';
|
||||
import { useState } from 'react';
|
||||
import { formatDashboardTime } from '../time';
|
||||
|
||||
// Agent maps built from agentConfig
|
||||
function useAgentMaps() {
|
||||
@@ -231,7 +232,7 @@ function SessionDetailModal({
|
||||
const kLabel = kind === 'assistant' ? '回复' : kind === 'tool' ? '工具' : kind === 'user' ? '用户' : '事件';
|
||||
let txt = (a.text || '').replace(/\[\[.*?\]\]/g, '').replace(/\*\*/g, '').trim();
|
||||
if (txt.length > 200) txt = txt.substring(0, 200) + '…';
|
||||
const time = ((a.at as string) || '').substring(11, 19);
|
||||
const time = formatDashboardTime(a.at as string | number | undefined, { showSeconds: true });
|
||||
return (
|
||||
<div key={i} style={{ padding: '8px 12px', borderBottom: '1px solid var(--line)', fontSize: 12, lineHeight: 1.5 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 3 }}>
|
||||
|
||||
Reference in New Issue
Block a user