dsh-qqbot-muu 0.1.6 → 0.1.8

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +19 -1
  3. package/client/qqbot-settings.js +253 -21
  4. package/dist/channel-tools.js +1 -1
  5. package/dist/commands/exit.js +50 -23
  6. package/dist/features/catchup.js +194 -0
  7. package/dist/features/firstrun.js +1 -1
  8. package/dist/features/local-embed.js +58 -2
  9. package/dist/features/msg-history.js +6 -2
  10. package/dist/features/schedule-events.js +153 -0
  11. package/dist/features/schedule-guard.js +106 -0
  12. package/dist/features/schedule-store.js +604 -266
  13. package/dist/gateway/bootstrap.js +195 -6
  14. package/dist/transport/tool-presenter.js +32 -1
  15. package/docs/README.md +24 -0
  16. package/docs/RELEASE_CHECKLIST.md +75 -0
  17. package/dshqqbot/.qqbot-extensions/commands/session-list.mjs +3 -3
  18. package/dshqqbot/.qqbot-extensions/hooks/bili-scheduler.mjs +32 -1
  19. package/dshqqbot/.qqbot-extensions/hooks/comment-watch.mjs +10 -2
  20. package/dshqqbot/.qqbot-extensions/hooks/interview-panel.mjs +1 -1
  21. package/dshqqbot/.qqbot-extensions/hooks/overlay-check.mjs +33 -2
  22. package/dshqqbot/.qqbot-extensions/hooks/pet-gate-agent.mjs +33 -2
  23. package/dshqqbot/.qqbot-extensions/inbound/aa-memory-recall.mjs +38 -3
  24. package/dshqqbot/.qqbot-extensions/inbound/az-bili-note.mjs +10 -4
  25. package/dshqqbot/.qqbot-extensions/inbound/az-bili-remember.mjs +32 -1
  26. package/dshqqbot/.qqbot-extensions/inbound/az-feedback.mjs +34 -3
  27. package/dshqqbot/.qqbot-extensions/inbound/no-wake-on-child-quote.mjs +1 -1
  28. package/dshqqbot/.qqbot-extensions/inbound/router-observe.mjs +32 -1
  29. package/dshqqbot/.qqbot-extensions/interview/keepalive.bat +16 -16
  30. package/dshqqbot/.qqbot-extensions/interview/page.html +1 -1
  31. package/dshqqbot/.qqbot-extensions/interview/start-interview.mjs +151 -151
  32. package/dshqqbot/.qqbot-extensions/lib/atomic-write.mjs +81 -2
  33. package/dshqqbot/.qqbot-extensions/lib/bili-ops.mjs +39 -8
  34. package/dshqqbot/.qqbot-extensions/lib/channel-store.mjs +59 -0
  35. package/dshqqbot/.qqbot-extensions/lib/chatlog-db.mjs +56 -9
  36. package/dshqqbot/.qqbot-extensions/lib/comment-watch.mjs +62 -7
  37. package/dshqqbot/.qqbot-extensions/lib/draw-core.mjs +35 -4
  38. package/dshqqbot/.qqbot-extensions/lib/embedder.mjs +6 -3
  39. package/dshqqbot/.qqbot-extensions/lib/local-llm.mjs +32 -1
  40. package/dshqqbot/.qqbot-extensions/lib/memory-agent.mjs +21 -1
  41. package/dshqqbot/.qqbot-extensions/lib/memory-core.mjs +3 -0
  42. package/dshqqbot/.qqbot-extensions/lib/memory-db.mjs +32 -1
  43. package/dshqqbot/.qqbot-extensions/lib/memory-panel-core.mjs +32 -1
  44. package/dshqqbot/.qqbot-extensions/lib/person-link.mjs +306 -0
  45. package/dshqqbot/.qqbot-extensions/lib/platforms/douyin.mjs +90 -0
  46. package/dshqqbot/.qqbot-extensions/lib/private-guard.mjs +69 -0
  47. package/dshqqbot/.qqbot-extensions/lib/safe-fs.mjs +276 -0
  48. package/dshqqbot/.qqbot-extensions/lib/script-writer.mjs +32 -1
  49. package/dshqqbot/.qqbot-extensions/lib/stable-first.mjs +63 -0
  50. package/dshqqbot/.qqbot-extensions/lib/tts-core.mjs +44 -6
  51. package/dshqqbot/.qqbot-extensions/lib/tts-polish.mjs +32 -1
  52. package/dshqqbot/.qqbot-extensions/live/persona.mjs +10 -4
  53. package/dshqqbot/.qqbot-extensions/live/test/connect-smoke.mjs +1 -1
  54. package/dshqqbot/.qqbot-extensions/outbound/outbox.mjs +32 -1
  55. package/dshqqbot/.qqbot-extensions/outbound/split-reply.mjs +32 -1
  56. package/dshqqbot/.qqbot-extensions/outbound/zz-video-card.mjs +34 -3
  57. package/dshqqbot/.qqbot-extensions/tools/accounts.mjs +68 -5
  58. package/dshqqbot/.qqbot-extensions/tools/bili.mjs +33 -2
  59. package/dshqqbot/.qqbot-extensions/tools/diary.mjs +32 -1
  60. package/dshqqbot/.qqbot-extensions/tools/draw.mjs +32 -1
  61. package/dshqqbot/.qqbot-extensions/tools/learn_style.mjs +32 -1
  62. package/dshqqbot/.qqbot-extensions/tools/lib/game-lib.mjs +32 -1
  63. package/dshqqbot/.qqbot-extensions/tools/lib/session_watch_lib.mjs +1 -1
  64. package/dshqqbot/.qqbot-extensions/tools/memory.mjs +32 -1
  65. package/dshqqbot/.qqbot-extensions/tools/pet_card.mjs +32 -1
  66. package/dshqqbot/.qqbot-extensions/tools/qq_timer.mjs +570 -0
  67. package/dshqqbot/.qqbot-extensions/tools/safe_fs.mjs +150 -0
  68. package/dshqqbot/.qqbot-extensions/tools/sing.mjs +32 -1
  69. package/dshqqbot/.qqbot-extensions/tools/storyboard.mjs +33 -2
  70. package/dshqqbot/.qqbot-extensions/tools/surf.mjs +32 -1
  71. package/dshqqbot/.qqbot-extensions/tools/voice.mjs +32 -1
  72. package/dshqqbot/.qqbot-extensions/vendor/abogus/test-abogus.mjs +34 -3
  73. package/index.js +32 -1
  74. package/install.mjs +34 -3
  75. package/package.json +110 -88
  76. package/scripts/backfill-wechat-archive.mjs +83 -0
  77. package/scripts/backfill-xtc-history.mjs +59 -0
  78. package/scripts/douyin-cdp-comment.mjs +174 -0
  79. package/scripts/douyin-cdp-dm.mjs +205 -0
  80. package/scripts/douyin-cdp-export.mjs +215 -0
  81. package/scripts/douyin-cdp-upload.mjs +97 -0
  82. package/scripts/dsh-instance-guard.mjs +252 -0
  83. package/scripts/dsh-profile-links.mjs +189 -0
  84. package/scripts/dsh-profile-preflight.mjs +194 -0
  85. package/scripts/migrate-scope.mjs +139 -0
  86. package/scripts/private-archive-import.mjs +147 -0
  87. package/scripts/release-check.mjs +226 -0
  88. package/scripts/sync-plugin-copies.mjs +74 -14
  89. package/scripts/wechat-full-pull.mjs +158 -0
  90. package/scripts/wechat-media-pull.mjs +104 -0
  91. package/settings-host.js +423 -15
  92. package/dshqqbot/.qqbot-extensions/alive-config.json +0 -11
  93. package/dshqqbot/.qqbot-extensions/bili-ops-config.example.json +0 -121
  94. package/dshqqbot/.qqbot-extensions/draw-config.json +0 -49
  95. package/dshqqbot/.qqbot-extensions/live-config.json +0 -66
  96. package/dshqqbot/.qqbot-extensions/local-llm-config.json +0 -38
  97. package/dshqqbot/.qqbot-extensions/memory-config.json +0 -158
  98. package/dshqqbot/.qqbot-extensions/share-config.json +0 -10
  99. package/dshqqbot/.qqbot-extensions/voice-config.json +0 -67
  100. package/dshqqbot/.qqbot-extensions/worldbook.example.json +0 -209
  101. package/scripts/archive-secrets.ps1 +0 -34
  102. package/scripts/check-secrets.ps1 +0 -30
  103. package/scripts/fix-dsh-016-presets.ps1 +0 -133
  104. package/scripts/migrate-appdata.ps1 +0 -112
  105. package/scripts/publish-npm.mjs +0 -89
  106. package/scripts/push-github.ps1 +0 -31
  107. package/scripts/recover-pad.ps1 +0 -182
