Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix:历史会话不显示时间问题

dourane9c4d47a6ef9
diff --git a/jiuwenclaw/web/src/components/CronPanel/index.tsx b/jiuwenclaw/web/src/components/CronPanel/index.tsx
index 5980b8482a..a6686fd6ea 100644
--- a/jiuwenclaw/web/src/components/CronPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/CronPanel/index.tsx
@@ -72,7 +72,7 @@ export default function CronPanel() {
{ value: 'web', label: '网页 (web)' },
{ value: 'feishu', label: '飞书 (feishu)' },
{ value: 'xiaoyi', label: '小艺 (xiaoyi)' },
- { value: 'dingding', label: '钉钉 (dingding)' }
+ { value: 'dingtalk', label: '钉钉 (dingtalk)' }
];
// 加载任务列表
diff --git a/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx b/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx
index 138222c900..0bd10b8e64 100644
--- a/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/HeartbeatPanel/index.tsx
@@ -339,7 +339,7 @@ export function HeartbeatPanel() {
<option value="web">网页 (web)</option>
<option value="xiaoyi">小艺 (xiaoyi)</option>
<option value="feishu">飞书 (feishu)</option>
- <option value="dingding">钉钉 (dingding)</option>
+ <option value="dingtalk">钉钉 (dingtalk)</option>
</select>
</label>
diff --git a/jiuwenclaw/web/src/components/SessionsPanel/index.tsx b/jiuwenclaw/web/src/components/SessionsPanel/index.tsx
index 0e86572c09..5475899d7c 100644
--- a/jiuwenclaw/web/src/components/SessionsPanel/index.tsx
+++ b/jiuwenclaw/web/src/components/SessionsPanel/index.tsx
@@ -41,19 +41,31 @@ function isPlausibleDate(date: Date): boolean {
function parseSessionDisplayLabel(sessionId: string): string {
if (!sessionId) return '未知会话-未知时间';
- if (sessionId.startsWith('sess_')) {
- const parts = sessionId.split('_');
- const hexTs = parts[1] ?? '';
- if (/^[0-9a-fA-F]+$/.test(hexTs)) {
- const ms = Number.parseInt(hexTs, 16);
- if (Number.isFinite(ms)) {
- const date = new Date(ms);
- if (!Number.isNaN(date.getTime()) && isPlausibleDate(date)) {
- return `会话-${formatDateTime(date)}`;
+ // 处理以 sess_、cron_、feishu_、xiaoyi_、dingtalk_ 开头的会话ID
+ const prefixes = ['sess_', 'cron_', 'feishu_', 'xiaoyi_', 'dingtalk_'];
+ const prefixMap: Record<string, string> = {
+ 'sess_': '会话',
+ 'cron_': '定时',
+ 'feishu_': '飞书',
+ 'xiaoyi_': '小艺',
+ 'dingtalk_': '钉钉'
+ };
+
+ for (const prefix of prefixes) {
+ if (sessionId.startsWith(prefix)) {
+ const parts = sessionId.split('_');
+ const hexTs = parts[1] ?? '';
+ if (/^[0-9a-fA-F]+$/.test(hexTs)) {
+ const ms = Number.parseInt(hexTs, 16);
+ if (Number.isFinite(ms)) {
+ const date = new Date(ms);
+ if (!Number.isNaN(date.getTime()) && isPlausibleDate(date)) {
+ return `${prefixMap[prefix]}-${formatDateTime(date)}`;
+ }
}
}
+ return `${prefixMap[prefix]}-未知时间`;
}
- return '会话-未知时间';
}
if (sessionId.startsWith('heartbeat_')) {
@@ -61,6 +73,18 @@ function parseSessionDisplayLabel(sessionId: string): string {
return rawBody ? `心跳-${rawBody}` : '心跳';
}
+ // 解析会话ID中可能包含的时间戳格式,如 YYYYMMDD_HHMMSS_xxxx
+ const timestampRegex = /(\d{4})(\d{2})(\d{2})_(\d{2})(\d{2})(\d{2})/;
+ const match = sessionId.match(timestampRegex);
+ if (match) {
+ const [, year, month, day, hours, minutes, seconds] = match;
+ const date = new Date(`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`);
+ if (!Number.isNaN(date.getTime()) && isPlausibleDate(date)) {
+ const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : '未知';
+ return `${prefix}-${formatDateTime(date)}`;
+ }
+ }
+
const prefix = sessionId.includes('_') ? sessionId.split('_')[0] : '未知';
return `${prefix}-未知时间`;
}