dsh-onebot-genji 0.14.0 → 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/README.md +29 -7
- package/lib/bridge.js +5 -7
- package/lib/client.js +109 -37
- package/lib/inbound.js +67 -16
- package/lib/index.js +4 -0
- package/lib/settings-remote.js +22 -3
- package/lib/stickers.js +84 -12
- package/lib/trace.js +1 -0
- package/lib/types/bridge.d.ts +3 -0
- package/lib/types/client.d.ts +4 -0
- package/lib/types/inbound.d.ts +8 -4
- package/lib/types/stickers.d.ts +10 -1
- package/lib/types/trace.d.ts +1 -0
- package/package.json +111 -110
package/README.md
CHANGED
|
@@ -4,26 +4,37 @@
|
|
|
4
4
|
|
|
5
5
|
本分叉由 **InsaneGenji** 维护,在上游基础上加自己需要的东西;想装上游原版请去 https://github.com/mario841859784/dsh-onebot ,上游完整文档见 [`README.upstream.md`](./README.upstream.md)。
|
|
6
6
|
|
|
7
|
+
## 安装与配置
|
|
8
|
+
|
|
9
|
+
与原版完全一致,见 [`README.upstream.md`](./README.upstream.md)。
|
|
10
|
+
|
|
7
11
|
## 和原版(dsh-onebot-qq)的区别
|
|
8
12
|
|
|
9
13
|
只列本分叉**新加**的功能;安装、配置、连接 NapCat 的方式跟原版完全一致,见 [`README.upstream.md`](./README.upstream.md)。
|
|
10
14
|
|
|
11
15
|
| 功能 | 说明 |
|
|
12
16
|
| --- | --- |
|
|
13
|
-
|
|
|
14
|
-
| **表情包库** | 收到的新图自动进「未审核」;设置页「表情包」页签六列缩略图、悬停看原图(调 DSH 自己的大图查看器)、多选上传、审核 / 撤回 / 删除、已审核图可一键「重新识别」重写描述与标签,描述和标签点一下就能改。审核时才让模型看图写描述和标签,不点不跑、不占显存 |
|
|
17
|
+
| **表情包库** | 一套完整的表情包管理:新图自动收进「未审核」,审核时才让模型看图写描述和标签,不点不跑、不占显存;已审核的图可一键「重新识别」重跑识别,描述和标签点一下就能改 |
|
|
15
18
|
| **主动搭话** | 内置在插件里(`lib/proactive.js`),按空闲时长、间隔、每日上限、安静时段自己找话题,聊完还能补一句;开关和阈值全在设置页「行为 → 私聊」,生成走当前会话模型 |
|
|
16
19
|
| **回合形式掷骰** | 每个回合按概率决定这一轮用文字、语音条还是表情包;语音/表情的开关与概率都是设置项(默认 10% / 39%) |
|
|
17
20
|
| **气泡切分与双发闸** | 正文按换行 / 句末标点自动切成最多 4 条气泡,条与条之间 0.8–1.5 秒随机停顿;`qq_send_text` 这一轮发过话,回合末正文就不再发(要补内容就再调一次工具,别指望正文兜底) |
|
|
18
21
|
| **群聊上下文** | 被 @ 或叫到唤醒词时,自动带上群里最近 N 条消息(「参考上下文条数」,默认 3,0 = 不带),被门控挡下的消息不会丢 |
|
|
19
|
-
|
|
|
20
|
-
| **引用合并转发展开** | 被引的消息本身是合并转发时展开成可读内容,而不是只剩 `[合并转发]` 占位 |
|
|
21
|
-
| **会话恢复重试** | 插件热重载时原版会「恢复失败 → 退休旧会话 → 新建」,一个聊天裂成两个会话;这里带 0.7s / 1.5s / 3s 三次重试,等旧会话把手上那轮收完 |
|
|
22
|
+
| **自带语音转写桥** | `lib/stt_cli.py` 打进包里,`sttEngine: auto` 探不到 whisper 时自动用它(只要 Python + `faster-whisper`),不用自己配脚本 |
|
|
22
23
|
| **设置页重做** | 中文标签 + 分组分区(连接 / 权限 / 行为 / 表情包 / 会话 / 媒体 / 诊断),数字项统一「≥0 的整数」校验,用不到的项(旁观、强制会话 ID、新会话智能体预设等)已隐藏 |
|
|
23
24
|
|
|
24
|
-
##
|
|
25
|
+
## 表情包管理
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
设置 → 插件 → QQ Bot → 「表情包」页签。库根目录默认在插件自己的 `stickers\` 下,只分「已审核」和「未审核」两个子目录——**聊天只从「已审核」里挑图**。
|
|
28
|
+
|
|
29
|
+

|
|
30
|
+
|
|
31
|
+
- **自动收集**:开着时每 5 分钟扫一遍 `~/.dsh/media/onebot`,按内容去重后把新图收进「未审核」,**不会直接进聊天**;删过的图不会被自动收回来(除非你手动新增)。
|
|
32
|
+
- **新增**:点「新增」挑图,或者直接把图片拖进面板——选择器弹不出来时拖拽照走同一条路。
|
|
33
|
+
- **审核**:点「审核」由宿主模型(当前会话模型)看图写一句描述 + 3~6 个中文标签,然后把文件搬进「已审核」。「审核全部」一次处理整批。识别失败的原因会写进 `~/.dsh/onebot-stickers.log` 的 `sticker warn` 行,面板报 `no-result` 时去那里看。
|
|
34
|
+
- **重新识别**:已审核的图每张下面有「重新识别」,重跑一遍识别并覆盖原有描述和标签,用来纠正老条目或者换了模型之后统一刷新。
|
|
35
|
+
- **改描述 / 标签**:把鼠标移到描述或标签那一行,右端出现铅笔,点开变输入框,回车保存。两行高度固定,长的自动省略。未审核的图不给改——审核时会自己识别一遍。
|
|
36
|
+
- **看图 / 删除**:点缩略图看原图(走 DSH 自己的大图查看器);「删除」会在索引里留一条墓碑,之后这张图不会再被自动收集。
|
|
37
|
+
- **索引自愈**:打开面板时会先对一遍索引和磁盘,文件没了的条目直接摘掉(显示「文件丢失」而不是一直转圈)。一次发现一半以上都读不到时按「库目录整体不可用」处理、索引原样保留——免得盘符没挂上就把 188 条清空。
|
|
27
38
|
|
|
28
39
|
## 语音转写(插件自带的桥)
|
|
29
40
|
|
|
@@ -43,6 +54,17 @@ PATH 上既没有 whisper 可执行文件、也没有可用的 Python 时,语
|
|
|
43
54
|
|
|
44
55
|
自带桥认这几个环境变量:`DS_STT_SERVER`(常驻转写服务地址,默认 `http://127.0.0.1:9891/transcribe`,设成空串则禁用)、`DS_STT_MODEL`(默认 `small`)、`DS_STT_CACHE`(模型缓存目录)、`DS_STT_LANG`(默认 `zh`)。
|
|
45
56
|
|
|
57
|
+
## 开发
|
|
58
|
+
|
|
59
|
+
源码在 `src/`,`lib/` 是编译产物(`tsc` 的 `outDir`)。改完 `src` 要重新编译,`lib` 不手改。
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
pnpm build # ./scripts/build.sh
|
|
63
|
+
pnpm test # vitest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
改到设置面板(`src/client.ts`)时另外跑一遍 `startup\settings-*.mjs` 那组校验脚本。
|
|
67
|
+
|
|
46
68
|
## 许可证
|
|
47
69
|
|
|
48
70
|
BSD-3-Clause,版权归原作者所有,见 [`LICENSE`](./LICENSE)。
|
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
|
-
|
|
73
|
-
|
|
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('[' +
|
|
786
|
+
list.push('[' + formatClock(entry.time) + '] ' + entry.nickname + '(' + entry.userId + '): ' + body);
|
|
789
787
|
while (list.length > cap)
|
|
790
788
|
list.shift();
|
|
791
789
|
}
|
package/lib/client.js
CHANGED
|
@@ -188,7 +188,7 @@ window.__ModuleLoader__.load({
|
|
|
188
188
|
// 2026-11-19(本地加):主动搭话——排在「行为 → 私聊」分区(原来在「权限 → 私聊」)。
|
|
189
189
|
// 原文在 lib/proactive.js,配置读宿主 Config.proactive(面板键带 proactive 前缀)。
|
|
190
190
|
{ key: "proactiveEnabled", label: "主动搭话", type: "boolean", hint: "隔一阵自己来找你(安静时段和频率都由下面几项控制)" },
|
|
191
|
-
{ key: "proactiveTargetUsers", label: "搭话目标用户", type: "stringArray", hint: "
|
|
191
|
+
{ key: "proactiveTargetUsers", label: "搭话目标用户", type: "stringArray", hint: "留空=管理员列表", showIf: { key: "proactiveEnabled", value: true } },
|
|
192
192
|
{ key: "proactiveMinIdleMinutes", label: "你安静多久才搭话(分钟)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
193
193
|
{ key: "proactiveMinGapMinutes", label: "两次搭话最小间隔(分钟)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
194
194
|
{ key: "proactiveMaxPerDay", label: "每天最多搭话次数", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
@@ -213,7 +213,7 @@ window.__ModuleLoader__.load({
|
|
|
213
213
|
desc: "表情包管理",
|
|
214
214
|
fields: [
|
|
215
215
|
{ key: "stickerAutoCollect", label: "自动收集表情包", type: "boolean", hint: "收到的新图自动收进「未审核」,不会直接进聊天" },
|
|
216
|
-
{ key: "stickerRoot", label: "表情包库目录", type: "string", placeholder: "
|
|
216
|
+
{ key: "stickerRoot", label: "表情包库目录", type: "string", placeholder: "留空=%USERPROFILE%\\.dsh\\dsh-onebot-genji\\stickers", hint: "里面有「已审核」(聊天只从这里挑图)与「未审核」两个子目录" },
|
|
217
217
|
],
|
|
218
218
|
},
|
|
219
219
|
{
|
|
@@ -1076,7 +1076,7 @@ window.__ModuleLoader__.load({
|
|
|
1076
1076
|
stickerReplyProb: { label: "Sticker probability", hint: "0–1, default 0.39 (39%)" },
|
|
1077
1077
|
// 2026-11-19(本地加):主动搭话英文词条(从权限组搬过来;缺了会回落 zh,插件启动时打警告)。
|
|
1078
1078
|
proactiveEnabled: { label: "Proactive messages", hint: "Come find you on my own after a while (quiet hours and frequency below)" },
|
|
1079
|
-
proactiveTargetUsers: { label: "Proactive target users", hint: "Empty
|
|
1079
|
+
proactiveTargetUsers: { label: "Proactive target users", hint: "Empty=the admin list" },
|
|
1080
1080
|
proactiveMinIdleMinutes: { label: "Idle minutes before reaching out" },
|
|
1081
1081
|
proactiveMinGapMinutes: { label: "Min gap between proactive messages (minutes)" },
|
|
1082
1082
|
proactiveMaxPerDay: { label: "Max proactive messages per day" },
|
|
@@ -1100,7 +1100,7 @@ window.__ModuleLoader__.load({
|
|
|
1100
1100
|
title: "Stickers",
|
|
1101
1101
|
fields: {
|
|
1102
1102
|
stickerAutoCollect: { label: "Auto-collect stickers", hint: "New images land in Pending and never go into chats directly" },
|
|
1103
|
-
stickerRoot: { label: "Sticker library root", placeholder: "Empty
|
|
1103
|
+
stickerRoot: { label: "Sticker library root", placeholder: "Empty=%USERPROFILE%\\.dsh\\dsh-onebot-genji\\stickers", hint: "Holds 已审核 (approved — chats only pick from here) and 未审核 (pending)" },
|
|
1104
1104
|
},
|
|
1105
1105
|
},
|
|
1106
1106
|
session: {
|
|
@@ -1216,7 +1216,7 @@ window.__ModuleLoader__.load({
|
|
|
1216
1216
|
// 度量对齐宿主原生控件(Input 32px/.5px l4 边/radius-md、开关 36×20、分段 26px)。
|
|
1217
1217
|
var CSS = [
|
|
1218
1218
|
// token 映射(别名层:--dsw-alias-* / --dsw-radius-*)
|
|
1219
|
-
".obx-panel{--obx-fg:var(--dsw-alias-label-primary,#17181a);--obx-fg-secondary:var(--dsw-alias-label-secondary,#4b4f58);--obx-fg-tertiary:var(--dsw-alias-label-tertiary,#7f8287);--obx-hairline:var(--dsw-alias-border-l2,rgba(0,0,0,.1));--obx-input-border:var(--dsw-alias-border-l4,rgba(0,0,0,.16));--obx-input-bg:var(--dsw-alias-bg-layer-1,#fff);--obx-well-bg:var(--dsw-alias-bg-module-platform,#f5f6f7);--obx-focus:var(--dsw-alias-state-business-primary,#4176e6);--obx-error:var(--dsw-alias-state-error-primary,#ec1313);--obx-warn:var(--dsw-alias-state-warn-label,#dd8629);--obx-radius-md:var(--dsw-radius-md,12px);--obx-radius-sm:var(--dsw-radius-sm,8px);box-sizing:border-box;width:100%;max-width:
|
|
1219
|
+
".obx-panel{--obx-fg:var(--dsw-alias-label-primary,#17181a);--obx-fg-secondary:var(--dsw-alias-label-secondary,#4b4f58);--obx-fg-tertiary:var(--dsw-alias-label-tertiary,#7f8287);--obx-hairline:var(--dsw-alias-border-l2,rgba(0,0,0,.1));--obx-input-border:var(--dsw-alias-border-l4,rgba(0,0,0,.16));--obx-input-bg:var(--dsw-alias-bg-layer-1,#fff);--obx-well-bg:var(--dsw-alias-bg-module-platform,#f5f6f7);--obx-focus:var(--dsw-alias-state-business-primary,#4176e6);--obx-error:var(--dsw-alias-state-error-primary,#ec1313);--obx-warn:var(--dsw-alias-state-warn-label,#dd8629);--obx-radius-md:var(--dsw-radius-md,12px);--obx-radius-sm:var(--dsw-radius-sm,8px);box-sizing:border-box;width:100%;max-width:1100px;margin-inline:auto;height:100%;min-height:0;display:flex;flex-direction:column;color:var(--obx-fg);font-size:13px;line-height:1.5}",
|
|
1220
1220
|
// 回落值明暗切换(宿主 token 在位时此块不产生任何效果)
|
|
1221
1221
|
"@media (prefers-color-scheme: dark){.obx-panel{--obx-fg:#eceef2;--obx-fg-secondary:#b6bac4;--obx-fg-tertiary:#81858c;--obx-hairline:rgba(255,255,255,.12);--obx-input-border:rgba(255,255,255,.2);--obx-input-bg:#232324;--obx-well-bg:#2c2c2e;--obx-focus:#7aaaff;--obx-error:#f25a5a;--obx-warn:#f59e0b}}",
|
|
1222
1222
|
// 页骨架(对齐宿主原生页:居中 960 内容列、20px/500 标题、页签行、滚动主体)
|
|
@@ -1251,12 +1251,10 @@ window.__ModuleLoader__.load({
|
|
|
1251
1251
|
".obx-sticker-upload{position:relative;display:inline-flex;align-items:center;font-size:13px;cursor:pointer;border:1px dashed currentColor;border-radius:8px;padding:4px 10px;opacity:.8}",
|
|
1252
1252
|
".obx-sticker-upload input{position:absolute;inset:0;opacity:0;cursor:pointer}",
|
|
1253
1253
|
".obx-sticker-row{display:grid;grid-template-columns:70px minmax(120px,1fr) minmax(80px,160px) auto auto auto auto;gap:8px;align-items:center;padding:4px 0;border-bottom:1px solid rgba(128,128,128,.18)}",
|
|
1254
|
-
".obx-sticker-grid{display:
|
|
1255
|
-
".obx-sticker-card{margin:0;
|
|
1254
|
+
".obx-sticker-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;padding:4px 0}",
|
|
1255
|
+
".obx-sticker-card{box-sizing:border-box;margin:0;width:100%;max-width:100%;min-width:0;display:flex;flex-direction:column;gap:4px;padding:6px;border-radius:10px;border:1px solid rgba(128,128,128,.22);background:rgba(128,128,128,.06)}",
|
|
1256
1256
|
".obx-sticker-thumb{width:100%;aspect-ratio:1 / 1;height:auto;display:flex;align-items:center;justify-content:center;border-radius:8px;overflow:hidden;background:rgba(128,128,128,.12);cursor:zoom-in;position:relative}",
|
|
1257
|
-
//
|
|
1258
|
-
".obx-sticker-thumb-hint{position:absolute;left:50%;bottom:6px;transform:translateX(-50%);padding:1px 7px;border-radius:6px;border:1px solid rgba(255,255,255,.72);background:rgba(0,0,0,.62);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;opacity:0;transition:opacity .12s ease;pointer-events:none}",
|
|
1259
|
-
".obx-sticker-thumb:hover .obx-sticker-thumb-hint,.obx-sticker-thumb:focus-visible .obx-sticker-thumb-hint{opacity:1}",
|
|
1257
|
+
// 2026-11-19 主人要求:缩略图上那块固定的「查看原图」不要了(挡图),相关两条样式一并删除。
|
|
1260
1258
|
".obx-sticker-panel .obx-sticker-title{font-size:16px}",
|
|
1261
1259
|
".obx-lightbox{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.78)}",
|
|
1262
1260
|
".obx-lightbox-img{max-width:92vw;max-height:92vh;border-radius:8px}",
|
|
@@ -1282,14 +1280,21 @@ window.__ModuleLoader__.load({
|
|
|
1282
1280
|
".obx-danger-outline.obx-danger-outline:disabled{opacity:.5}",
|
|
1283
1281
|
".obx-sticker-thumb img{width:100%;height:100%;object-fit:cover;display:block;cursor:inherit}",
|
|
1284
1282
|
".obx-sticker-thumb-wait{font-size:12px;opacity:.5}",
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
".obx-sticker-
|
|
1289
|
-
".obx-sticker-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1283
|
+
// 本地改(2026-11-19 主人要求):描述 / 标签都固定两行高度,超出两行省略号;
|
|
1284
|
+
// 编辑时由 *--editing 解除行数限制(否则 textarea 被 -webkit-box 撑出卡片)。
|
|
1285
|
+
".obx-sticker-card-desc{margin:0;font-size:12px;line-height:16px;height:32px;overflow:hidden;word-break:break-word;overflow-wrap:anywhere;min-width:0}",
|
|
1286
|
+
".obx-sticker-card-tags{font-size:11px;line-height:16px;height:32px;opacity:.55;overflow:hidden;word-break:break-word;overflow-wrap:anywhere;min-width:0}",
|
|
1287
|
+
".obx-sticker-card-desc--editing,.obx-sticker-card-tags--editing{height:auto;overflow:visible;opacity:1}",
|
|
1288
|
+
// 2026-11-19 主人要求:省略号必须挂在真正装文字的容器上——figcaption 里套的是定位容器,
|
|
1289
|
+
// 它自己的 -webkit-box 数不到内层行,只会被 overflow 裁掉、不出「…」。
|
|
1290
|
+
// 所以 clamp 落到 .obx-sticker-edit-text,铅笔改绝对定位让出右侧位置。
|
|
1291
|
+
".obx-sticker-editable{display:block;position:relative;padding-right:18px;max-width:100%;min-width:0}",
|
|
1292
|
+
".obx-sticker-edit-text{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;word-break:break-word;overflow-wrap:anywhere;min-width:0}",
|
|
1293
|
+
// 2026-11-19 主人要求:铅笔的 cursor 必须是手型(宿主对 button 有自己的 cursor 规则,这里加 !important 压住)。
|
|
1294
|
+
".obx-sticker-edit-btn{position:absolute;top:0;right:0;opacity:0;background:none;border:none;margin:0;padding:0 3px;min-width:18px;min-height:18px;cursor:pointer !important;color:inherit;font-size:12px;line-height:16px;text-align:center;transition:opacity .12s ease}",
|
|
1295
|
+
// 2026-11-19 主人要求:铅笔只在鼠标移到「那一行」时出现(描述、标签各管各的),不再整张卡片 hover 就出。
|
|
1296
|
+
".obx-sticker-editable:hover .obx-sticker-edit-btn,.obx-sticker-edit-btn:focus-visible{opacity:.7}",
|
|
1297
|
+
".obx-sticker-edit-input{display:block;box-sizing:border-box;width:100%;max-width:100%;min-width:0;height:40px;min-height:40px;font:inherit;font-size:12px;line-height:16px;padding:3px 5px;border-radius:4px;resize:vertical;border:1px solid rgba(128,128,128,.55);background:rgba(128,128,128,.08);color:inherit}",
|
|
1293
1298
|
".obx-sticker-card-actions{display:flex;flex-wrap:wrap;gap:4px}",
|
|
1294
1299
|
// 主人 2026-11-19:卡片上的「审核 / 补标签 / 删除」字号比默认小 2px(13 → 11),
|
|
1295
1300
|
// 高度跟着收,不然小字号撑在 32px 按钮里很空。
|
|
@@ -2202,7 +2207,7 @@ window.__ModuleLoader__.load({
|
|
|
2202
2207
|
var edit = editState[0];
|
|
2203
2208
|
var setEdit = editState[1];
|
|
2204
2209
|
var aliveRef = React.useRef(true);
|
|
2205
|
-
// 2026-11-19
|
|
2210
|
+
// 2026-11-19:真 file input 藏在「新增」按钮后面(按钮保持跟「审核全部」同款尺寸)。
|
|
2206
2211
|
var fileRef = React.useRef(null);
|
|
2207
2212
|
var errorState = React.useState("");
|
|
2208
2213
|
var error = errorState[0];
|
|
@@ -2286,11 +2291,21 @@ window.__ModuleLoader__.load({
|
|
|
2286
2291
|
};
|
|
2287
2292
|
var editableField = function (item, field, text) {
|
|
2288
2293
|
var editing = edit != null && edit.hash === item.hash && edit.field === field;
|
|
2294
|
+
// 2026-11-19 主人要求:未审核的图不许改描述 / 标签——审核时会自己识别一遍打标签。
|
|
2295
|
+
// 只给纯文本(照样两行省略),不出铅笔、点不进去。
|
|
2296
|
+
if (item.approved !== true) {
|
|
2297
|
+
var shownText = text != null
|
|
2298
|
+
? text
|
|
2299
|
+
: (field === "tags"
|
|
2300
|
+
? (Array.isArray(item.tags) && item.tags.length > 0 ? item.tags.join("、") : "无标签")
|
|
2301
|
+
: (String(item.description || "").trim() !== "" ? String(item.description) : String(item.file || item.hash)));
|
|
2302
|
+
return h(React, "span", { className: "obx-sticker-edit-text" }, shownText);
|
|
2303
|
+
}
|
|
2289
2304
|
if (editing) {
|
|
2290
2305
|
return h(React, "textarea", {
|
|
2291
2306
|
className: "obx-sticker-edit-input",
|
|
2292
2307
|
value: edit.value,
|
|
2293
|
-
rows:
|
|
2308
|
+
rows: 2,
|
|
2294
2309
|
autoFocus: true,
|
|
2295
2310
|
spellCheck: false,
|
|
2296
2311
|
onChange: function (event) { setEdit({ hash: item.hash, field: field, value: event.target.value }); },
|
|
@@ -2315,7 +2330,6 @@ window.__ModuleLoader__.load({
|
|
|
2315
2330
|
return h(React, "span", { className: "obx-sticker-editable" }, h(React, "span", { className: "obx-sticker-edit-text" }, text != null ? text : current), h(React, "button", {
|
|
2316
2331
|
type: "button",
|
|
2317
2332
|
className: "obx-sticker-edit-btn",
|
|
2318
|
-
title: "修改",
|
|
2319
2333
|
"aria-label": "修改",
|
|
2320
2334
|
onClick: function (event) {
|
|
2321
2335
|
event.stopPropagation();
|
|
@@ -2344,19 +2358,25 @@ window.__ModuleLoader__.load({
|
|
|
2344
2358
|
setDebug("重新识别 " + String(hash).slice(0, 8) + ":描述「" + String(one.description || "(空)") + "」 标签 " + tags);
|
|
2345
2359
|
return;
|
|
2346
2360
|
}
|
|
2347
|
-
|
|
2361
|
+
// 2026-11-19:no-result 只是「识别器没给出结果」的外壳,具体原因落在
|
|
2362
|
+
// ~/.dsh/onebot-stickers.log 的 sticker warn 行里,提示一下免得只看到 no-result。
|
|
2363
|
+
setDebug("重新识别失败 " + String(hash).slice(0, 8) + ":" + String(one.reason || "unknown") + (String(one.reason || "") === "no-result" ? "(识别器没回结果,原因看 ~/.dsh/onebot-stickers.log 的 sticker warn 行)" : ""));
|
|
2348
2364
|
}).catch(fail).then(function () {
|
|
2349
2365
|
if (aliveRef.current)
|
|
2350
2366
|
setBusy("");
|
|
2351
2367
|
});
|
|
2352
2368
|
};
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
if (files.length === 0)
|
|
2369
|
+
// 2026-11-19 主人:点「新增」不弹选择器。把上传逻辑抽出来,
|
|
2370
|
+
// 文件选择器和「拖进面板」两条路都走它,哪条通都能加图。
|
|
2371
|
+
var uploadFiles = function (files) {
|
|
2372
|
+
if (files.length === 0) {
|
|
2373
|
+
setDebug("新增:没有拿到文件(选择器关掉或没选)");
|
|
2357
2374
|
return;
|
|
2358
|
-
|
|
2375
|
+
}
|
|
2359
2376
|
setBusy("新增");
|
|
2377
|
+
setDebug("新增:收到 " + files.length + " 个文件,正在读…");
|
|
2378
|
+
var added = 0;
|
|
2379
|
+
var skipped = [];
|
|
2360
2380
|
var chain = Promise.resolve();
|
|
2361
2381
|
for (var index = 0; index < files.length; index += 1) {
|
|
2362
2382
|
(function (file) {
|
|
@@ -2367,18 +2387,49 @@ window.__ModuleLoader__.load({
|
|
|
2367
2387
|
reader.onerror = function () { resolve(""); };
|
|
2368
2388
|
reader.readAsDataURL(file);
|
|
2369
2389
|
}).then(function (dataUrl) {
|
|
2370
|
-
if (dataUrl === "")
|
|
2390
|
+
if (dataUrl === "") {
|
|
2391
|
+
skipped.push("读不出来");
|
|
2371
2392
|
return null;
|
|
2372
|
-
|
|
2393
|
+
}
|
|
2394
|
+
return Promise.resolve(remote.addSticker(file.name || "sticker", dataUrl)).then(function (result) {
|
|
2395
|
+
var payload = result;
|
|
2396
|
+
if (payload != null && payload.ok === false) {
|
|
2397
|
+
skipped.push("入库失败");
|
|
2398
|
+
return null;
|
|
2399
|
+
}
|
|
2400
|
+
var one = payload != null ? payload.added : null;
|
|
2401
|
+
if (one != null && one.added === true)
|
|
2402
|
+
added += 1;
|
|
2403
|
+
else
|
|
2404
|
+
skipped.push(String(one != null && one.reason ? one.reason : "重复"));
|
|
2405
|
+
return null;
|
|
2406
|
+
});
|
|
2373
2407
|
});
|
|
2374
2408
|
});
|
|
2375
2409
|
})(files[index]);
|
|
2376
2410
|
}
|
|
2377
2411
|
chain.then(function () { return remote.listStickers(); }).then(unwrap).then(apply).catch(fail).then(function () {
|
|
2378
|
-
if (aliveRef.current)
|
|
2379
|
-
|
|
2412
|
+
if (!aliveRef.current)
|
|
2413
|
+
return;
|
|
2414
|
+
setBusy("");
|
|
2415
|
+
setDebug("新增:入库 " + String(added) + " 张" + (skipped.length > 0 ? ",跳过 " + String(skipped.length) + " 张(" + skipped.join("、") + ")" : ""));
|
|
2380
2416
|
});
|
|
2381
2417
|
};
|
|
2418
|
+
var onPick = function (event) {
|
|
2419
|
+
var input = event && event.target;
|
|
2420
|
+
var files = input && input.files ? Array.prototype.slice.call(input.files) : [];
|
|
2421
|
+
if (input != null)
|
|
2422
|
+
input.value = "";
|
|
2423
|
+
uploadFiles(files);
|
|
2424
|
+
};
|
|
2425
|
+
var onDrop = function (event) {
|
|
2426
|
+
if (event == null)
|
|
2427
|
+
return;
|
|
2428
|
+
if (typeof event.preventDefault === "function")
|
|
2429
|
+
event.preventDefault();
|
|
2430
|
+
var carried = event.dataTransfer != null && event.dataTransfer.files != null ? event.dataTransfer.files : null;
|
|
2431
|
+
uploadFiles(carried == null ? [] : Array.prototype.slice.call(carried));
|
|
2432
|
+
};
|
|
2382
2433
|
var openPreview = function (hash) {
|
|
2383
2434
|
// 缩略图已经读进缓存就直接开(省一次往返),否则现读原图再开。
|
|
2384
2435
|
var cached = thumbsRef.current[hash];
|
|
@@ -2478,13 +2529,16 @@ window.__ModuleLoader__.load({
|
|
|
2478
2529
|
};
|
|
2479
2530
|
var cardOf = function (item) {
|
|
2480
2531
|
var tagList = Array.isArray(item.tags) ? item.tags : [];
|
|
2481
|
-
|
|
2532
|
+
// 2026-11-19 主人反馈:索引里有、磁盘上没了的那几张会一直显示「…」(裂图)。
|
|
2533
|
+
// 宿主侧 listStickers 已经会自愈摘掉;这里再兜一层,缺文件就直说「文件丢失」,不去读图。
|
|
2534
|
+
var missing = item.exists === false;
|
|
2535
|
+
var src = missing ? undefined : thumbs[item.hash];
|
|
2482
2536
|
return h(React, "figure", { className: "obx-sticker-card", key: item.hash },
|
|
2483
2537
|
// 2026-11-19:缩略图点击 = 用宿主自己的大图查看器(ImageLightbox)看原图。
|
|
2484
2538
|
h(React, "div", {
|
|
2485
2539
|
className: "obx-sticker-thumb",
|
|
2486
|
-
ref: attachThumb(item.hash),
|
|
2487
|
-
title:
|
|
2540
|
+
ref: missing ? undefined : attachThumb(item.hash),
|
|
2541
|
+
title: "查看原图",
|
|
2488
2542
|
role: "button",
|
|
2489
2543
|
tabIndex: 0,
|
|
2490
2544
|
"aria-label": "查看原图",
|
|
@@ -2493,13 +2547,28 @@ window.__ModuleLoader__.load({
|
|
|
2493
2547
|
if (event.key === "Enter" || event.key === " ")
|
|
2494
2548
|
openPreview(item.hash);
|
|
2495
2549
|
},
|
|
2496
|
-
},
|
|
2550
|
+
},
|
|
2551
|
+
// 2026-11-19 主人要求:缩略图上那块固定的「查看原图」挡图,去掉;悬停提示交回原生 title。
|
|
2552
|
+
missing
|
|
2553
|
+
? h(React, "span", { className: "obx-sticker-thumb-wait" }, "文件丢失")
|
|
2554
|
+
: (src ? h(React, "img", { src: src, alt: item.description || item.hash, loading: "lazy" }) : h(React, "span", { className: "obx-sticker-thumb-wait" }, "…"))), h(React, "figcaption", {
|
|
2555
|
+
className: "obx-sticker-card-desc" + (edit != null && edit.hash === item.hash && edit.field === "description" ? " obx-sticker-card-desc--editing" : ""),
|
|
2556
|
+
}, editableField(item, "description")), h(React, "div", {
|
|
2557
|
+
className: "obx-sticker-card-tags" + (edit != null && edit.hash === item.hash && edit.field === "tags" ? " obx-sticker-card-tags--editing" : ""),
|
|
2558
|
+
}, editableField(item, "tags", tagList.length > 0 ? tagList.join(" ") : "无标签")), h(React, "div", { className: "obx-sticker-card-actions" },
|
|
2497
2559
|
// 主人 2026-11-19:已审核的图都带「重新识别」(原「补标签」文案改掉,且原来点了没反应)。
|
|
2498
2560
|
item.approved === true
|
|
2499
2561
|
? h(React, ui.Button, { variant: "ghost", className: "obx-accent-btn", disabled: disabled, onClick: function () { retagOne(item.hash); } }, "重新识别")
|
|
2500
2562
|
: h(React, ui.Button, { variant: "primary", disabled: disabled, onClick: function () { run("审核", function () { return remote.approveStickers([item.hash]); }); } }, "审核"), h(React, ui.Button, { variant: "ghost", className: "obx-danger-btn", disabled: disabled, onClick: function () { run("删除", function () { return remote.deleteSticker([item.hash]); }); } }, "删除")));
|
|
2501
2563
|
};
|
|
2502
|
-
return h(React, "section", {
|
|
2564
|
+
return h(React, "section", {
|
|
2565
|
+
className: "obx-sticker-panel",
|
|
2566
|
+
onDragOver: function (event) {
|
|
2567
|
+
if (event != null && typeof event.preventDefault === "function")
|
|
2568
|
+
event.preventDefault();
|
|
2569
|
+
},
|
|
2570
|
+
onDrop: onDrop,
|
|
2571
|
+
}, error !== "" ? h(React, "p", { className: "obx-sticker-error" }, error) : null, debug !== "" ? h(React, "p", { className: "obx-sticker-debug" }, debug) : null, h(React, "div", { className: "obx-sticker-statline" }, h(React, "p", { className: "obx-hint" }, "库目录:" + ((data != null ? data.root : "") || "—") + " 已审核 " + String(stats.approved) + " 张 / 未审核 " + String(stats.pending) + " 张(聊天只从已审核里挑图)"), h(React, ui.Button, { variant: "ghost", className: "obx-light-btn", disabled: disabled, onClick: function () { void load(); } }, busy === "读取" ? "读取中…" : "刷新")), busy !== "" ? h(React, "p", { className: "obx-hint" }, "处理中:" + busy + "…") : null, preview != null
|
|
2503
2572
|
? (typeof ui.ImageLightbox === "function"
|
|
2504
2573
|
// 2026-11-19 主人要求:走宿主自己的大图查看器(Esc / 点遮罩关闭)。
|
|
2505
2574
|
? h(React, ui.ImageLightbox, {
|
|
@@ -2517,8 +2586,11 @@ window.__ModuleLoader__.load({
|
|
|
2517
2586
|
style: { display: "none" },
|
|
2518
2587
|
onChange: onPick,
|
|
2519
2588
|
}), h(React, ui.Button, { variant: "ghost", className: "obx-green-btn", disabled: disabled, onClick: function () {
|
|
2589
|
+
// 2026-11-19:先落一行调试,确认按钮的 onClick 到底有没有被点到;
|
|
2590
|
+
// 文件选择器弹不出来时,还能拖图片到这个面板(onDrop 走同一条上传逻辑)。
|
|
2591
|
+
setDebug("新增:按钮已点击,正在唤起文件选择器(不行就把图片直接拖进面板)");
|
|
2520
2592
|
var node = fileRef.current;
|
|
2521
|
-
if (node != null)
|
|
2593
|
+
if (node != null && typeof node.click === "function")
|
|
2522
2594
|
node.click();
|
|
2523
2595
|
} }, "新增"), h(React, ui.Button, { variant: "ghost", className: "obx-light-btn", disabled: disabled, onClick: function () { run("审核全部", function () { return remote.approveStickers([]); }); } }, "审核全部"))), pending.length === 0
|
|
2524
2596
|
? h(React, "p", { className: "obx-hint" }, "没有待审核的图")
|
package/lib/inbound.js
CHANGED
|
@@ -70,6 +70,9 @@ export function normalizeOneBot11(event) {
|
|
|
70
70
|
/** W2-②: default (chatId, message_id) dedup window, aligned with the MIT
|
|
71
71
|
* competitor's dedupWindowSeconds (300s). */
|
|
72
72
|
export const DEFAULT_DEDUP_WINDOW_SECONDS = 300;
|
|
73
|
+
/** 2026-11-19:语音转写在派发前最多等这么久(毫秒)。等不到就按 `[语音]`
|
|
74
|
+
* 派发并把晚到的结果丢掉 —— 一条语音只准产生一轮。 */
|
|
75
|
+
export const VOICE_TRANSCRIBE_WAIT_MS = 8_000;
|
|
73
76
|
/** W2-②: max entries kept in the dedup window map (LRU-evicted beyond this)
|
|
74
77
|
* so a flood of distinct message_ids cannot grow memory unbounded. */
|
|
75
78
|
export const DEDUP_MAX_ENTRIES = 4096;
|
|
@@ -471,13 +474,15 @@ export class InboundPipeline {
|
|
|
471
474
|
return (ref.stickerLabel !== undefined ? '[表情包:' : '[图片:') + resolved.path + ']'
|
|
472
475
|
+ await gifFramesNote(resolved.path, this.ctx.config.gifFramesEnabled === true);
|
|
473
476
|
case 'voice': {
|
|
474
|
-
//
|
|
475
|
-
//
|
|
476
|
-
//
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
477
|
+
// 2026-11-19 改:转写等在这里,派发前就把它拼进正文。原来的做法是
|
|
478
|
+
// 先派发 [语音] 占位符、转写完成后 steer 进会话 —— 当占位符那一轮
|
|
479
|
+
// 已经结束时,steer 会**另开一轮**,一条语音变成两次执行。
|
|
480
|
+
// 现在只有一条路:等到(或超时)再派发,超时就退回 [语音] 且
|
|
481
|
+
// 丢掉晚到的转写,绝不再补一次 steer。
|
|
482
|
+
if (!this.ctx.transcriber.enabled)
|
|
483
|
+
return '[语音]';
|
|
484
|
+
const label = await this.transcribeInline(resolved.path);
|
|
485
|
+
return label === '' ? '[语音]' : label;
|
|
481
486
|
}
|
|
482
487
|
case 'video':
|
|
483
488
|
return '[视频:' + resolved.path + ']';
|
|
@@ -485,22 +490,31 @@ export class InboundPipeline {
|
|
|
485
490
|
return '[文件:' + resolved.path + ']';
|
|
486
491
|
}
|
|
487
492
|
}
|
|
488
|
-
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
|
|
493
|
+
/** 2026-11-19:转写改成在派发前同步等(最多等 VOICE_TRANSCRIBE_WAIT_MS)。
|
|
494
|
+
* 返回『(语音转写:…)』标签,失败/超时/空结果返回 '' —— 调用方退回
|
|
495
|
+
* `[语音]` 占位符。超时后即使转写稍后完成也不再做任何事,所以一条语音
|
|
496
|
+
* 永远只产生一轮。 */
|
|
497
|
+
async transcribeInline(path) {
|
|
492
498
|
try {
|
|
493
|
-
const text = await this.ctx.transcriber.transcribe(path);
|
|
494
|
-
if (
|
|
499
|
+
const text = await withTimeout(this.ctx.transcriber.transcribe(path), VOICE_TRANSCRIBE_WAIT_MS);
|
|
500
|
+
if (text === undefined) {
|
|
501
|
+
this.ctx.log('warn', '语音转写超时,按占位符派发: ' + path);
|
|
502
|
+
currentTrace()?.emit('transcribe', { ok: false, reason: TRACE_REASONS.sttTimeout });
|
|
503
|
+
return '';
|
|
504
|
+
}
|
|
505
|
+
const label = transcriptLabel(text);
|
|
506
|
+
if (label === '') {
|
|
495
507
|
this.ctx.log('debug', '语音转写结果为空: ' + path);
|
|
496
508
|
currentTrace()?.emit('transcribe', { ok: false, reason: TRACE_REASONS.sttEmpty });
|
|
497
|
-
return;
|
|
509
|
+
return '';
|
|
498
510
|
}
|
|
499
|
-
|
|
511
|
+
currentTrace()?.emit('transcribe', { ok: true });
|
|
512
|
+
return label;
|
|
500
513
|
}
|
|
501
514
|
catch (error) {
|
|
502
515
|
this.ctx.log('warn', 'STT failed: ' + describeError(error));
|
|
503
516
|
currentTrace()?.emit('transcribe', { ok: false, reason: '语音转写失败: ' + describeError(error) });
|
|
517
|
+
return '';
|
|
504
518
|
}
|
|
505
519
|
}
|
|
506
520
|
/**
|
|
@@ -549,7 +563,33 @@ export class InboundPipeline {
|
|
|
549
563
|
// 单图失败静默跳过:引用展开的主路径(文字)不受影响。
|
|
550
564
|
}
|
|
551
565
|
}
|
|
552
|
-
|
|
566
|
+
// 引用里可能就是一张合并转发卡片:被引用消息的段里是 forward,而
|
|
567
|
+
// segmentText 只给裸的 "[合并转发]"、把 id 丢了 —— 模型看到的是一张
|
|
568
|
+
// 空白卡片(2026-11-20 群里「品鉴一下」引用了聊天记录,收到就是
|
|
569
|
+
// "[引用],: [合并转发]")。这里把被引用消息里的 forward 段真正展开,
|
|
570
|
+
// 替换掉那个裸标签;展开失败只是保留原样,不影响引用里的其它文字。
|
|
571
|
+
const forwardTexts = [];
|
|
572
|
+
for (const segment of segments ?? []) {
|
|
573
|
+
if (segment?.type !== 'forward')
|
|
574
|
+
continue;
|
|
575
|
+
const fid = segment.data?.id ?? segment.data?.resId;
|
|
576
|
+
if (fid === undefined || fid === null || String(fid) === '')
|
|
577
|
+
continue;
|
|
578
|
+
try {
|
|
579
|
+
const expanded = await this.expandForward(String(fid));
|
|
580
|
+
if (expanded.text.trim() !== '')
|
|
581
|
+
forwardTexts.push(expanded.text);
|
|
582
|
+
}
|
|
583
|
+
catch {
|
|
584
|
+
// 单条转发展开失败静默跳过。
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const base = imageNotes.length > 0 ? text + '\n' + imageNotes.join('\n') : text;
|
|
588
|
+
const withImages = forwardTexts.length === 0
|
|
589
|
+
? base
|
|
590
|
+
: (base.includes('[合并转发]')
|
|
591
|
+
? base.replace('[合并转发]', forwardTexts.join('\n'))
|
|
592
|
+
: forwardTexts.join('\n') + '\n' + base);
|
|
553
593
|
if (withImages.trim() === '')
|
|
554
594
|
return '';
|
|
555
595
|
const name = data.sender?.nickname ?? '';
|
|
@@ -737,6 +777,17 @@ function numericReplyId(messageId) {
|
|
|
737
777
|
const value = Number(raw);
|
|
738
778
|
return Number.isSafeInteger(value) ? value : undefined;
|
|
739
779
|
}
|
|
780
|
+
/**
|
|
781
|
+
* 2026-11-19:等一个 Promise,超过 `ms` 就返回 undefined(原 Promise 继续
|
|
782
|
+
* 跑,但结果被丢弃 —— 语音转写就是这么用的:宁可退回 `[语音]`,也不要
|
|
783
|
+
* 晚到的转写另开一轮)。
|
|
784
|
+
*/
|
|
785
|
+
function withTimeout(promise, ms) {
|
|
786
|
+
return new Promise((resolve, reject) => {
|
|
787
|
+
const timer = setTimeout(() => resolve(undefined), ms);
|
|
788
|
+
promise.then(value => { clearTimeout(timer); resolve(value); }, error => { clearTimeout(timer); reject(error); });
|
|
789
|
+
});
|
|
790
|
+
}
|
|
740
791
|
/** The placeholder a media ref contributes to the parsed text. */
|
|
741
792
|
function placeholderFor(ref) {
|
|
742
793
|
switch (ref.kind) {
|
package/lib/index.js
CHANGED
|
@@ -728,6 +728,10 @@ export function apply(ctx, config) {
|
|
|
728
728
|
throw error;
|
|
729
729
|
}
|
|
730
730
|
console.log('[dsh-onebot] mounted' + mountDetails);
|
|
731
|
+
// 主动搭话(2026-11-19 本地加):实例在 effect 外面就建好了,但 start() 必须
|
|
732
|
+
// 等连接就绪后再调 —— 漏了这一步实例就是个死对象:noteInbound 因为 chatIds
|
|
733
|
+
// 还是空的直接 return(连 lastUserAt 都不写),定时器也从不排。
|
|
734
|
+
proactive?.start();
|
|
731
735
|
// 表情包自动收集(2026-11-19 本地加):每 5 分钟扫一次入站媒体目录,新图只进
|
|
732
736
|
// 「未审核」;不调模型、不占显存。关掉开关就连定时器都不建。
|
|
733
737
|
if (config.stickerAutoCollect !== false) {
|
package/lib/settings-remote.js
CHANGED
|
@@ -682,7 +682,12 @@ export function createStickerMethods(editor, ctx) {
|
|
|
682
682
|
}
|
|
683
683
|
};
|
|
684
684
|
const rawConfig = () => findEntry(editor).options.config ?? {};
|
|
685
|
-
|
|
685
|
+
// 2026-11-19:识别失败的 warn 原来只进宿主控制台,面板报 no-result 时无从查起 —— 一起落诊断日志。
|
|
686
|
+
const logFn = (level, message) => {
|
|
687
|
+
console.warn('[dsh-onebot] [' + level + '] ' + String(message));
|
|
688
|
+
if (level !== 'debug')
|
|
689
|
+
diag('sticker ' + level + ' ' + String(message));
|
|
690
|
+
};
|
|
686
691
|
const storeOf = () => {
|
|
687
692
|
const root = String(rawConfig().stickerRoot ?? '') || String(SCHEMA_DEFAULTS.stickerRoot ?? '') || DEFAULT_STICKER_ROOT;
|
|
688
693
|
if (cache.store === null || cache.root !== root) {
|
|
@@ -716,7 +721,20 @@ export function createStickerMethods(editor, ctx) {
|
|
|
716
721
|
};
|
|
717
722
|
return {
|
|
718
723
|
async listStickers() {
|
|
719
|
-
|
|
724
|
+
// 2026-11-19:先把「索引里有、磁盘上没了」的条目摘掉,面板就不会再出裂图。
|
|
725
|
+
return trace('listStickers', async () => {
|
|
726
|
+
const store = storeOf();
|
|
727
|
+
let gone = [];
|
|
728
|
+
try {
|
|
729
|
+
gone = store.pruneMissing();
|
|
730
|
+
}
|
|
731
|
+
catch (error) {
|
|
732
|
+
diag('listStickers pruneMissing 失败 ' + errorStackOrMessage(error));
|
|
733
|
+
}
|
|
734
|
+
if (gone.length > 0)
|
|
735
|
+
diag('listStickers 清掉 ' + gone.length + ' 条文件已丢失的索引:' + gone.slice(0, 8).join(','));
|
|
736
|
+
return baseOf(store);
|
|
737
|
+
});
|
|
720
738
|
},
|
|
721
739
|
/** 新增一张:name = 文件名,dataUrl = dataURL 或裸 base64(一次一张)。 */
|
|
722
740
|
async addSticker(name, dataUrl) {
|
|
@@ -731,9 +749,10 @@ export function createStickerMethods(editor, ctx) {
|
|
|
731
749
|
catch {
|
|
732
750
|
buf = null;
|
|
733
751
|
}
|
|
752
|
+
// 2026-11-19:手动新增就是明确要收回来,force 撤掉「删过别再收」的墓碑。
|
|
734
753
|
const result = buf == null
|
|
735
754
|
? { added: false, reason: 'bad-data' }
|
|
736
|
-
: store.addBuffer(buf, String(name ?? 'sticker'), { approved: false });
|
|
755
|
+
: store.addBuffer(buf, String(name ?? 'sticker'), { approved: false, force: true });
|
|
737
756
|
return { ...baseOf(store), added: result };
|
|
738
757
|
});
|
|
739
758
|
},
|
package/lib/stickers.js
CHANGED
|
@@ -208,6 +208,45 @@ export class StickerStore {
|
|
|
208
208
|
out.sort((a, b) => (b.addedAt || 0) - (a.addedAt || 0));
|
|
209
209
|
return out;
|
|
210
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* 2026-11-19 主人反馈:未审核里出现「裂图」——索引里有条目、磁盘上文件却没了,
|
|
213
|
+
* 面板只知道读图失败,一直显示「…」。打开面板前先清一遍:文件不在就从索引里摘掉。
|
|
214
|
+
*
|
|
215
|
+
* @returns 被摘掉的 hash 列表(空表示索引是干净的)
|
|
216
|
+
*/
|
|
217
|
+
pruneMissing() {
|
|
218
|
+
const known = Object.keys(this.index.items).length;
|
|
219
|
+
const gone = [];
|
|
220
|
+
for (const [hash, item] of Object.entries(this.index.items)) {
|
|
221
|
+
if (item == null || typeof item.hash !== 'string') {
|
|
222
|
+
delete this.index.items[hash];
|
|
223
|
+
gone.push(hash);
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
let present = false;
|
|
227
|
+
try {
|
|
228
|
+
present = statSync(this.pathOf(item)).isFile();
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
present = false;
|
|
232
|
+
}
|
|
233
|
+
if (present)
|
|
234
|
+
continue;
|
|
235
|
+
delete this.index.items[hash];
|
|
236
|
+
gone.push(item.hash);
|
|
237
|
+
}
|
|
238
|
+
// 2026-11-19 事故:库里 188 条一起被判「文件丢失」,索引被整个清空(图片其实还在)。
|
|
239
|
+
// 一次摘掉一半以上还不少于 10 条,说明不是个别文件丢失,而是目录本身读不到
|
|
240
|
+
// (盘符没挂、目录被挪、权限变动)。这种情况宁可留着让面板显示「文件丢失」。
|
|
241
|
+
if (gone.length >= 10 && gone.length * 2 > known && known > 0) {
|
|
242
|
+
this.ensure();
|
|
243
|
+
this.log('warn', `pruneMissing 跳过:${known} 条里有 ${gone.length} 条读不到文件,按库目录整体不可用处理,索引保持原样`);
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
if (gone.length > 0)
|
|
247
|
+
this.save();
|
|
248
|
+
return gone;
|
|
249
|
+
}
|
|
211
250
|
stats() {
|
|
212
251
|
const items = this.list();
|
|
213
252
|
let approved = 0;
|
|
@@ -230,7 +269,7 @@ export class StickerStore {
|
|
|
230
269
|
};
|
|
231
270
|
}
|
|
232
271
|
/** 落一张图进库;返回 { added, item }(同内容已存在时 added=false)。 */
|
|
233
|
-
addBuffer(buf, name, { approved = false } = {}) {
|
|
272
|
+
addBuffer(buf, name, { approved = false, force = false } = {}) {
|
|
234
273
|
if (!Buffer.isBuffer(buf) || buf.length === 0)
|
|
235
274
|
return { added: false, reason: 'empty' };
|
|
236
275
|
const mime = sniffImageMime(buf);
|
|
@@ -238,8 +277,11 @@ export class StickerStore {
|
|
|
238
277
|
return { added: false, reason: 'not-image' };
|
|
239
278
|
const hash = hashOf(buf);
|
|
240
279
|
// 删过的图别再自动收回来(2026-11-19 主人报的 bug:删了又出现在未审核里)。
|
|
241
|
-
|
|
280
|
+
// 但主人在面板上手动「新增」就是明确要把这张收回来,force 时先撤墓碑再入库。
|
|
281
|
+
if (!force && Array.isArray(this.index.deleted) && this.index.deleted.includes(hash))
|
|
242
282
|
return { added: false, reason: 'deleted' };
|
|
283
|
+
if (force && Array.isArray(this.index.deleted) && this.index.deleted.includes(hash))
|
|
284
|
+
this.index.deleted = this.index.deleted.filter((one) => one !== hash);
|
|
243
285
|
const exist = this.index.items[hash];
|
|
244
286
|
if (exist != null) {
|
|
245
287
|
// 已审核的图再次被收集:不动它,免得把审核状态打回未审核
|
|
@@ -580,6 +622,25 @@ function parseTaggingReply(text) {
|
|
|
580
622
|
return null;
|
|
581
623
|
return { description, tags };
|
|
582
624
|
}
|
|
625
|
+
/** 从宿主 ctx 取一格服务:先走 ctx.get(cordis 正规入口,插件没 inject 也取得到),
|
|
626
|
+
* 再回落属性访问(测试替身 / 老宿主)。 */
|
|
627
|
+
function hostService(ctx, key) {
|
|
628
|
+
if (ctx == null || typeof ctx !== 'object')
|
|
629
|
+
return undefined;
|
|
630
|
+
const getter = ctx.get;
|
|
631
|
+
if (typeof getter === 'function') {
|
|
632
|
+
try {
|
|
633
|
+
const value = getter.call(ctx, key);
|
|
634
|
+
if (value !== undefined && value !== null)
|
|
635
|
+
return value;
|
|
636
|
+
}
|
|
637
|
+
catch {
|
|
638
|
+
/* 取不到就当没有,走属性回落 */
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const fallback = ctx[key];
|
|
642
|
+
return fallback === undefined || fallback === null ? undefined : fallback;
|
|
643
|
+
}
|
|
583
644
|
/**
|
|
584
645
|
* 造一个审核用的识别器:把图作为 image block 交给宿主当前会话模型,拿回
|
|
585
646
|
* {description, tags}。任一环节不可用(没 attachments / 模型不认图 / 超时)都返回 null,
|
|
@@ -597,17 +658,21 @@ export function makeStickerTagger(ctx, { log } = {}) {
|
|
|
597
658
|
buf = readFileSync(filePath);
|
|
598
659
|
}
|
|
599
660
|
catch {
|
|
661
|
+
logFn('warn', '表情包识别跳过:文件读不到 ' + filePath);
|
|
600
662
|
return null;
|
|
601
663
|
}
|
|
602
|
-
if (buf.length === 0 || buf.length > 8 * 1024 * 1024)
|
|
664
|
+
if (buf.length === 0 || buf.length > 8 * 1024 * 1024) {
|
|
665
|
+
logFn('warn', '表情包识别跳过:字节数不合规 ' + buf.length + ' ' + filePath);
|
|
603
666
|
return null;
|
|
667
|
+
}
|
|
604
668
|
const mime = sniffImageMime(buf);
|
|
605
|
-
if (mime == null || mime === 'image/bmp')
|
|
669
|
+
if (mime == null || mime === 'image/bmp') {
|
|
670
|
+
logFn('warn', '表情包识别跳过:认不出图片类型 ' + String(mime) + ' ' + filePath);
|
|
606
671
|
return null; // 附件服务只收 png/jpeg/webp/gif
|
|
607
|
-
|
|
608
|
-
const attachments =
|
|
609
|
-
const agentDefaultModel =
|
|
610
|
-
const llm =
|
|
672
|
+
}
|
|
673
|
+
const attachments = hostService(ctx, 'attachments');
|
|
674
|
+
const agentDefaultModel = hostService(ctx, 'agentDefaultModel');
|
|
675
|
+
const llm = hostService(ctx, 'llm');
|
|
611
676
|
if (attachments == null || llm == null || agentDefaultModel == null) {
|
|
612
677
|
logFn('debug', '表情包识别跳过:宿主缺 attachments/llm/agentDefaultModel');
|
|
613
678
|
return null;
|
|
@@ -623,21 +688,23 @@ export function makeStickerTagger(ctx, { log } = {}) {
|
|
|
623
688
|
}
|
|
624
689
|
let refs;
|
|
625
690
|
try {
|
|
626
|
-
refs = await attachments.saveImages([{ data: buf, name: basename(filePath) }]);
|
|
691
|
+
refs = await attachments.saveImages([{ data: buf, mediaType: mime, name: basename(filePath) }]);
|
|
627
692
|
}
|
|
628
693
|
catch (error) {
|
|
629
694
|
logFn('warn', '表情包识别:图片入库失败 ' + errorText(error));
|
|
630
695
|
return null;
|
|
631
696
|
}
|
|
632
697
|
const ref = isUnknownArray(refs) ? refs[0] : null;
|
|
633
|
-
if (ref == null)
|
|
698
|
+
if (ref == null) {
|
|
699
|
+
logFn('warn', '表情包识别跳过:附件入库没有返回引用 ' + filePath);
|
|
634
700
|
return null;
|
|
701
|
+
}
|
|
635
702
|
const selection = agentDefaultModel.currentSelection();
|
|
636
703
|
const signal = typeof AbortSignal !== 'undefined' && typeof AbortSignal.timeout === 'function'
|
|
637
704
|
? AbortSignal.timeout(90_000)
|
|
638
705
|
: undefined;
|
|
639
706
|
try {
|
|
640
|
-
const call = llm.prepareCall({
|
|
707
|
+
const call = await llm.prepareCall({
|
|
641
708
|
provider: selection.provider,
|
|
642
709
|
model: selection.model,
|
|
643
710
|
maxTokens: 600,
|
|
@@ -659,7 +726,12 @@ export function makeStickerTagger(ctx, { log } = {}) {
|
|
|
659
726
|
assembler.push(chunk);
|
|
660
727
|
const blocks = assembler.blocks();
|
|
661
728
|
const text = blocks.filter((b) => b != null && b.type === 'text').map((b) => String(b.text ?? '')).join('').trim();
|
|
662
|
-
|
|
729
|
+
const parsed = parseTaggingReply(text);
|
|
730
|
+
// 2026-11-19:解析失败以前是静默 null,面板只看到 no-result、日志里啥也没有。
|
|
731
|
+
// 现在把模型原文写进日志(前 400 字),下次一眼能看出是拒答、纯文本还是格式跑偏。
|
|
732
|
+
if (parsed == null)
|
|
733
|
+
logFn('warn', '表情包识别:模型没给出可解析的 JSON(原文 ' + text.length + ' 字): ' + text.slice(0, 400));
|
|
734
|
+
return parsed;
|
|
663
735
|
}
|
|
664
736
|
catch (error) {
|
|
665
737
|
logFn('warn', '表情包识别失败: ' + errorText(error));
|
package/lib/trace.js
CHANGED
|
@@ -103,6 +103,7 @@ export const TRACE_REASONS = {
|
|
|
103
103
|
nasFileTooLarge: 'QQ 文件超过大小上限,已跳过获取',
|
|
104
104
|
nasFileFailed: 'QQ 文件获取失败:无可用来源',
|
|
105
105
|
sttEmpty: '语音转写结果为空',
|
|
106
|
+
sttTimeout: '语音转写超时,按占位符派发',
|
|
106
107
|
transcriptNoChat: '语音转写结果无处投递',
|
|
107
108
|
outboundQueued: '连接断开,回复已排队等待重连补发',
|
|
108
109
|
outboundNotConnected: '连接断开,发送失败',
|
package/lib/types/bridge.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ export declare const QUEUE_NOTICE_TEXT = "\u23F3 \u5F53\u524D\u4EFB\u52A1\u8FD0\
|
|
|
30
30
|
export declare const VOICE_PROB = 0.1;
|
|
31
31
|
export declare const STICKER_PROB = 0.39;
|
|
32
32
|
export declare const VOICE_HINT: string;
|
|
33
|
+
/** 群聊上下文行首的 HH:MM:直接复用 chat.ts 的 formatClock(entry.time 是
|
|
34
|
+
* OneBot event.time,Unix **秒**)。别再本地复制一份——T1 修过的「把秒当毫秒
|
|
35
|
+
* 用、时间显示成 1970 年」那个坑,2026-11-20 就在这里重犯过一次。 */
|
|
33
36
|
/** T2-B2: how long a relayed ask_user_question batch stays interceptable —
|
|
34
37
|
* after this the bridge stops treating plain replies as answers (the host's
|
|
35
38
|
* continued-state question may still be answered from the Web card). */
|
package/lib/types/client.d.ts
CHANGED
|
@@ -109,6 +109,10 @@ interface StickerPanelEvent {
|
|
|
109
109
|
/** 2026-11-19:编辑框改成多行 textarea 后,靠 Ctrl/⌘+Enter 保存。 */
|
|
110
110
|
ctrlKey?: boolean;
|
|
111
111
|
metaKey?: boolean;
|
|
112
|
+
/** 2026-11-19:「新增」弹不出选择器时的备用通道——把图片拖进面板。 */
|
|
113
|
+
dataTransfer?: {
|
|
114
|
+
files?: ArrayLike<unknown> | null;
|
|
115
|
+
} | null;
|
|
112
116
|
preventDefault(): void;
|
|
113
117
|
stopPropagation(): void;
|
|
114
118
|
}
|
package/lib/types/inbound.d.ts
CHANGED
|
@@ -188,6 +188,9 @@ export interface InboundContext {
|
|
|
188
188
|
/** W2-②: default (chatId, message_id) dedup window, aligned with the MIT
|
|
189
189
|
* competitor's dedupWindowSeconds (300s). */
|
|
190
190
|
export declare const DEFAULT_DEDUP_WINDOW_SECONDS = 300;
|
|
191
|
+
/** 2026-11-19:语音转写在派发前最多等这么久(毫秒)。等不到就按 `[语音]`
|
|
192
|
+
* 派发并把晚到的结果丢掉 —— 一条语音只准产生一轮。 */
|
|
193
|
+
export declare const VOICE_TRANSCRIBE_WAIT_MS = 8000;
|
|
191
194
|
/** W2-②: max entries kept in the dedup window map (LRU-evicted beyond this)
|
|
192
195
|
* so a flood of distinct message_ids cannot grow memory unbounded. */
|
|
193
196
|
export declare const DEDUP_MAX_ENTRIES = 4096;
|
|
@@ -239,10 +242,11 @@ export declare class InboundPipeline {
|
|
|
239
242
|
buildBody(text: string, media: MediaRef[], chatId: ChatId): Promise<string>;
|
|
240
243
|
/** Resolve one media ref to a text annotation with a local path. */
|
|
241
244
|
resolveMediaRef(ref: MediaRef, chatId: ChatId): Promise<string>;
|
|
242
|
-
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
|
|
245
|
+
/** 2026-11-19:转写改成在派发前同步等(最多等 VOICE_TRANSCRIBE_WAIT_MS)。
|
|
246
|
+
* 返回『(语音转写:…)』标签,失败/超时/空结果返回 '' —— 调用方退回
|
|
247
|
+
* `[语音]` 占位符。超时后即使转写稍后完成也不再做任何事,所以一条语音
|
|
248
|
+
* 永远只产生一轮。 */
|
|
249
|
+
private transcribeInline;
|
|
246
250
|
/**
|
|
247
251
|
* Expand a quote through get_msg, or reuse its already verified response.
|
|
248
252
|
* @param messageId - quoted OneBot message id.
|
package/lib/types/stickers.d.ts
CHANGED
|
@@ -140,13 +140,22 @@ export declare class StickerStore {
|
|
|
140
140
|
pathOf(item: StickerRecord): string;
|
|
141
141
|
/** 面板列表用:把记录整理成平面数组(不读图片字节)。 */
|
|
142
142
|
list(): StickerItemView[];
|
|
143
|
+
/**
|
|
144
|
+
* 2026-11-19 主人反馈:未审核里出现「裂图」——索引里有条目、磁盘上文件却没了,
|
|
145
|
+
* 面板只知道读图失败,一直显示「…」。打开面板前先清一遍:文件不在就从索引里摘掉。
|
|
146
|
+
*
|
|
147
|
+
* @returns 被摘掉的 hash 列表(空表示索引是干净的)
|
|
148
|
+
*/
|
|
149
|
+
pruneMissing(): string[];
|
|
143
150
|
stats(): StickerStats;
|
|
144
151
|
/** 落一张图进库;返回 { added, item }(同内容已存在时 added=false)。 */
|
|
145
|
-
addBuffer(buf: unknown, name: string, { approved }?: {
|
|
152
|
+
addBuffer(buf: unknown, name: string, { approved, force }?: {
|
|
146
153
|
approved?: boolean;
|
|
154
|
+
force?: boolean;
|
|
147
155
|
}): StickerAddResult;
|
|
148
156
|
addFile(path: string, options?: {
|
|
149
157
|
approved?: boolean;
|
|
158
|
+
force?: boolean;
|
|
150
159
|
}): StickerAddResult;
|
|
151
160
|
itemView(item: StickerRecord): StickerItemView;
|
|
152
161
|
/** 读一帧给面板做缩略图:返回 data URL(超过 maxBytes 直接放弃,别把面板撑爆)。 */
|
package/lib/types/trace.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export declare const TRACE_REASONS: {
|
|
|
71
71
|
readonly nasFileTooLarge: "QQ 文件超过大小上限,已跳过获取";
|
|
72
72
|
readonly nasFileFailed: "QQ 文件获取失败:无可用来源";
|
|
73
73
|
readonly sttEmpty: "语音转写结果为空";
|
|
74
|
+
readonly sttTimeout: "语音转写超时,按占位符派发";
|
|
74
75
|
readonly transcriptNoChat: "语音转写结果无处投递";
|
|
75
76
|
readonly outboundQueued: "连接断开,回复已排队等待重连补发";
|
|
76
77
|
readonly outboundNotConnected: "连接断开,发送失败";
|
package/package.json
CHANGED
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-onebot-genji",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "由 InsaneGenji 维护的 QQ 通道分叉(fork 自 dsh-onebot-qq@0.11.0):在 OneBot 11 / NapCat
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dsh",
|
|
7
|
-
"onebot",
|
|
8
|
-
"onebot11",
|
|
9
|
-
"qq",
|
|
10
|
-
"qq-bot",
|
|
11
|
-
"qqbot",
|
|
12
|
-
"napcat",
|
|
13
|
-
"lagrange",
|
|
14
|
-
"llonebot",
|
|
15
|
-
"go-cqhttp",
|
|
16
|
-
"deepseek",
|
|
17
|
-
"deepseek-harness",
|
|
18
|
-
"harness",
|
|
19
|
-
"bridge",
|
|
20
|
-
"chatbot"
|
|
21
|
-
],
|
|
22
|
-
"private": false,
|
|
23
|
-
"type": "module",
|
|
24
|
-
"main": "lib/index.js",
|
|
25
|
-
"types": "lib/types/index.d.ts",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./lib/types/index.d.ts",
|
|
29
|
-
"default": "./lib/index.js"
|
|
30
|
-
},
|
|
31
|
-
"./client": "./lib/client.js",
|
|
32
|
-
"./settings-remote": "./lib/settings-remote.js",
|
|
33
|
-
"./package.json": "./package.json"
|
|
34
|
-
},
|
|
35
|
-
"files": [
|
|
36
|
-
"lib",
|
|
37
|
-
"!lib/*.bak-*",
|
|
38
|
-
"cordis.patch.yml"
|
|
39
|
-
],
|
|
40
|
-
"license": "BSD-3-Clause",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/InsaneGenji/dsh-onebot-genji.git"
|
|
44
|
-
},
|
|
45
|
-
"homepage": "https://github.com/InsaneGenji/dsh-onebot-genji#readme",
|
|
46
|
-
"bugs": {
|
|
47
|
-
"url": "https://github.com/InsaneGenji/dsh-onebot-genji/issues"
|
|
48
|
-
},
|
|
49
|
-
"engines": {
|
|
50
|
-
"dsh": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-0 <0.3.0-0 || >=0.2.2-0 <0.2.3-0",
|
|
51
|
-
"node": ">=22"
|
|
52
|
-
},
|
|
53
|
-
"dsh": {
|
|
54
|
-
"bundle": {
|
|
55
|
-
"patch": "./cordis.patch.yml"
|
|
56
|
-
},
|
|
57
|
-
"client": {
|
|
58
|
-
"platform": "web"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"dshx": {
|
|
62
|
-
"contributes": {
|
|
63
|
-
"tools": [
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"@deepseek-ai/
|
|
78
|
-
"@deepseek-ai/dsh-
|
|
79
|
-
"@deepseek-ai/dsh-
|
|
80
|
-
"@deepseek-ai/dsh-
|
|
81
|
-
"@deepseek-ai/dsh-
|
|
82
|
-
"@deepseek-ai/dsh-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/
|
|
85
|
-
"schemastery": "^3.18.0"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"@types/
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"verify:
|
|
109
|
-
|
|
110
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-onebot-genji",
|
|
3
|
+
"version": "0.15.2",
|
|
4
|
+
"description": "由 InsaneGenji 维护的 QQ 通道分叉(fork 自 dsh-onebot-qq@0.11.0):在 OneBot 11 / NapCat 通道基础上加了表情包库(未审核/已审核、模型看图写标签、重新识别)、主动搭话、回合形式掷骰(语音条、表情包概率)、双发闸、正文气泡切分、群聊上下文与自带语音转写桥。仓库 github.com/InsaneGenji/dsh-onebot-genji,上游 github.com/mario841859784/dsh-onebot .",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"onebot",
|
|
8
|
+
"onebot11",
|
|
9
|
+
"qq",
|
|
10
|
+
"qq-bot",
|
|
11
|
+
"qqbot",
|
|
12
|
+
"napcat",
|
|
13
|
+
"lagrange",
|
|
14
|
+
"llonebot",
|
|
15
|
+
"go-cqhttp",
|
|
16
|
+
"deepseek",
|
|
17
|
+
"deepseek-harness",
|
|
18
|
+
"harness",
|
|
19
|
+
"bridge",
|
|
20
|
+
"chatbot"
|
|
21
|
+
],
|
|
22
|
+
"private": false,
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "lib/index.js",
|
|
25
|
+
"types": "lib/types/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./lib/types/index.d.ts",
|
|
29
|
+
"default": "./lib/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./client": "./lib/client.js",
|
|
32
|
+
"./settings-remote": "./lib/settings-remote.js",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"lib",
|
|
37
|
+
"!lib/*.bak-*",
|
|
38
|
+
"cordis.patch.yml"
|
|
39
|
+
],
|
|
40
|
+
"license": "BSD-3-Clause",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/InsaneGenji/dsh-onebot-genji.git"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/InsaneGenji/dsh-onebot-genji#readme",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/InsaneGenji/dsh-onebot-genji/issues"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"dsh": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0 || >=0.2.1-0 <0.3.0-0 || >=0.2.2-0 <0.2.3-0",
|
|
51
|
+
"node": ">=22"
|
|
52
|
+
},
|
|
53
|
+
"dsh": {
|
|
54
|
+
"bundle": {
|
|
55
|
+
"patch": "./cordis.patch.yml"
|
|
56
|
+
},
|
|
57
|
+
"client": {
|
|
58
|
+
"platform": "web"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"dshx": {
|
|
62
|
+
"contributes": {
|
|
63
|
+
"tools": [
|
|
64
|
+
"qq_send_text",
|
|
65
|
+
"qq_send_image",
|
|
66
|
+
"qq_send_voice",
|
|
67
|
+
"qq_send_video",
|
|
68
|
+
"qq_send_file",
|
|
69
|
+
"qq_send_forward",
|
|
70
|
+
"qq_napcat_api",
|
|
71
|
+
"qq_group_history"
|
|
72
|
+
],
|
|
73
|
+
"skills": []
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
78
|
+
"@deepseek-ai/dsh-agent": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0 || >=0.2.2-0 <0.2.3-0",
|
|
79
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
80
|
+
"@deepseek-ai/dsh-session": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
81
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
82
|
+
"@deepseek-ai/dsh-tools": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
83
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
84
|
+
"@deepseek-ai/dsh-util-values": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-alpha.1 <0.1.7-0 || >=0.1.7-alpha.1 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
85
|
+
"@deepseek-ai/schemastery": "^3.18.0 || >=3.18.6-alpha.1 <3.19.0-0",
|
|
86
|
+
"schemastery": "^3.18.0"
|
|
87
|
+
},
|
|
88
|
+
"dependencies": {
|
|
89
|
+
"@napi-rs/canvas": "^1.0.6",
|
|
90
|
+
"fontkit": "^2.0.4",
|
|
91
|
+
"schemastery": "^3.18.0",
|
|
92
|
+
"silk-wasm": "^3.7.1",
|
|
93
|
+
"ws": "^8.18.0"
|
|
94
|
+
},
|
|
95
|
+
"optionalDependencies": {
|
|
96
|
+
"gifuct-js": "^2.1.2"
|
|
97
|
+
},
|
|
98
|
+
"devDependencies": {
|
|
99
|
+
"@types/node": "^24.0.0",
|
|
100
|
+
"@types/ws": "^8.5.12",
|
|
101
|
+
"typescript": "^5.9.0",
|
|
102
|
+
"vitest": "^3.2.0"
|
|
103
|
+
},
|
|
104
|
+
"scripts": {
|
|
105
|
+
"build": "./scripts/build.sh",
|
|
106
|
+
"test": "vitest run",
|
|
107
|
+
"replay": "node scripts/replay.mjs",
|
|
108
|
+
"verify:injected-context": "node scripts/verify-injected-context.mjs",
|
|
109
|
+
"verify:lan-management": "node scripts/verify-lan-management.mjs"
|
|
110
|
+
}
|
|
111
|
+
}
|