package/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # 更新日志
2
+
3
+ ## 0.1.8
4
+
5
+ ### 修复
6
+ - **彻底去掉写死的本机绝对路径**:`dist/`、`client/`、`dshqqbot/.qqbot-extensions/`、`scripts/` 里所有 `F:/qqbot/...`、`C:/Users/Administrator/...`、`D:/...` 改成运行期推导(环境变量 → 从模块自身位置往上找仓库根 → cwd),别人机器上不会再指向不存在的目录。
7
+ - `settings-host.js` 里 Chrome 调试实例的 `--user-data-dir=F:\qqbot mp\chrome-dy` 原来会被 JS 解析成制表符 + 相对路径,已改成按仓库根拼接。
8
+ - `tts-core.mjs` 的 Python 兜底不再写死 `E:\Anaconda\python.exe`,改成 `QQBOT_PYTHON` → `python`。
9
+ - `embedder.mjs` 找插件目录不再写死某个用户目录,改成 `USERPROFILE` / `APPDATA` + `DSH_HOME` 推导。
10
+ - `start-interview.mjs` 不再写死 DSH 桌面端安装路径(仍可用 `DSH_DESKTOP_EXE` 覆盖)。
11
+
12
+ ### 发版闸门
13
+ - 绝对路径检查现在真的会拦:系统目录(`C:/Windows`、`Program Files`)豁免,其余一律点名。
14
+ - 运维用的 `scripts/*.ps1` 不再打包进 npm 包。
15
+
16
+ ## 0.1.7 — 2026-11-18
17
+
18
+ 这一版主要是「别再让用户被同样的问题绊倒」:修掉已知 bug、把隐私数据从发布包里清干净、补上升级自检。
19
+
20
+ ### 修复
21
+ - **小模型抢 CPU**(`dist/features/local-embed.js`):ONNX 线程数固定为 1(`intraOpNumThreads` / `interOpNumThreads`)、`executionMode: 'sequential'`、推理串行排队;空闲 5 分钟自动 `dispose()` 卸载模型,下次用到再加载。修 bug 时不再和 file-history 插件抢资源。
22
+ - **小天才通道重复发消息**:frida 断开后补回逻辑会每 3 分钟重复注入同一段积压,导致对同一个人反复发「嗯。」。现在补回前先查链路(`linkFresh()`),并加补回水位 `.qqbot/xtc-catchup.json`,同一条只补一次。
23
+ - **`/bot-restart` 起不来**:旧实现重启时丢了 `ELECTRON_RUN_AS_NODE` / `DSH_HOME` 等环境变量、且杀完进程立刻 spawn 导致端口没释放。现在保留 env、等 2 秒、失败重试 3 次,并把日志写到 `logs/bot-restart.log`。
24
+
25
+ ### 隐私与安全
26
+ - 发布包里不再包含任何真实账号与个人数据:`dshqqbot/.qqbot-extensions/data/**`、顶层 `*.json` 配置、`*.bak*`、`*.lnk`、`**/.state/**`、本地密钥提取脚本全部排除(`package.json` 的 `files`)。
27
+ - 代码里硬编码的 openid / wxid / 家人姓名全部移除:
28
+ - `lib/private-guard.mjs` 改为按名单文件判断(`QQBOT_PRIVATE_PEERS` 或 `{数据根}/.qqbot/private-people.json`),发布包不带名单。
29
+ - `scripts/private-archive-import.mjs` 的名单与仓库根改为读环境变量/本地文件。
30
+ - 小天才插件去掉硬编码的兜底 id(改从会话台账推);UI 与注释里的称呼改成「家长 / 家人 / 小朋友」。
31
+ - 私聊归档仍然只写独立库 `.qqbot/private/private-chat.db`,常规记忆(`memory.db`)读不到;要读必须由人当场同意。
32
+
33
+ ### 升级自检(防安全模式)
34
+ - 启动时检测 profile 的 `package.json` 是否存在 `file:F:/...` 这类**绝对盘符**依赖(pnpm 会把它拼成相对路径 → 安装失败 → 进安全模式),命中就写日志 + 落标记 `.qqbot/profile-fix-needed.json`,并提示跑 `node scripts/dsh-profile-links.mjs` 修。
35
+ - 插件内部跨包相对 import 已改为按仓库根动态解析(`pickRepoRoot()`),从 `node_modules/.pnpm` 位置加载也不会 `ERR_MODULE_NOT_FOUND`。
36
+
37
+ ### 数据
38
+ - 新增 `scripts/private-archive-import.mjs` / `wechat-full-pull.mjs` / `wechat-media-pull.mjs`:把家人的私聊(抖音/微信/QQ)按「平台:dm:会话ID」分 scope 归档,带时间戳与 `private` 标签,幂等可重跑。
39
+ - 媒体只索引不搬运(`media_file` 表),避免误删原文件。
40
+
41
+ ### 发版守门(每版必跑)
42
+ - 新增 `scripts/release-check.mjs`:打包清单、包内 token/私钥/真实账号、入口语法、profile 依赖写法、默认人设五项一起查;`npm publish` 前会自动跑(`prepublishOnly`),不通过发不出去。
43
+ - 新增 `docs/RELEASE_CHECKLIST.md`:发布流程、隐私红线、老用户升级为什么不会再进安全模式。
44
+ - 可移植性:`live/persona.mjs` 与 `inbound/az-bili-note.mjs` 不再写死 `F:/qqbot/...`,改为从环境变量 / 数据根 / `import.meta.url` 推;没有 `character.json` 的机器也有内置默认人设(名字 / 种族 / 性格)。
45
+
46
+ ## 0.1.6 — 2026-11-13
47
+ - 多通道(QQ / 微信 / 小天才)积压消息补回;端口自愈(桥接写 `.port`,插件读取);任务管理支持「时间窗 OR 事件」。
package/README.md CHANGED
@@ -244,7 +244,7 @@ access:
244
244
  > care/allowlist 名单为空时启动日志会打醒目提示(不会静默)。
245
245
  > 拒绝时日志会打醒目提示(不会静默)。
246
246
 
