@zaofan/dsh-qqbot 1.5.31 → 1.6.0

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/settings-host.js CHANGED
@@ -433,7 +433,8 @@ export function apply(ctx) {
433
433
  if (!key) return writeJson(res, 400, { error: 'sessionKey required' });
434
434
  const mod = await loadContextlessStore(); // 先 init 到同一个 dataRoot,避免两份模块实例各写一个文件
435
435
  if (body.remove === true) { mod.clearContextless(key); return writeJson(res, 200, { ok: true, removed: true }); }
436
- const next = mod.setContextless(key, { enabled: body.enabled, window: body.window });
436
+ // 2026-10-01: smart = 无上下文模式·智能判断(与 window 互斥,面板单选取值)
437
+ const next = mod.setContextless(key, { enabled: body.enabled, window: body.window, smart: body.smart });
437
438
  return writeJson(res, 200, { ok: true, value: next });
438
439
  } catch (e) {
439
440
  return writeJson(res, 500, { error: String((e && e.message) || e) });
@@ -3260,11 +3261,11 @@ export function apply(ctx) {
3260
3261
  for (const line of String(body || '').split('\n')) {
3261
3262
  const s = line.trim();
3262
3263
  if (!s) continue;
3263
- // ⚠️ 2026-10-01 修(主人实测:"当前消息引用的消息显示给上一个人了"):
3264
- // `[当前]` 是**分段点** —— 它之前属于历史(该收尾结算),之后的"引用块 + 正文"才是当前消息。
3265
- // 原来这里直接 continue 不 flush,导致当前消息的 `[引]…[/引]` 被并进**上一条历史消息**里
3266
- // (于是界面上引用块挂在别人气泡上)。
3267
- if (RE_CURRENT_LINE.test(s)) { flush(); continue; }
3264
+ // ⚠️ 2026-10-01 修(主人实测:"当前消息引用的消息显示给上一个人了"):
3265
+ // `[当前]` 是**分段点** —— 它之前属于历史(该收尾结算),之后的"引用块 + 正文"才是当前消息。
3266
+ // 原来这里直接 continue 不 flush,导致当前消息的 `[引]…[/引]` 被并进**上一条历史消息**里
3267
+ // (于是界面上引用块挂在别人气泡上)。
3268
+ if (RE_CURRENT_LINE.test(s)) { flush(); continue; }
3268
3269
  if (RE_HIST_BEGIN_LINE.test(s) || RE_HIST_END_LINE.test(s) || isTimeHeadLine(s)) continue;
3269
3270
  if (/^\[系统提示\]/.test(s)) { flush(); return out; } // 系统注入段, 之后都不属于群聊内容
3270
3271
  // 媒体元数据行: 暂存, 等归属给下面那条带昵称的消息
@@ -3278,17 +3279,17 @@ export function apply(ctx) {
3278
3279
  // 要当普通行并入当前段(真昵称在后面几行,交给 chatPolishOne 去找)。
3279
3280
  // 与 chatPolishOne 的 RE_MARKER_WORD 同款防御,此处之前漏了。
3280
3281
  const isNick = m && m[1].trim() && !RE_MARKER_WORD.test(m[1].trim());
3281
- if (isNick) {
3282
- // ⚠️ 2026-10-01:当前消息的引用块会先形成一个 sender 为空的段 —— 紧随的 [昵称] 行要**接管**它
3283
- // (引用块 + 正文同属一条消息),否则引用块会独立成一个没有名字的气泡。
3284
- if (cur && !cur.sender) {
3285
- cur.sender = m[1].trim();
3286
- cur.lines.push(...[m[2].trim(), ...pendingMeta].filter(Boolean));
3287
- } else {
3288
- flush();
3289
- cur = { sender: m[1].trim(), lines: [m[2].trim(), ...pendingMeta].filter(Boolean) };
3290
- }
3291
- pendingMeta = [];
3282
+ if (isNick) {
3283
+ // ⚠️ 2026-10-01:当前消息的引用块会先形成一个 sender 为空的段 —— 紧随的 [昵称] 行要**接管**它
3284
+ // (引用块 + 正文同属一条消息),否则引用块会独立成一个没有名字的气泡。
3285
+ if (cur && !cur.sender) {
3286
+ cur.sender = m[1].trim();
3287
+ cur.lines.push(...[m[2].trim(), ...pendingMeta].filter(Boolean));
3288
+ } else {
3289
+ flush();
3290
+ cur = { sender: m[1].trim(), lines: [m[2].trim(), ...pendingMeta].filter(Boolean) };
3291
+ }
3292
+ pendingMeta = [];
3292
3293
  }
3293
3294
  else { if (cur) cur.lines.push(...pendingMeta, s); else { flush(); cur = { sender: '', lines: [...pendingMeta, s] }; } pendingMeta = []; }
3294
3295
  }