dsh-onebot-genji 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bridge.js CHANGED
@@ -14,7 +14,7 @@ import { realpath } from 'node:fs/promises';
14
14
  import { appendFileSync } from 'node:fs';
15
15
  import { homedir } from 'node:os';
16
16
  import { transcriptLabel } from './stt.js';
17
- import { buildChatId, classifyUserRole, splitChatId } from './chat.js';
17
+ import { buildChatId, classifyUserRole, formatClock, splitChatId } from './chat.js';
18
18
  import { buildPlatformPrompt } from './prompt.js';
19
19
  import { PromptLoader } from './prompt-setup.js';
20
20
  import { ChatTails, buildGreetingPrompt } from './chat-tails.js';
@@ -68,11 +68,9 @@ function stickerHintFor(config) {
68
68
  /** 群聊上下文环缓冲:每聊天保留最近 N 条(config.groupContextLines)未 @ 我的群消息,
69
69
  * 被 @ / 叫到唤醒词那一回合作为参考材料注入 prefixTurn。 */
70
70
  const GROUP_CONTEXT_CAP = 200;
71
- /** 群聊上下文行首的 HH:MM(本地时区,非数字时间戳回落当前时间)。 */
72
- function formatHhMm(ts) {
73
- const d = new Date(Number.isFinite(ts) ? ts : Date.now());
74
- return String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0');
75
- }
71
+ /** 群聊上下文行首的 HH:MM:直接复用 chat.ts 的 formatClock(entry.time 是
72
+ * OneBot event.time,Unix **秒**)。别再本地复制一份——T1 修过的「把秒当毫秒
73
+ * 用、时间显示成 1970 年」那个坑,2026-11-20 就在这里重犯过一次。 */
76
74
  /** T2-B2: how long a relayed ask_user_question batch stays interceptable —
77
75
  * after this the bridge stops treating plain replies as answers (the host's
78
76
  * continued-state question may still be answered from the Web card). */
@@ -785,7 +783,7 @@ export class ChatBridge {
785
783
  const body = String(entry.text ?? '').trim();
786
784
  if (body === '')
787
785
  return;
788
- list.push('[' + formatHhMm(entry.time) + '] ' + entry.nickname + '(' + entry.userId + '): ' + body);
786
+ list.push('[' + formatClock(entry.time) + '] ' + entry.nickname + '(' + entry.userId + '): ' + body);
789
787
  while (list.length > cap)
790
788
  list.shift();
791
789
  }