247
- ## 🚀 新装即用(v0.1.6 · 只缺省才写入的默认值)
247
+ ## 🚀 新装即用(v0.1.7 · 只缺省才写入的默认值)
248
248
 
249
249
  下载插件后**不用手工调**:启动时做一次"补丁式迁移",只往**空位**里补默认值。
250
250
 
@@ -280,6 +280,22 @@ access:
280
280
  保留策略见 `secrets/interview/config.json` 的 `privacy` / `retention`(默认 14 天后归档)。
281
281
  - `/答题` 是判定式练习(关键词命中判定,零模型),**不落盘**,答完就散。
282
282
 
283
+ ## 🧭 部署与端口(一张表)
284
+
285
+ | 服务 | 端口 | 启动 |
286
+ | --- | --- | --- |
287
+ | DSH Desktop(宿主 / 浮窗) | 43129 | 正常启动 |
288
+ | 微信桥 `wechat-bridge` | 4311 | `wechat-bridge\start-bridge.bat`(需 `X-Bridge-Token`) |
289
+ | 平板 WCX(微信) | 3001 | `adb forward tcp:3001 tcp:3001`,重启后要重建 |
290
+ | 小天才桥 `xtc-bridge` | 4332 | `xtc-bridge\start-4332.bat`(沙箱外双击) |
291
+ | TTS 适配层 | 9881(GSV 9880 / Breeze 7860) | `python skills/local-tts/adapter/server.py --port 9881 --manage ...` |
292
+ | Ollama(向量 / 视觉) | 11434 | 系统自启 |
293
+
294
+ 记忆库统一在 `dshqqbot/.qqbot/memory.db`,作用域按 `c2c:<openid>` / `group:<群 id>` / `__global__` 分;
295
+ 微信侧当前写的是 `wechat:<convId>`(独立 scope,尚未归一)。
296
+
297
+ 完整版(启动顺序、每条链路当前能做什么、故障对照表)见本地文档 `docs/部署与链路-2026-11-13.md`(`docs/` 不入库)。
298
+
283
299
  ## 🔒 隐私
284
300
 
285
301
  **仓库与 npm 包里不包含**:真实 openid / 群号 / 聊天记录 / B 站与抖音 Cookie / API Key /
@@ -332,6 +348,8 @@ submission/ 插件市场提交条目
332
348
  - 已收录于 [awesome-dsh-plugin](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin)(DSH 桌面端内置插件市场的数据源)
333
349
  - 条目:`submission/wuwo1979__dsh-qqbot-muu.yml`(本地预检:`node scripts/check-submission.mjs`)
334
350
  - **更新机制**:市场不会自动跟随本仓库发版。每发一个新 Release,需要向上游仓库提 PR,把条目里的 `tarball:` 指到新版本——已随 v0.1.4 完成
351
+ - **发版守门**:每次发版前跑 `npm run release:check:strict`(`npm publish` 会自动跑),查打包内容、token/私钥/真实账号、入口语法、profile 依赖、默认人设;清单见 `docs/RELEASE_CHECKLIST.md`
352
+ - **v0.1.7**:修小模型抢 CPU、小天才重复发、`/bot-restart`;发布包已剔除全部个人数据与硬编码账号;启动时自检 profile 依赖,避免升级后进安全模式(见 `CHANGELOG.md`)
335
353
 
336
354
  ## 致谢与许可
337
355
 
@@ -382,8 +382,8 @@ window.__ModuleLoader__.load({
382
382
  ],
383
383
  },
384
384
  {
385
- id: 'timers', kw: '定时 提醒 计划 到点 主动 唤醒 闹钟', icon: '⑥', title: '定时唤醒',
386
- desc: '已合并到「定时任务」页(顶部 tab)一起编辑——到点主动开口的群/人分组,与她答应你的定时提醒,都在那边管理。',
385
+ id: 'timers', kw: '定时 提醒 计划 到点 主动 唤醒 闹钟 任务', icon: '⑥', title: '任务管理',
386
+ desc: '新建任务不在这——在 QQ 里跟她说就行(「每天 21:00 提醒我」「19-22 点之间随机」「我说累的时候来陪我」)。这里只看/开关/删,别往浮窗堆。',
387
387
  fields: [],
388
388
  },
389
389
  {
@@ -422,7 +422,7 @@ window.__ModuleLoader__.load({
422
422
  ]
423
423
 
424
424
  // 分区导航的短名(完整标题太长)
425
- var GSHORT = { prompt: '① 守则', rate: '② 回复节奏', sticker: '③ 表情包', rules: '④ 小提醒', diag: '⑤ 诊断日志', timers: '⑥ 定时', approval: '⑦ 审批', ask: '⑧ 提问卡片', group: '⑨ 群管理' }
425
+ var GSHORT = { prompt: '① 守则', rate: '② 回复节奏', sticker: '③ 表情包', rules: '④ 小提醒', diag: '⑤ 诊断日志', approval: '⑦ 审批', ask: '⑧ 提问卡片', group: '⑨ 群管理' }
426
426
 
427
427
  // ── 搜索(2026-10-10 主人定):上栏=精确(字面),下栏=模糊/语义 ───────────────
428
428
  // 语义侧**程序算**、零依赖、离线即时:字符 bigram + IDF 加权余弦;
@@ -1174,7 +1174,7 @@ window.__ModuleLoader__.load({
1174
1174
  imp ? h(ImportPanel, { storeDir: DD || undefined, onClose: function () { setImp(false); load() } }) : null)
1175
1175
  }
1176
1176
 
1177
- // ── 定时任务页(管理 AI 在 QQ 会话里建的定时任务: 一次性/每天) ──
1177
+ // ── 任务管理页(管理 AI 在 QQ 会话里建的任务: 定时/窗口/事件) ──
1178
1178
  var API_TIMERS = '/api/qqbot-settings/timers'
1179
1179
  function fmtWhen(job) {
1180
1180
  if (job.kind === 'daily') return '每天 ' + (job.atTime || '??:??')
@@ -1183,6 +1183,12 @@ window.__ModuleLoader__.load({
1183
1183
  var p2 = function (n) { return n < 10 ? '0' + n : '' + n }
1184
1184
  return '一次性 · ' + d.getFullYear() + '/' + p2(d.getMonth() + 1) + '/' + p2(d.getDate()) + ' ' + p2(d.getHours()) + ':' + p2(d.getMinutes())
1185
1185
  }
1186
+ if (job.kind === 'window') return (job.from || '??') + '-' + (job.to || '??') + ' · 每天 ' + (job.perDay || 1) + ' 次'
1187
+ if (job.kind === 'any') return (job.from || '??') + '-' + (job.to || '??') + ' 或事件'
1188
+ if (job.kind === 'event') {
1189
+ var kws = job.event && Array.isArray(job.event.keywords) ? job.event.keywords.join('/') : ''
1190
+ return '等「' + (kws || '?') + '」出现'
1191
+ }
1186
1192
  return job.kind === 'once' ? '一次性' : '每天'
1187
1193
  }
1188
1194
  // ── 定时唤醒编辑(原设置页④区, 并入定时任务页): config.schedule.targets 分组 ──
@@ -1462,6 +1468,20 @@ window.__ModuleLoader__.load({
1462
1468
  .catch(function (e) { setMsg('操作失败: ' + e.message) })
1463
1469
  .then(function () { setBusyId('') })
1464
1470
  }
1471
+ // 补发:清失败标记 + 把下一次触发提到现在(面板「重试」)
1472
+ function retry(j) {
1473
+ if (busyId) return
1474
+ if (!window.confirm('现在补发这条任务?(下一轮巡检 30 秒内会去发)')) return
1475
+ setBusyId(j.id)
1476
+ fetch('/api/qqbot-settings/timers/retry', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: j.id, schedDir: _tmSD || undefined }) })
1477
+ .then(function (r) { return r.json() })
1478
+ .then(function (d) {
1479
+ if (d && d.error) setMsg('没补成: ' + d.error)
1480
+ else { setMsg('已排上,等下一轮去发 ✓'); load() }
1481
+ })
1482
+ .catch(function (e) { setMsg('补发失败: ' + e.message) })
1483
+ .then(function () { setBusyId('') })
1484
+ }
1465
1485
  function who(job) {
1466
1486
  var scope = job.scope === 'c2c' ? 'c2c' : 'group'
1467
1487
  var nm = nameOf(scope, job.peerId)
@@ -1469,19 +1489,107 @@ window.__ModuleLoader__.load({
1469
1489
  return (scope === 'c2c' ? '私聊 · ' : '群聊 · ') + nm
1470
1490
  }
1471
1491
  function chip(kind) {
1472
- return h('span', { style: { fontSize: 11, padding: '1px 8px', borderRadius: 999, color: '#fff', background: kind === 'daily' ? '#2f9e44' : '#4d7cfe', whiteSpace: 'nowrap' } },
1473
- kind === 'daily' ? '每天' : '一次性')
1474
- }
1475
- // 左右分栏: 左=定时唤醒(编辑), 右=已安排的定时提醒(开关/删除)——有效利用横向空间
1492
+ var label = kind === 'daily' ? '每天' : kind === 'once' ? '一次性' : kind === 'window' ? '时间窗' : kind === 'event' ? '事件' : '窗口或事件'
1493
+ var color = kind === 'daily' ? '#2f9e44' : kind === 'once' ? '#4d7cfe' : kind === 'event' ? '#e8590c' : '#7048e8'
1494
+ return h('span', { style: { fontSize: 11, padding: '1px 8px', borderRadius: 999, color: '#fff', background: color, whiteSpace: 'nowrap' } }, label)
1495
+ }
1496
+ // ── 改时间和内容(对话里建的任务,人也能在面板改;只改内容/时间,不改对象和类型)──
1497
+ var [editId, setEditId] = useState('')
1498
+ var [draft, setDraft] = useState(null)
1499
+ var [saving, setSaving] = useState(false)
1500
+ var inpStyle = { font: 'inherit', fontSize: T.fsSm, padding: '3px 6px', borderRadius: 6, border: '1px solid ' + T.border, background: 'var(--qqs-card,#fff)', color: 'var(--qqs-text,#1f2329)', width: 104 }
1501
+ function toLocalInput(ts) {
1502
+ if (!ts) return ''
1503
+ var d = new Date(Number(ts))
1504
+ if (isNaN(d.getTime())) return ''
1505
+ var p2 = function (n) { return n < 10 ? '0' + n : '' + n }
1506
+ return d.getFullYear() + '-' + p2(d.getMonth() + 1) + '-' + p2(d.getDate()) + 'T' + p2(d.getHours()) + ':' + p2(d.getMinutes())
1507
+ }
1508
+ function openEdit(j) {
1509
+ var ev = j.event || {}
1510
+ setDraft({
1511
+ prompt: j.prompt || '',
1512
+ atTime: j.atTime || '09:00',
1513
+ dueLocal: toLocalInput(j.dueAt),
1514
+ from: j.from || '19:00',
1515
+ to: j.to || '22:00',
1516
+ perDay: j.perDay || 1,
1517
+ minGapMin: j.minGapMin || 0,
1518
+ keywords: (ev.keywords || []).join(','),
1519
+ match: ev.match === 'all' ? 'all' : 'any',
1520
+ withinMin: ev.withinMin || 720,
1521
+ cooldownMin: ev.cooldownMin || 180,
1522
+ })
1523
+ setEditId(j.id)
1524
+ }
1525
+ function put(k, v) { setDraft(function (d) { var n = Object.assign({}, d || {}); n[k] = v; return n }) }
1526
+ function saveEdit(j) {
1527
+ var b = { id: j.id, schedDir: _tmSD || undefined, prompt: draft.prompt }
1528
+ if (j.kind === 'daily') b.atTime = draft.atTime
1529
+ if (j.kind === 'once') {
1530
+ var ts = new Date(draft.dueLocal).getTime()
1531
+ if (!isFinite(ts)) { setMsg('时间填错了,重新选一下'); return }
1532
+ b.dueAt = ts
1533
+ }
1534
+ if (j.kind === 'window' || j.kind === 'any') {
1535
+ b.from = draft.from; b.to = draft.to
1536
+ b.perDay = Number(draft.perDay); b.minGapMin = Number(draft.minGapMin)
1537
+ }
1538
+ if (j.kind === 'event' || j.kind === 'any') {
1539
+ b.keywords = draft.keywords; b.match = draft.match
1540
+ b.withinMin = Number(draft.withinMin); b.cooldownMin = Number(draft.cooldownMin)
1541
+ }
1542
+ setSaving(true)
1543
+ fetch('/api/qqbot-settings/timers/update', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(b) })
1544
+ .then(function (r) { return r.json() })
1545
+ .then(function (d) {
1546
+ setSaving(false)
1547
+ if (d && d.error) { setMsg('没改成:' + d.error); return }
1548
+ setMsg('改好了 ✓'); setEditId(''); setDraft(null); load()
1549
+ })
1550
+ .catch(function (e) { setSaving(false); setMsg('没改成:' + e.message) })
1551
+ }
1552
+ function editForm(j) {
1553
+ var d = draft || {}
1554
+ var inp = function (k, props) { return h('input', Object.assign({ value: d[k], style: inpStyle, onChange: function (e) { put(k, e.target.value) } }, props || {})) }
1555
+ var line = function (label, node) {
1556
+ return h('div', { style: { display: 'flex', gap: 8, alignItems: 'center', margin: '5px 0', fontSize: T.fsSm } },
1557
+ h('span', { style: { minWidth: 62, color: T.text3 } }, label), node)
1558
+ }
1559
+ var rows = [
1560
+ h('div', { style: { fontSize: T.fsSm, color: T.text3, margin: '2px 0 3px' } }, '内容(到点她会对你说的话)'),
1561
+ h('textarea', { value: d.prompt || '', rows: 3, style: Object.assign({}, inpStyle, { width: '100%', resize: 'vertical', lineHeight: 1.5 }), onChange: function (e) { put('prompt', e.target.value) } }),
1562
+ ]
1563
+ if (j.kind === 'daily') rows.push(line('每天', inp('atTime', { type: 'time' })))
1564
+ if (j.kind === 'once') rows.push(line('时间', inp('dueLocal', { type: 'datetime-local', style: Object.assign({}, inpStyle, { width: 180 }) })))
1565
+ if (j.kind === 'window' || j.kind === 'any') {
1566
+ rows.push(line('时间窗', h('span', { style: { display: 'flex', gap: 4, alignItems: 'center' } }, inp('from', { type: 'time' }), '→', inp('to', { type: 'time' }))))
1567
+ rows.push(line('次数间隔', h('span', { style: { display: 'flex', gap: 4, alignItems: 'center' } },
1568
+ inp('perDay', { type: 'number', min: 1, max: 6, style: Object.assign({}, inpStyle, { width: 56 }) }), '次/天 · 至少隔',
1569
+ inp('minGapMin', { type: 'number', min: 0, max: 720, style: Object.assign({}, inpStyle, { width: 56 }) }), '分')))
1570
+ }
1571
+ if (j.kind === 'event' || j.kind === 'any') {
1572
+ rows.push(line('触发词', inp('keywords', { style: Object.assign({}, inpStyle, { width: '100%' }) })))
1573
+ rows.push(line('命中冷却', h('span', { style: { display: 'flex', gap: 4, alignItems: 'center' } },
1574
+ h('select', { value: d.match, style: inpStyle, onChange: function (e) { put('match', e.target.value) } },
1575
+ h('option', { value: 'any' }, '任一'), h('option', { value: 'all' }, '全中')),
1576
+ '冷却', inp('cooldownMin', { type: 'number', min: 5, max: 10080, style: Object.assign({}, inpStyle, { width: 64 }) }), '分')))
1577
+ }
1578
+ rows.push(h('div', { style: { display: 'flex', gap: 8, marginTop: 8 } },
1579
+ h('button', { className: 'qqs-btn', disabled: saving, style: { padding: '2px 10px', fontSize: T.fsSm }, onClick: function () { saveEdit(j) } }, saving ? '保存中…' : '保存'),
1580
+ h('button', { className: 'qqs-btn', disabled: saving, style: { padding: '2px 10px', fontSize: T.fsSm }, onClick: function () { setEditId(''); setDraft(null) } }, '取消')))
1581
+ return h('div', { style: { border: '1px solid ' + T.border, borderRadius: T.radius, padding: '8px 10px', marginTop: 6, background: 'rgba(127,127,127,.06)' } }, rows)
1582
+ }
1583
+ // 左右分栏: 左=定时唤醒(编辑), 右=她答应你的任务(改时间/内容/开关/删除)——有效利用横向空间
1476
1584
  var leftCol = h('div', { style: { flex: '1 1 44%', minWidth: 280, maxWidth: 560 } },
1477
1585
  h('div', { style: { ...card, padding: '10px 14px' } },
1478
- h('div', { style: { fontWeight: 700, fontSize: 13 } }, '① 定时唤醒(每天到点,让她主动去群/私聊开口)'),
1586
+ h('div', { style: { fontWeight: 700, fontSize: 13 } }, '① 定时开口(到点/每天,让她主动去群或私聊说一句)'),
1479
1587
  h('p', { style: { fontSize: T.fsSm, color: T.text3 } }, '每个群/人一组,下面可加多个时刻。不用记号码——点「选聊天对象」挑见过的就行(群显示真名/人显示昵称)。改完点「保存」。'),
1480
1588
  h(WakeEditor, { acct: props.acct })))
1481
1589
  var rightCol = h('div', { style: { flex: '1 1 44%', minWidth: 280 } },
1482
1590
  h('div', { style: { ...card, padding: '10px 14px' } },
1483
- h('div', { style: { fontWeight: 700, fontSize: 13 } }, '② 她答应你的定时提醒(在 QQ 里说一声就能建)'),
1484
- h('p', { style: { fontSize: T.fsSm, color: T.text3 } }, '这些是她在 QQ 里应你要求安排的提醒。这里只管看/开关/删除;一次性到点自动消失。'),
1591
+ h('div', { style: { fontWeight: 700, fontSize: 13 } }, '② 她答应你的任务(在 QQ 里说一声就能建:定时、时间窗、或聊天里出现某件事)'),
1592
+ h('p', { style: { fontSize: T.fsSm, color: T.text3 } }, '这些是她在 QQ 里应你要求安排的任务。触发方式有三类:到点、时间窗里随机、聊天里出现关键词(可组合成“时间窗或事件,任一触发”)。时间不对、内容想改,点「编辑」直接改,不用再让她重建。'),
1485
1593
  jobs === null ? h('p', { style: { fontSize: T.fsSm, color: T.text3 }, padding: 10 }, '加载中…') : null,
1486
1594
  jobs !== null && jobs.length === 0 ? h('p', { style: { color: 'var(--qqs-text2,#888)', padding: 14, textAlign: 'center', fontSize: T.fsSm } }, '还没有这类提醒。去 QQ 里让她安排一个,就会出现在这里。') : null,
1487
1595
  (jobs || []).map(function (j) {
@@ -1499,8 +1607,19 @@ window.__ModuleLoader__.load({
1499
1607
  h('label', { style: { fontSize: T.fsSm, whiteSpace: 'nowrap', color: j.enabled ? T.primary : '#ffa94d' } },
1500
1608
  h('input', { className: 'qqs-cb', type: 'checkbox', checked: !!j.enabled, disabled: disabled, onChange: function (e) { act(j, { enabled: e.target.checked }, e.target.checked ? '已启用' : '已停用') } }),
1501
1609
  ' ' + (j.enabled ? '启用中' : '已停用')),
1502
- h('button', { className: 'qqs-btn', disabled: disabled, style: { padding: '2px 8px', fontSize: T.fsSm }, onClick: function () { if (window.confirm('删除这条定时任务?')) act(j, {}, '已删除') } }, '删除')),
1503
- j.prompt ? h('div', { style: { fontSize: T.fsSm, color: '#cfd3dc', background: '#ffffff0a', border: '1px solid #ffffff14', borderRadius: T.radius, padding: '4px 8px', marginTop: 4, whiteSpace: 'pre-wrap', wordBreak: 'break-all' } }, j.prompt) : null)
1610
+ h('button', { className: 'qqs-btn', disabled: disabled, style: { padding: '2px 8px', fontSize: T.fsSm }, onClick: function () { if (editId === j.id) { setEditId(''); setDraft(null) } else openEdit(j) } }, editId === j.id ? '收起' : '编辑'),
1611
+ h('button', { className: 'qqs-btn', disabled: disabled, style: { padding: '2px 8px', fontSize: T.fsSm }, onClick: function () { if (window.confirm('删除这条定时任务?')) act(j, {}, '已删除') } }, '删除'),
1612
+ (j.lastError || !j.enabled || j.failCount > 0)
1613
+ ? h('button', { className: 'qqs-btn', disabled: disabled, style: { padding: '2px 8px', fontSize: T.fsSm, color: T.danger }, onClick: function () { retry(j) } }, '重试')
1614
+ : null),
1615
+ j.prompt ? h('div', { style: { fontSize: T.fsSm, color: 'var(--qqs-text2,#888)', background: 'rgba(127,127,127,.07)', border: '1px solid ' + T.border, borderRadius: T.radius, padding: '4px 8px', marginTop: 4, whiteSpace: 'pre-wrap', wordBreak: 'break-all' } }, j.prompt) : null,
1616
+ (j.lastError || j.firedCount > 0)
1617
+ ? h('div', { style: { fontSize: 11, marginTop: 3, color: j.lastError ? T.danger : T.text3 } },
1618
+ j.lastError
1619
+ ? ('上次没发出去:' + j.lastError)
1620
+ : ('已发 ' + j.firedCount + ' 次' + (j.lastFiredAt ? '(最近 ' + new Date(j.lastFiredAt).toLocaleString() + ')' : '')))
1621
+ : null,
1622
+ editId === j.id ? editForm(j) : null)
1504
1623
  }),
1505
1624
  msg ? h('p', { style: { fontSize: T.fsSm, color: T.success } }, msg) : null))
1506
1625
  return h('div', { style: { width: '100%', color: 'var(--qqs-text,#1f2329)' } },
@@ -1586,9 +1705,9 @@ window.__ModuleLoader__.load({
1586
1705
  : h('span', { style: { fontSize: 13, color: 'var(--qqs-text2,#888)' } }, '无账号… 去「账号与预设」添加'),
1587
1706
  ac ? h('span', { style: { fontSize: 12, color: '#6d28d9', whiteSpace: 'nowrap' } }, ac.dataDir ? '数据目录: ' + ac.dataDir : '') : null,
1588
1707
  h('span', { style: { flex: 1 } }),
1589
- h('span', { style: { fontSize: 12, color: '#8a97ad' } }, '设置/图库/定时 都跟随上面选的机器人')),
1708
+ h('span', { style: { fontSize: 12, color: '#8a97ad' } }, '设置/图库/任务 都跟随上面选的机器人')),
1590
1709
  h('div', { style: { position: 'sticky', top: 0, zIndex: 30, background: 'transparent', padding: '10px 4px 12px', display: 'flex', gap: 10, flexWrap: 'nowrap', alignItems: 'stretch', marginBottom: 12 } },
1591
- [['settings', '设置', '#ff5d5d'], ['gallery', '表情包图库', '#ffd97a'], ['timers', '定时任务', '#5b9dff'], ['accounts', '账号与预设', '#b197fc']].map(function (t) {
1710
+ [['settings', '设置', '#ff5d5d'], ['gallery', '表情包图库', '#ffd97a'], ['timers', '任务管理', '#5b9dff'], ['accounts', '账号与预设', '#b197fc']].map(function (t) {
1592
1711
  var on = tab === t[0]
1593
1712
  var n = t[0] === 'gallery' ? badges.untagged : t[0] === 'timers' ? badges.timers : 0
1594
1713
  var col = t[2]
@@ -5276,6 +5395,7 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5276
5395
  + '<div style="font-size:11px;color:#888">回复 ' + esc(x.nickname || '?') + ':' + esc(String(x.comment || '').slice(0, 40)) + (x.videoUrl ? ' · <a href="' + esc(x.videoUrl) + '" target="_blank">去视频页 ↗</a>' : '') + '</div>'
5277
5396
  + '<textarea data-qid="' + esc(x.id) + '" style="width:100%;min-height:36px;font-size:12px;margin:3px 0">' + esc(x.text || '') + '</textarea>'
5278
5397
  + '<div style="display:flex;gap:4px;flex-wrap:wrap">'
5398
+ + '<button class="qqs-btn ok" data-qsend="' + esc(x.id) + '">🚀 审批并发送</button>'
5279
5399
  + '<button class="qqs-btn" data-qcopy="' + esc(x.id) + '">📋 复制去发</button>'
5280
5400
  + '<button class="qqs-btn" data-qsave="' + esc(x.id) + '">💾 存草稿</button>'
5281
5401
  + '<button class="qqs-btn" data-qsent="' + esc(x.id) + '">✅ 已发了</button>'
@@ -5300,6 +5420,29 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5300
5420
  b.textContent = rr && rr.ok ? '✓ 已存' : '失败'; setTimeout(function () { b.textContent = '💾 存草稿' }, 1600)
5301
5421
  }
5302
5422
  })
5423
+ q.querySelectorAll('[data-qsend]').forEach(function (b) {
5424
+ b.onclick = async function () {
5425
+ var id = b.getAttribute('data-qsend')
5426
+ var one = rs.find(function (x) { return x.id === id }) || {}
5427
+ var ta = q.querySelector('[data-qid="' + id + '"]')
5428
+ var t = ta && ta.value.trim()
5429
+ if (!t) return
5430
+ if (!one.videoUrl) { b.textContent = '缺视频链接'; return }
5431
+ if (!confirm('用浏览器直接发到这条评论下面?' + String(t).slice(0, 80))) return
5432
+ b.disabled = true; b.textContent = '发送中…'
5433
+ var rr = await apiPost('douyin-reply-send', { url: one.videoUrl, match: one.comment, text: t }).catch(function (e) { return { ok: false, error: e.message } })
5434
+ b.disabled = false
5435
+ if (rr && rr.ok) {
5436
+ b.textContent = '✓ 已发'
5437
+ await apiPost('douyin-replies', { action: 'update', id: id, text: t, status: 'sent' }).catch(function () {})
5438
+ setTimeout(dyQueueLoad, 900)
5439
+ } else {
5440
+ b.textContent = '✗ 没发出去'
5441
+ alert('没发出去:' + ((rr && (rr.error || rr.log)) || '被风控/验证码拦了'))
5442
+ setTimeout(function () { b.textContent = '🚀 审批并发送' }, 2000)
5443
+ }
5444
+ }
5445
+ })
5303
5446
  q.querySelectorAll('[data-qsent]').forEach(function (b) {
5304
5447
  b.onclick = async function () {
5305
5448
  var id = b.getAttribute('data-qsent')
@@ -5347,7 +5490,7 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5347
5490
  return '<button class="dk-btn" data-ctab="' + tab + '" style="font-size:11.5px;padding:3px 12px;border-radius:14px 14px 0 0;border-bottom:none;'
5348
5491
  + (act ? 'background:#eef4ff;border-color:#1c7ed6;color:#1d4ed8;font-weight:700' : '') + '">' + label + '</button>'
5349
5492
  }
5350
- var h = '<div class="dk-row" style="font-weight:700;font-size:13px;margin:10px 0 2px">💬 评论中心<span style="font-weight:400;font-size:11px;color:#888;margin-left:8px">B站评论后台每 30 分钟自动巡检一轮;抖音不自动跑,点「巡检」才拉。B站能直发(拟人间隔);抖音写接口必风控 → 小蓝出文案、你复制手发</span></div>'
5493
+ var h = '<div class="dk-row" style="font-weight:700;font-size:13px;margin:10px 0 2px">💬 评论中心<span style="font-weight:400;font-size:11px;color:#888;margin-left:8px">B站评论后台每 30 分钟自动巡检一轮;抖音不自动跑,点「巡检」才拉。B站能直发(拟人间隔);抖音写接口被风控 → 现在改成「审批后用浏览器真发」,失败会照实报</span></div>'
5351
5494
  h += '<div class="dk-row" id="dk-vr-cw-tabs" style="gap:4px;margin:2px 0;align-items:flex-end">'
5352
5495
  + cwTabBtn('feed', '📬 B站收件箱')
5353
5496
  + cwTabBtn('list', '📺 B站视频评论')
@@ -5404,6 +5547,87 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5404
5547
  + '</div>'
5405
5548
  + '<div id="dk-dyn-hint" class="dk-msg" style="font-size:11.5px;color:#2f9e44;margin:2px 0"></div>'
5406
5549
  }
5550
+ // 私聊归档卡(2026-11-16):家长/家人的私聊单独存,不进肥鱼常规记忆
5551
+ function privateArchiveHtml() {
5552
+ return '<div class="dk-card" style="padding:10px;border:1px solid #e9ecef;border-radius:10px;background:#fff;margin-top:8px">'
5553
+ + '<div style="font-weight:700;font-size:13px">🔒 私聊归档<span style="font-weight:400;font-size:11px;color:#888;margin-left:8px">家人/朋友的抖音私信、微信与 QQ 私聊,单独存独立库,带 private 标签;肥鱼常规记忆读不到,要读得先问你</span></div>'
5554
+ + '<div class="dk-row" style="gap:6px;flex-wrap:wrap;align-items:center;margin:4px 0">'
5555
+ + '<button class="dk-btn" id="dk-pv-refresh">🔄 看统计</button>'
5556
+ + '<button class="dk-btn ok" id="dk-pv-import">⬇ 增量导入</button>'
5557
+ + '<span style="font-size:10.5px;color:#98a2b3">只写 .qqbot/private/private-chat.db,scope 按 平台:dm:会话ID + 时间戳</span>'
5558
+ + '</div>'
5559
+ + '<div id="dk-pv-out" class="dk-msg" style="font-size:11.5px;line-height:1.6;color:#555;max-height:200px;overflow:auto">点「看统计」看看入库情况</div>'
5560
+ + '</div>'
5561
+ }
5562
+ function bindPrivateArchive(panel) {
5563
+ var q = function (id) { return panel.querySelector('#' + id) }
5564
+ var out = q('dk-pv-out')
5565
+ var fmt = function (ts) { try { return new Date(ts).toLocaleString('zh-CN', { hour12: false }) } catch (e) { return String(ts) } }
5566
+ var paint = function (d) {
5567
+ if (!d || d.ok === false) { out.textContent = '读不到:' + ((d && d.error) || '?'); return }
5568
+ if (!d.exists) { out.textContent = '还没导入过。点「增量导入」把三处私聊收进来。'; return }
5569
+ out.innerHTML = (d.scopes || []).map(function (s) {
5570
+ return '<div>' + esc(s.scope) + ' · ' + esc(s.conv_name || '') + ' · <b>' + s.n + '</b> 条 · ' + fmt(s.a) + ' → ' + fmt(s.b) + '</div>'
5571
+ }).join('') || '(空)'
5572
+ }
5573
+ var rf = q('dk-pv-refresh')
5574
+ if (rf) rf.onclick = async function () { paint(await api('private-archive').catch(function (e) { return { ok: false, error: e.message } })) }
5575
+ var im = q('dk-pv-import')
5576
+ if (im) im.onclick = async function () {
5577
+ im.disabled = true; out.textContent = '导入中…'
5578
+ try {
5579
+ var r = await apiPost('private-archive', { action: 'import' }).catch(function (e) { return { ok: false, error: e.message } })
5580
+ paint(await api('private-archive').catch(function () { return null }))
5581
+ if (r && r.ok && r.result) out.insertAdjacentHTML('afterbegin', '<div style="color:#2f9e44">导入完成:' + esc(JSON.stringify(r.result.douyin || {})) + ' / ' + esc(JSON.stringify(r.result.wechat || {})) + ' / ' + esc(JSON.stringify(r.result.qq || {})) + '</div>')
5582
+ else out.insertAdjacentHTML('afterbegin', '<div style="color:#e03131">导入失败:' + esc((r && (r.error || r.log)) || '?') + '</div>')
5583
+ } finally { im.disabled = false }
5584
+ }
5585
+ rf && rf.click()
5586
+ }
5587
+ // 统一发布卡(2026-11-16):B站走任务卡「通过并投稿」;抖音走浏览器投稿(creator 打不开时手动)
5588
+ function publishCardHtml() {
5589
+ return '<div class="dk-card" style="padding:10px;border:1px solid #e9ecef;border-radius:10px;background:#fff;margin-top:8px">'
5590
+ + '<div style="font-weight:700;font-size:13px">📤 发布(B站 / 抖音)</div>'
5591
+ + '<div style="font-size:11px;color:#888;margin:2px 0 6px">B站:上面任务卡里「通过并投稿」会自动投;抖音:选好成片和文案点提交,会用浏览器打开投稿页把文件塞进去,最后一下「发布」自己点。</div>'
5592
+ + '<div class="dk-row" style="gap:6px;flex-wrap:wrap;align-items:center">'
5593
+ + '<select class="qqs-sel" id="dk-pub-plat" style="font-size:12px"><option value="douyin">抖音</option><option value="bili">B站</option></select>'
5594
+ + '<input class="qqs-txt" id="dk-pub-title" placeholder="标题" style="flex:1;min-width:160px;font-size:12px">'
5595
+ + '</div>'
5596
+ + '<textarea id="dk-pub-desc" rows="2" placeholder="简介 / 话题(#小蓝 #深海)" style="width:100%;font-size:12px;padding:5px;border:1px solid #d0d5dd;border-radius:8px;margin:4px 0;box-sizing:border-box"></textarea>'
5597
+ + '<div class="dk-row" style="gap:6px;flex-wrap:wrap;align-items:center">'
5598
+ + '<input class="qqs-txt" id="dk-pub-path" placeholder="成片绝对路径" style="flex:1;min-width:220px;font-size:12px">'
5599
+ + '<button class="dk-btn" id="dk-pub-recent">📂 最近成片</button>'
5600
+ + '<button class="dk-btn ok" id="dk-pub-go">📤 提交发布</button>'
5601
+ + '</div>'
5602
+ + '<div id="dk-pub-hint" class="dk-msg" style="font-size:11.5px;color:#2f9e44;margin:4px 0"></div>'
5603
+ + '</div>'
5604
+ }
5605
+ function bindPublishCard(panel) {
5606
+ var q = function (id) { return panel.querySelector('#' + id) }
5607
+ var hint = q('dk-pub-hint')
5608
+ var say = function (t, bad) { if (hint) { hint.style.color = bad ? '#e03131' : '#2f9e44'; hint.textContent = t } }
5609
+ var recent = q('dk-pub-recent')
5610
+ if (recent) recent.onclick = async function () {
5611
+ say('找最近的成片…')
5612
+ try {
5613
+ var r = await api('video-recent').catch(function (e) { return { ok: false, error: e.message } })
5614
+ if (r && r.ok && r.path) { q('dk-pub-path').value = r.path; say('用这个:' + r.path) } else say('没找到成片:' + ((r && r.error) || ''), true)
5615
+ } catch (e) { say('没找到成片', true) }
5616
+ }
5617
+ var go = q('dk-pub-go')
5618
+ if (go) go.onclick = async function () {
5619
+ var plat = (q('dk-pub-plat') || {}).value || 'douyin'
5620
+ var path = String((q('dk-pub-path') || {}).value || '').trim()
5621
+ if (!path) return say('先填成片路径(或点「最近成片」)', true)
5622
+ say('提交中…')
5623
+ go.disabled = true
5624
+ try {
5625
+ var r = await apiPost('video-publish', { platform: plat, path: path, title: (q('dk-pub-title') || {}).value || '', desc: (q('dk-pub-desc') || {}).value || '' }).catch(function (e) { return { ok: false, error: e.message } })
5626
+ if (r && r.ok) say(r.msg || '已提交(看浏览器窗口,最后一下发布自己点)')
5627
+ else say('没成:' + ((r && (r.error || r.msg)) || '未知原因'), true)
5628
+ } finally { go.disabled = false }
5629
+ }
5630
+ }
5407
5631
  function biliCardHtml() {
5408
5632
  return accountsHtml() + '<div class="dk-card" style="padding:10px;border:1px solid #e9ecef;border-radius:10px;background:#fff">'
5409
5633
  + '<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">'
@@ -5908,9 +6132,9 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5908
6132
  if (rootBtn) rootBtn.onclick = async function () {
5909
6133
  try {
5910
6134
  // [qqbot-mod] 2026-10-28: 不再猜路径 —— kind:'bili-jobs' 让宿主用 bili-ops.paths() 给真实产物根
5911
- // (之前写死 F:/qqbot/dshqqbot/.qqbot/bili-ops/jobs,真产物在 F:/qqbot/data/bili-ops/jobs)
6135
+ // (之前写死 dshqqbot/.qqbot/bili-ops/jobs,真产物在 data/bili-ops/jobs)
5912
6136
  var r = await apiPost('open-dir', { kind: 'bili-jobs' })
5913
- var p = (r && r.path) || 'F:/qqbot/data/bili-ops/jobs'
6137
+ var p = (r && r.path) || 'data/bili-ops/jobs'
5914
6138
  var cnt = (r && typeof r.count === 'number') ? r.count : -1
5915
6139
  var cntText = cnt < 0 ? '项数未知' : (cnt === 0 ? '空目录:还没渲染过视频' : cnt + ' 项')
5916
6140
  var okText = (r && r.ok) ? ('已打开(' + ((r && r.via) || 'explorer') + ',' + cntText + ')') : ('没弹出来:' + ((r && r.error) || '未知原因'))
@@ -5997,7 +6221,7 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
5997
6221
  '画面硬规则(imagePrompt 必须遵守):',
5998
6222
  '· 背景统一"深海蓝+月白"柔和色调,有景深层次与地面投影带;',
5999
6223
  '· 禁止空旷渐变底、禁止恐怖谷脸、禁手部特写;大字号短句排版由管线字幕负责,画面里不要塞文字;',
6000
- '· 角色形象基准:F:/qqbot/设定/小蓝_2D三视图_建模基准.png;透明立绘两套:assets/char/pose/*.png(v1 720×980)与 assets/char-v2/pose-alpha/*.png(v2 已抠透明,动作渲染用这套)。',
6224
+ '· 角色形象基准:设定/小蓝_2D三视图_建模基准.png;透明立绘两套:assets/char/pose/*.png(v1 720×980)与 assets/char-v2/pose-alpha/*.png(v2 已抠透明,动作渲染用这套)。',
6001
6225
  '',
6002
6226
  '规格:orientation=vertical(B站竖屏 1080×1920)。成片目标 ≥60 秒——管线会自动检查:总旁白不足 240 字会拒收重写,所以别拷电报体。',
6003
6227
  '音频:dubbing 参数【必传】——主人的选题里写了什么引擎就传什么:提到 IndexTTS/Index → dubbing="index";提到 Breeze → dubbing="breeze";完全没提 → dubbing="gsv"。注意管线有 dubbingOverride(默认强制 index):LLM 怕超时自己改 gsv 也会被拉回来;index 拉起前管线会自动腾卡(停 gsv/breeze),慢是正常的,不要中途重试。',
@@ -8405,13 +8629,19 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
8405
8629
  // [qqbot-mod] contact-move:联系方式 = QQ 侧清单 + B 站学习记录 + 学习心得
8406
8630
  body += contactHtml()
8407
8631
  } else if (state.tab === 'bili') {
8408
- body += biliCardHtml()
8632
+ // [qqbot-mod] ops-vs-creator 2026-11-16:出图/视频/历史任务/投稿搬去「🎬 创作台」
8633
+ body += accountsHtml()
8634
+ body += '<div class="dk-msg" style="font-size:11.5px;color:#667085;margin:4px 0">🖼 出图 · 🎞 视频 · 📚 历史任务 · 📤 投稿都搬到「🎬 创作台」了;这一页只留账号、评论、动态、直播。</div>'
8409
8635
  // [qqbot-mod] live 2026-11-07:直播(B 站社区长连)卡片
8410
8636
  body += liveCardHtml()
8411
8637
  // [qqbot-mod] ops-center 2026-10-30:评论中心并入运营中心 + 发动态入口
8412
8638
  body += commentCenterHtml()
8413
8639
  body += dynPostHtml()
8640
+ body += privateArchiveHtml()
8414
8641
  } else if (state.tab === 'video') {
8642
+ // [qqbot-mod] ops-vs-creator 2026-11-16:创作台 = 出图/配音/成片/历史任务/发布
8643
+ body += biliCardHtml()
8644
+ body += publishCardHtml()
8415
8645
  // [qqbot-mod] video-radar 2026-10-27:拉视频→生评论→B站可选直发/笔记/分享QQ群
8416
8646
  // [qqbot-mod] ops-center 2026-10-30 改名「创作台」:专注做视频/看视频内容,
8417
8647
  // 运营类(评论/收件箱/互动/发动态)全在「🛰 运营中心」页。
@@ -8789,7 +9019,9 @@ html += '<div class="dk-msg" style="font-size:11px;color:#888;line-height:1.6">
8789
9019
  // ★ 2026-10-24: B 站 tab 是后渲染的,bindBiliCard 必须在这里绑定(否则一直"加载中…")
8790
9020
  // [qqbot-mod] tab-lock(主人 2026-10-27):这三个 bind 任一抛错,后面的 bindBodyEvents 就不执行,
8791
9021
  // 标签按钮就再也点不动("进了本地模型页切不到别的页")。逐个兜住,出错只记一笔。
8792
- if (state.tab === 'bili') { try { bindBiliCard() } catch (eB) { console.warn('[qqbot] bindBiliCard', eB && eB.message) } }
9022
+ if (state.tab === 'bili' || state.tab === 'video') { try { bindBiliCard() } catch (eB) { console.warn('[qqbot] bindBiliCard', eB && eB.message) } }
9023
+ if (state.tab === 'video') { try { bindPublishCard(document) } catch (eP) { console.warn('[qqbot] bindPublishCard', eP && eP.message) } }
9024
+ if (state.tab === 'bili') { try { bindPrivateArchive(document) } catch (ePA) { console.warn('[qqbot] bindPrivateArchive', ePA && ePA.message) } }
8793
9025
  if (state.tab === 'bili') { try { bindLiveCard() } catch (eLv) { console.warn('[qqbot] bindLiveCard', eLv && eLv.message) } }
8794
9026
  if (state.tab === 'bili') { try { bindAccounts() } catch (eAB) {} try { loadAccounts(false) } catch (eAC) {} }
8795
9027
  if (state.tab === 'games') { try { bindGamesCard() } catch (eG) { console.warn('[qqbot] bindGamesCard', eG && eG.message) } }
@@ -1945,7 +1945,7 @@ export async function apply(ctx) {
1945
1945
  '\n最小示例(照抄改值):\n' +
1946
1946
  '· 唤醒单发 {session_id:"<uuid>", text:"帮我看下这个"}\n' +
1947
1947
  '· 跨群喇叭不唤醒 {peer_id:"<群openid>", scope:"group", text:"公告:…", mode:"append"}\n' +
1948
- '· 批量(每项自带 text) {batch:[{peer_id:"<g1>",scope:"group",text:"A"},{peer_id:"<g2>",scope:"group",text:"B",media:"D:/pic.png"}]} ← 用 batch 时**不要再传顶层 text**',
1948
+ '· 批量(每项自带 text) {batch:[{peer_id:"<g1>",scope:"group",text:"A"},{peer_id:"<g2>",scope:"group",text:"B",media:"<图片路径>"}]} ← 用 batch 时**不要再传顶层 text**',
1949
1949
  parameters: {
1950
1950
  session_id: { type: 'string', description: '目标会话 id(完整 sessionId, 来自 session_list)' },
1951
1951
  peer_id: { type: 'string', description: '或按 peer 寻址: 群 openid/私聊 openid(需带 scope)' },