dsh-onebot-genji 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bridge.js +9 -140
- package/lib/client.js +125 -117
- package/lib/inbound.js +4 -36
- package/lib/index.js +5 -2
- package/lib/interim.js +1 -10
- package/lib/outbound.js +7 -15
- package/lib/prompt.js +2 -0
- package/lib/settings-remote.js +11 -6
- package/lib/split.js +0 -50
- package/lib/tools.js +0 -2
- package/lib/types/bridge.d.ts +2 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +110 -110
package/lib/client.js
CHANGED
|
@@ -118,7 +118,7 @@ window.__ModuleLoader__.load({
|
|
|
118
118
|
fields: [
|
|
119
119
|
{ key: "mode", label: "连接模式", type: "enum", options: ["reverse", "forward"], optionLabels: { reverse: "反向 WebSocket(NapCat 连接本插件)", forward: "正向 WebSocket(插件连接 NapCat)" }, hint: "反向=它连我,正向=我连它" },
|
|
120
120
|
{ key: "host", label: "反向 WS 监听地址", showIf: { key: "mode", value: "reverse" }, type: "string", hint: "反向模式监听地址" },
|
|
121
|
-
{ key: "port", label: "反向 WS 监听端口", showIf: { key: "mode", value: "reverse" }, type: "number", hint: "反向模式监听端口" },
|
|
121
|
+
{ key: "port", label: "反向 WS 监听端口", showIf: { key: "mode", value: "reverse" }, type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", hint: "反向模式监听端口" },
|
|
122
122
|
{ key: "url", label: "正向 WS 服务器地址", showIf: { key: "mode", value: "forward" }, type: "string", hint: "正向模式服务器地址" },
|
|
123
123
|
{ key: "accessToken", label: "访问令牌(AccessToken)", type: "secret" },
|
|
124
124
|
{ key: "botQQ", label: "机器人 QQ 号", type: "string" },
|
|
@@ -129,28 +129,22 @@ window.__ModuleLoader__.load({
|
|
|
129
129
|
title: "权限",
|
|
130
130
|
// 本地加:权限分「私聊 / 群聊」两块展示(id = 分区词条键尾段;客户端展示结构,host 契约不涉)。
|
|
131
131
|
sections: [
|
|
132
|
-
{ id: "
|
|
133
|
-
{ id: "
|
|
134
|
-
{ id: "
|
|
132
|
+
{ id: "common", title: "通用", keys: ["adminUsers", "sensitivePatterns"] },
|
|
133
|
+
{ id: "dm", title: "私聊", keys: ["dmPolicy", "allowFrom"] },
|
|
134
|
+
{ id: "group", title: "群聊", keys: ["groupPolicy", "groupAllowFrom", "memberTools", "groupContextLines", "wakeNamesAdmin", "requireMention", "pokeEnabled", "atAllCountsAsMention"] },
|
|
135
135
|
],
|
|
136
136
|
fields: [
|
|
137
137
|
{ key: "requireMention", label: "群聊必须 @ 机器人", type: "boolean" },
|
|
138
138
|
{ key: "memberTools", label: "成员工具权限", type: "enum", options: ["none", "send", "all"], optionLabels: { none: "禁用全部", send: "仅发送类", all: "不限" }, hint: "非管理员回合可用的 qq_* 工具:仅发送类=可分条/发图(含工作区图库)" },
|
|
139
139
|
{ key: "adminUsers", label: "管理员用户列表", type: "stringArray" },
|
|
140
|
-
{ key: "dmPolicy", label: "私聊策略", type: "enum", options: ["open", "allowlist", "disabled"], optionLabels: { open: "开放", allowlist: "白名单", disabled: "禁用" } },
|
|
140
|
+
{ key: "dmPolicy", label: "私聊策略", type: "enum", options: ["open", "allowlist", "disabled"], optionLabels: { open: "开放", allowlist: "白名单", disabled: "禁用" }, hint: "开放=任何人都能私聊;白名单=只有下面名单里的 QQ 号能私聊;禁用=谁都不理" },
|
|
141
141
|
{ key: "groupPolicy", label: "群聊策略", type: "enum", options: ["open", "allowlist", "disabled"], optionLabels: { open: "开放", allowlist: "白名单", disabled: "禁用" } },
|
|
142
|
-
{ key: "
|
|
143
|
-
{ key: "
|
|
144
|
-
{ key: "
|
|
145
|
-
{ key: "wakeNamesAdmin", label: "用户唤醒词", type: "stringArray" },
|
|
146
|
-
{ key: "wakeNamesMember", label: "他人唤醒词", type: "stringArray" },
|
|
147
|
-
{ key: "replyCountsAsMention", label: "被引用唤醒", type: "boolean", hint: "引用别人的消息也算叫我" },
|
|
142
|
+
{ key: "allowFrom", label: "私聊白名单", showIf: { key: "dmPolicy", value: "allowlist" }, type: "stringArray" },
|
|
143
|
+
{ key: "groupAllowFrom", label: "群聊白名单", showIf: { key: "groupPolicy", value: "allowlist" }, type: "stringArray" },
|
|
144
|
+
{ key: "wakeNamesAdmin", label: "唤醒词", type: "stringArray", hint: "群里任何人说了这些词就当我被叫到" },
|
|
148
145
|
{ key: "atAllCountsAsMention", label: "@全体唤醒", type: "boolean", hint: "@全体成员也算叫我" },
|
|
149
|
-
{ key: "reactionOnMention", label: "@ 表情回执", type: "boolean", hint: "群里被显式 @ 后,回合启动时给那条消息贴表情回执(已收到回执);仅 NapCat/SnowLuma 支持,其他实现静默跳过" },
|
|
150
|
-
{ key: "reactionEmoji", label: "回执表情 ID", type: "number", hint: "表情回执用的表情 ID,默认 178(微笑)" },
|
|
151
|
-
{ key: "faceStyle", label: "QQ 表情呈现方式", type: "enum", options: ["name", "emoji"], optionLabels: { name: "官方表情表", emoji: "emoji 近似(旧观感)" }, hint: "表情名或 emoji 近似" },
|
|
152
146
|
{ key: "pokeEnabled", label: "戳一戳叫醒", type: "boolean" },
|
|
153
|
-
{ key: "
|
|
147
|
+
{ key: "groupContextLines", label: "参考上下文条数", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", hint: "被 @ 或叫到唤醒词时先带上群里最近这么多条消息;0 = 不参考" },
|
|
154
148
|
{ key: "sensitivePatterns", label: "出站敏感词正则", type: "stringArray", placeholder: "正则,一行一个;留空用内置" },
|
|
155
149
|
],
|
|
156
150
|
},
|
|
@@ -158,60 +152,42 @@ window.__ModuleLoader__.load({
|
|
|
158
152
|
id: "behavior",
|
|
159
153
|
title: "行为",
|
|
160
154
|
fields: [
|
|
161
|
-
|
|
162
|
-
{ key: "
|
|
163
|
-
{ key: "interimRecallMs", label: "中间消息保留时长(毫秒)", showIf: { key: "interimRecall", value: true }, type: "number" },
|
|
164
|
-
{ key: "sendErrorNotice", label: "发送错误通知", type: "boolean" },
|
|
155
|
+
// T7 转正:入站连发合并(开关默认关;合并窗口 600ms,首条起最多 3000ms 封顶)。
|
|
156
|
+
{ key: "rateLimitPerMinute", label: "每分钟消息频率上限", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
165
157
|
{ key: "unknownCommand", label: "未知命令处理", type: "enum", options: ["intercept", "passthrough"], optionLabels: { intercept: "拦截", passthrough: "透传" } },
|
|
166
|
-
{ key: "rateLimitPerMinute", label: "每分钟消息频率上限", type: "number" },
|
|
167
158
|
{ key: "newMessagePolicy", label: "任务运行中的新消息", type: "enum", options: ["queue", "steer"], optionLabels: { queue: "排队", steer: "插话" } },
|
|
168
159
|
{ key: "autoSteerPolicy", label: "自动插话资格", showIf: { key: "newMessagePolicy", value: "steer" }, type: "enum", options: ["admin", "all"], optionLabels: { admin: "仅管理员", all: "所有成员" } },
|
|
169
|
-
{ key: "deferredTimeoutMs", label: "等待模型回复超时(毫秒)", type: "number" },
|
|
170
|
-
// T7 转正:入站连发合并(开关默认关;合并窗口 600ms,首条起最多 3000ms 封顶)。
|
|
171
160
|
{ key: "inboxQueueEnabled", label: "入站连发合并", type: "boolean", hint: "同会话连发的多条消息合成一条投递" },
|
|
172
|
-
{ key: "inboxQueueDelayMs", label: "合并等待窗口(毫秒)", type: "number", hint: "每条消息先等一个窗口再投递;0 = 立即", showIf: { key: "inboxQueueEnabled", value: true } },
|
|
173
|
-
|
|
174
|
-
{ key: "
|
|
175
|
-
{ key: "
|
|
161
|
+
{ key: "inboxQueueDelayMs", label: "合并等待窗口(毫秒)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", hint: "每条消息先等一个窗口再投递;0 = 立即", showIf: { key: "inboxQueueEnabled", value: true } },
|
|
162
|
+
{ key: "interimMessages", label: "中间消息", type: "boolean", hint: "回合中发中间消息" },
|
|
163
|
+
{ key: "interimRecall", label: "自动撤回中间消息", showIf: { key: "interimMessages", value: true }, type: "boolean" },
|
|
164
|
+
{ key: "interimRecallMs", label: "中间消息保留时长(毫秒)", showIf: { key: "interimRecall", value: true }, type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
165
|
+
{ key: "sendErrorNotice", label: "发送错误通知", type: "boolean" },
|
|
166
|
+
{ key: "deferredTimeoutMs", label: "等待模型回复超时(毫秒)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
176
167
|
// T11:DSH 首页左侧边栏入口开关(关=不注册侧边栏入口与配对面板;
|
|
177
168
|
// 插件菜单下的设置页入口保留。客户端按启动时快照决定,改完刷新生效)。
|
|
178
|
-
{ key: "sidebarEntryEnabled", label: "首页侧边栏入口", type: "boolean", hint: "在 DSH 首页左侧边栏显示「QQ Bot」入口;改动需刷新页面生效" },
|
|
179
|
-
],
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
id: "bystander",
|
|
183
|
-
title: "旁观",
|
|
184
|
-
fields: [
|
|
185
|
-
{ key: "bystanderEnabled", label: "群聊旁观", type: "boolean", hint: "未被 @ 的群消息进旁听缓冲,命中触发条件时插一次话" },
|
|
186
|
-
{ key: "bystanderCapacity", label: "旁听缓冲条数", type: "number", showIf: { key: "bystanderEnabled", value: true } },
|
|
187
|
-
{ key: "bystanderCooldownMinutes", label: "回顾间隔(分钟)", type: "number", showIf: { key: "bystanderEnabled", value: true } },
|
|
188
|
-
{ key: "bystanderDailyLimit", label: "每日回顾上限", type: "number", showIf: { key: "bystanderEnabled", value: true } },
|
|
189
|
-
{ key: "bystanderTopics", label: "话题词表", type: "stringArray", showIf: { key: "bystanderEnabled", value: true }, placeholder: "一行一个词" },
|
|
190
169
|
],
|
|
191
170
|
},
|
|
192
171
|
{
|
|
193
172
|
id: "session",
|
|
194
173
|
title: "会话",
|
|
195
174
|
fields: [
|
|
196
|
-
{ key: "newSessionGreeting", label: "新会话主动开口", type: "boolean", hint: "/new 后我先说一句" },
|
|
197
|
-
{ key: "firstMessageAsUser", label: "首条按 User 注入", type: "boolean", hint: "开了宿主才会按第一条消息自动命名(默认关)" },
|
|
198
|
-
{ key: "memoryFilesEnabled", label: "新会话读记忆文件", type: "boolean" },
|
|
199
|
-
{ key: "memoryFiles", label: "记忆文件路径", type: "stringArray", placeholder: "文件绝对路径;分割方式:逗号、顿号、换行", showIf: { key: "memoryFilesEnabled", value: true } },
|
|
200
|
-
{ key: "agentPreset", label: "新会话智能体预设(填预设 id,如 standard;留空用宿主默认)", type: "string", placeholder: "standard" },
|
|
201
175
|
// W7:workspacePath 入面板(0.10.0 重排入会话组)。语义(对齐 README「会话工作区选择」):
|
|
202
176
|
// 修改只对新会话生效;已设 per-chat /workspace 覆盖的会话不受影响。
|
|
203
|
-
{ key: "workspacePath", label: "私聊默认工作区路径", type: "string", hint: "私聊新会话的默认目录" },
|
|
204
|
-
{ key: "groupWorkspacePath", label: "群聊默认工作区路径", type: "string", hint: "群聊新会话的默认目录;留空则同私聊" },
|
|
205
|
-
// T8:forceSessionId 入面板(host SETTINGS_GROUPS session 组列出,默认 '')。
|
|
206
|
-
{ key: "forceSessionId", label: "强制会话 ID", type: "string", hint: "填了就固定用这个会话 id(高级用法,一般留空)" },
|
|
207
177
|
// 本地加(2026-10-30):提示词走文件,不塞进 yml——两段各一万多字,块写法容易被手改花。
|
|
208
178
|
// 语义:路径填了且读得到就用文件内容当 dmPrompt/groupPrompt(每行左侧空白全删),
|
|
209
179
|
// 读不到或留空就退回 yml 里的内联文本;改完文件要保存一次让插件重启才生效。
|
|
210
|
-
{ key: "dmPromptFile", label: "私聊提示词文件(txt 路径)", type: "string", placeholder: "~/.dsh/onebot/prompts/dm.txt" },
|
|
211
|
-
{ key: "groupPromptFile", label: "群聊提示词文件(txt 路径)", type: "string", placeholder: "~/.dsh/onebot/prompts/group.txt" },
|
|
212
180
|
// #61 建议 2:启动恢复会话开关(默认开 = 既有启动 resume 行为;关 =
|
|
213
181
|
// 每次重启都开全新会话,旧会话记录与日志保留不动)。
|
|
182
|
+
{ key: "titleSyncEnabled", label: "会话自动重命名", type: "boolean", hint: "私聊按「昵称(QQ号)」,群聊按「群名(群号)」" },
|
|
214
183
|
{ key: "startupResumeEnabled", label: "启动恢复会话", type: "boolean", hint: "启动时按上次会话记录接回各聊天的原会话;关掉后每次重启都开全新会话(旧会话记录与日志保留不动);改动重启插件后生效" },
|
|
184
|
+
{ key: "newSessionGreeting", label: "新会话主动开口", type: "boolean", hint: "/new 后我先说一句" },
|
|
185
|
+
{ key: "memoryFilesEnabled", label: "新会话读记忆文件", type: "boolean" },
|
|
186
|
+
{ key: "memoryFiles", label: "记忆文件路径", type: "stringArray", placeholder: "文件绝对路径;分割方式:逗号、顿号、换行", showIf: { key: "memoryFilesEnabled", value: true } },
|
|
187
|
+
{ key: "workspacePath", label: "私聊默认工作区路径", type: "string", hint: "私聊新会话的默认目录" },
|
|
188
|
+
{ key: "dmPromptFile", label: "私聊提示词文件(txt 路径)", type: "string", placeholder: "~/.dsh/onebot/prompts/dm.txt" },
|
|
189
|
+
{ key: "groupWorkspacePath", label: "群聊默认工作区路径", type: "string", hint: "群聊新会话的默认目录;留空则同私聊" },
|
|
190
|
+
{ key: "groupPromptFile", label: "群聊提示词文件(txt 路径)", type: "string", placeholder: "~/.dsh/onebot/prompts/group.txt" },
|
|
215
191
|
],
|
|
216
192
|
},
|
|
217
193
|
{
|
|
@@ -224,15 +200,15 @@ window.__ModuleLoader__.load({
|
|
|
224
200
|
{ key: "sttArgs", label: "转写参数模板", type: "stringArray", placeholder: "一行一个;{file} 和 {out} 会被替换;留空 = 用内置模板", showIf: { key: "sttEngine", value: "custom" } },
|
|
225
201
|
{ key: "sttModel", label: "转写模型", type: "string", hint: "openai / 内置桥: small/base/medium…;whisper.cpp: 模型名或 .bin 路径", showIf: { key: "sttEngine", values: ["openai", "custom"] } },
|
|
226
202
|
{ key: "textImageEnabled", label: "长文转图片卡片", type: "boolean" },
|
|
227
|
-
{ key: "textImageThreshold", label: "转卡片的字数阈值", showIf: { key: "textImageEnabled", value: true }, type: "number", placeholder: "0–10000;0 = 不转卡片" },
|
|
203
|
+
{ key: "textImageThreshold", label: "转卡片的字数阈值", showIf: { key: "textImageEnabled", value: true }, type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "0–10000;0 = 不转卡片" },
|
|
228
204
|
{ key: "cardFooter", label: "卡片页脚角标", type: "string", placeholder: "OneBot" },
|
|
229
205
|
{ key: "fontFiles", label: "卡片字体文件", type: "stringArray", placeholder: "一行一个字体文件路径(ttf/otf);留空用系统字体" },
|
|
230
206
|
{ key: "fontFamilies", label: "卡片字体家族名", type: "stringArray", placeholder: "一行一个字体家族名;留空用平台默认" },
|
|
231
|
-
{ key: "outboundImageMaxBytes", label: "出站图片大小上限(字节)", type: "number", placeholder: "默认 8388608(8MB);最高 104857600(100MB)" },
|
|
232
|
-
{ key: "maxVoiceBytes", label: "出站语音大小上限(字节)", type: "number", placeholder: "默认 15728640(15MB);最高 52428800(50MB)" },
|
|
233
|
-
{ key: "maxFileBytes", label: "出站文件/视频大小上限(字节)", type: "number", placeholder: "默认 20971520(20MB);最高 4294967296(4G)" },
|
|
234
|
-
{ key: "inboundImageMaxPx", label: "入站图片长边上限(像素)", type: "number", placeholder: "默认 2048;推荐 1440 以上" },
|
|
235
|
-
{ key: "inboundFileMaxBytes", label: "入站文件大小上限(字节)", type: "number", placeholder: "默认 20971520(20MB);0 = 不限" },
|
|
207
|
+
{ key: "outboundImageMaxBytes", label: "出站图片大小上限(字节)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "默认 8388608(8MB);最高 104857600(100MB)" },
|
|
208
|
+
{ key: "maxVoiceBytes", label: "出站语音大小上限(字节)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "默认 15728640(15MB);最高 52428800(50MB)" },
|
|
209
|
+
{ key: "maxFileBytes", label: "出站文件/视频大小上限(字节)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "默认 20971520(20MB);最高 4294967296(4G)" },
|
|
210
|
+
{ key: "inboundImageMaxPx", label: "入站图片长边上限(像素)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "默认 2048;推荐 1440 以上" },
|
|
211
|
+
{ key: "inboundFileMaxBytes", label: "入站文件大小上限(字节)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", placeholder: "默认 20971520(20MB);0 = 不限" },
|
|
236
212
|
// T6 转正:GIF 分帧(默认关;关闭时不装依赖也不触碰 FS)。
|
|
237
213
|
{ key: "gifFramesEnabled", label: "GIF 动图分帧", type: "boolean", hint: "收到 GIF 时在消息旁附一张抽 4 帧的纵向长图,让模型看懂动画过程(默认关)" },
|
|
238
214
|
// 本地加(2026-11-01):NapCat 文件服务/反代在本机或内网时,下载检查得放行。
|
|
@@ -274,6 +250,7 @@ window.__ModuleLoader__.load({
|
|
|
274
250
|
forceSessionId: "",
|
|
275
251
|
dmPromptFile: "", // T4 拍板默认关(贡献者默认 ~/.dsh 路径不收)
|
|
276
252
|
groupPromptFile: "", // 同上
|
|
253
|
+
groupContextLines: 0, // 本地加(2026-11-18):被 @ 时带上的群聊上下文条数
|
|
277
254
|
requireMention: true,
|
|
278
255
|
memberTools: "none",
|
|
279
256
|
bystanderEnabled: false,
|
|
@@ -285,14 +262,14 @@ window.__ModuleLoader__.load({
|
|
|
285
262
|
dmPolicy: "open",
|
|
286
263
|
groupPolicy: "open",
|
|
287
264
|
allowAllUsers: false,
|
|
265
|
+
sidebarEntryEnabled: true,
|
|
266
|
+
titleSyncEnabled: true,
|
|
288
267
|
allowFrom: [],
|
|
289
268
|
groupAllowFrom: [],
|
|
290
269
|
wakeNamesAdmin: [],
|
|
291
270
|
wakeNamesMember: [],
|
|
292
271
|
replyCountsAsMention: false,
|
|
293
272
|
atAllCountsAsMention: false,
|
|
294
|
-
reactionOnMention: false,
|
|
295
|
-
reactionEmoji: 178,
|
|
296
273
|
faceStyle: "name",
|
|
297
274
|
pokeEnabled: true,
|
|
298
275
|
interimMessages: true,
|
|
@@ -312,7 +289,6 @@ window.__ModuleLoader__.load({
|
|
|
312
289
|
memoryFiles: [],
|
|
313
290
|
ignoreSelf: true,
|
|
314
291
|
// T11:侧边栏入口开关(用户裁定默认开)。
|
|
315
|
-
sidebarEntryEnabled: true,
|
|
316
292
|
sttEnabled: true,
|
|
317
293
|
agentPreset: "",
|
|
318
294
|
chatIdleEvictDays: 7,
|
|
@@ -345,7 +321,6 @@ window.__ModuleLoader__.load({
|
|
|
345
321
|
inboxQueueEnabled: false,
|
|
346
322
|
inboxQueueDelayMs: 600,
|
|
347
323
|
// T24:QQ 会话标题同步开关(默认关)。
|
|
348
|
-
titleSyncEnabled: false,
|
|
349
324
|
};
|
|
350
325
|
// T8:notices 通知开关补上面板。值可以是 false=不发 / true=默认文案 /
|
|
351
326
|
// 字符串=自定义文案。5 键对齐 src/settings-remote.ts NOTICE_KEYS(本仓
|
|
@@ -496,6 +471,7 @@ window.__ModuleLoader__.load({
|
|
|
496
471
|
forceSessionId: vString(0, 256),
|
|
497
472
|
dmPromptFile: vString(0, 1024),
|
|
498
473
|
groupPromptFile: vString(0, 1024),
|
|
474
|
+
groupContextLines: vNumber(),
|
|
499
475
|
requireMention: vBoolean(),
|
|
500
476
|
memberTools: vEnum(["none", "send", "all"]),
|
|
501
477
|
bystanderEnabled: vBoolean(),
|
|
@@ -513,8 +489,6 @@ window.__ModuleLoader__.load({
|
|
|
513
489
|
wakeNamesMember: vArray(vString(0, 64)),
|
|
514
490
|
replyCountsAsMention: vBoolean(),
|
|
515
491
|
atAllCountsAsMention: vBoolean(),
|
|
516
|
-
reactionOnMention: vBoolean(),
|
|
517
|
-
reactionEmoji: vNumber(),
|
|
518
492
|
faceStyle: vEnum(["name", "emoji"]),
|
|
519
493
|
pokeEnabled: vBoolean(),
|
|
520
494
|
interimMessages: vBoolean(),
|
|
@@ -625,8 +599,6 @@ window.__ModuleLoader__.load({
|
|
|
625
599
|
wakeNamesMember: vOptional(vArray(vString(0, 64))),
|
|
626
600
|
replyCountsAsMention: vOptional(vBoolean()),
|
|
627
601
|
atAllCountsAsMention: vOptional(vBoolean()),
|
|
628
|
-
reactionOnMention: vOptional(vBoolean()),
|
|
629
|
-
reactionEmoji: vOptional(vNumber(0)),
|
|
630
602
|
faceStyle: vOptional(vEnum(["name", "emoji"])),
|
|
631
603
|
pokeEnabled: vOptional(vBoolean()),
|
|
632
604
|
restrictedMemberPrefix: vOptional(vBoolean()),
|
|
@@ -766,7 +738,7 @@ window.__ModuleLoader__.load({
|
|
|
766
738
|
// zh/en 同批齐平;既有键文案不改)。
|
|
767
739
|
"conflict.kept": "已保留 {count} 项未冲突的修改,请核对后重新保存。",
|
|
768
740
|
"conflict.secretCleared": "accessToken 输入已清空,如需修改请重新输入。",
|
|
769
|
-
"field.numberInvalid": "必须是 {range}
|
|
741
|
+
"field.numberInvalid": "必须是 {range}",
|
|
770
742
|
"field.remoteOverwritten": "已被其他来源修改,已同步为最新值",
|
|
771
743
|
// T11:首页左侧边栏入口词条(sidebar.panellist 的 label;en 同批齐平)。
|
|
772
744
|
"sidebar.panel": "QQ Bot",
|
|
@@ -824,7 +796,7 @@ window.__ModuleLoader__.load({
|
|
|
824
796
|
// 批 3(UX §5.4/§5.6):与 zh 同批新增的 4 键(冲突合并保留 + 数字行内校验)。
|
|
825
797
|
"conflict.kept": "Kept {count} non-conflicting change(s) — review and save again.",
|
|
826
798
|
"conflict.secretCleared": "The accessToken input has been cleared; re-enter it if you still want to change it.",
|
|
827
|
-
"field.numberInvalid": "Must be
|
|
799
|
+
"field.numberInvalid": "Must be {range}",
|
|
828
800
|
"field.remoteOverwritten": "Changed by another source — synced to the latest value",
|
|
829
801
|
"sidebar.panel": "QQ Bot",
|
|
830
802
|
// 0.10.0 字段文案词条化:与 zh 同批的面板自有 UI 串。
|
|
@@ -896,15 +868,10 @@ window.__ModuleLoader__.load({
|
|
|
896
868
|
allowAllUsers: { label: "Allow all users" },
|
|
897
869
|
allowFrom: { label: "DM allowlist" },
|
|
898
870
|
groupAllowFrom: { label: "Group allowlist" },
|
|
899
|
-
wakeNamesAdmin: { label: "
|
|
900
|
-
wakeNamesMember: { label: "Member wake names" },
|
|
901
|
-
replyCountsAsMention: { label: "Quoted-message wakes", hint: "Quoting someone else's message also wakes me" },
|
|
871
|
+
wakeNamesAdmin: { label: "Wake names", hint: "Anyone in the group saying one of these counts as calling the bot" },
|
|
902
872
|
atAllCountsAsMention: { label: "@-all wakes", hint: "@-ing everyone also counts as a wake" },
|
|
903
|
-
reactionOnMention: { label: "@ reaction receipt", hint: "After an explicit @ in a group chat, attach an emoji reaction to that message when the turn starts (acknowledged receipt); NapCat/SnowLuma only, silently skipped elsewhere" },
|
|
904
|
-
reactionEmoji: { label: "Reaction emoji ID", hint: "Emoji ID for the reaction receipt, default 178 (smile)" },
|
|
905
|
-
faceStyle: { label: "QQ face rendering", hint: "Face names or emoji approximation", options: { name: "Official face table", emoji: "Emoji approximation (legacy look)" } },
|
|
906
873
|
pokeEnabled: { label: "Poke wakes" },
|
|
907
|
-
|
|
874
|
+
groupContextLines: { label: "Group context lines", hint: "Include the last N group messages when @-mentioned; 0 = off" },
|
|
908
875
|
sensitivePatterns: { label: "Outbound sensitive-word regexes", placeholder: "One regex per line; empty = built-in list" },
|
|
909
876
|
},
|
|
910
877
|
},
|
|
@@ -922,33 +889,18 @@ window.__ModuleLoader__.load({
|
|
|
922
889
|
deferredTimeoutMs: { label: "Model reply wait timeout (ms)" },
|
|
923
890
|
inboxQueueEnabled: { label: "Inbound burst merging", hint: "Merge several messages burst-sent to one session into a single delivery" },
|
|
924
891
|
inboxQueueDelayMs: { label: "Merge wait window (ms)", hint: "Each message waits one window before delivery; 0 = immediately" },
|
|
925
|
-
titleSyncEnabled: { label: "QQ session title sync", hint: "Let the host refresh session titles after each message (one small LLM call); titles you named manually in the host are never overwritten" },
|
|
926
|
-
ignoreSelf: { label: "Ignore own messages", hint: "Do not process the bot's own echo messages" },
|
|
927
|
-
sidebarEntryEnabled: { label: "Home sidebar entry", hint: "Show a \"QQ Bot\" entry in the DSH home sidebar; changes apply after a page reload" },
|
|
928
|
-
},
|
|
929
|
-
},
|
|
930
|
-
bystander: {
|
|
931
|
-
title: "Lurk",
|
|
932
|
-
fields: {
|
|
933
|
-
bystanderEnabled: { label: "Group lurking", hint: "Un-@ed group messages feed a per-group buffer; triggers open one review turn" },
|
|
934
|
-
bystanderCapacity: { label: "Buffer size (entries)" },
|
|
935
|
-
bystanderCooldownMinutes: { label: "Review cooldown (minutes)" },
|
|
936
|
-
bystanderDailyLimit: { label: "Daily review cap" },
|
|
937
|
-
bystanderTopics: { label: "Topic keywords", placeholder: "One keyword per line" },
|
|
938
892
|
},
|
|
939
893
|
},
|
|
940
894
|
session: {
|
|
941
895
|
title: "Session",
|
|
942
896
|
fields: {
|
|
943
897
|
newSessionGreeting: { label: "Greet on new sessions", hint: "After /new I say hello first" },
|
|
944
|
-
|
|
898
|
+
titleSyncEnabled: { label: "Auto-rename sessions", hint: "DM: nickname (QQ number); group: group name (group number)" },
|
|
945
899
|
startupResumeEnabled: { label: "Resume sessions on startup", hint: "Rejoin each chat's last session on startup; off = every restart starts brand-new sessions (old mappings and logs are left untouched); changes apply after a plugin restart" },
|
|
946
900
|
memoryFilesEnabled: { label: "Read memory files on new sessions" },
|
|
947
901
|
memoryFiles: { label: "Memory file paths", placeholder: "Absolute file paths; split by comma, enumeration comma, or newline" },
|
|
948
|
-
agentPreset: { label: "Agent preset for new sessions (preset id, e.g. standard; empty = host default)", placeholder: "standard" },
|
|
949
902
|
workspacePath: { label: "Default DM workspace path", hint: "Default directory for new DM sessions" },
|
|
950
903
|
groupWorkspacePath: { label: "Default group workspace path", hint: "Default directory for new group sessions; empty = same as DM" },
|
|
951
|
-
forceSessionId: { label: "Force session id", hint: "When set, always use this session id (advanced; usually left empty)" },
|
|
952
904
|
dmPromptFile: { label: "DM prompt file (txt path)" },
|
|
953
905
|
groupPromptFile: { label: "Group prompt file (txt path)" },
|
|
954
906
|
},
|
|
@@ -1072,9 +1024,9 @@ window.__ModuleLoader__.load({
|
|
|
1072
1024
|
// 分组(平铺文档流;字段行间发丝分隔 = 原生表单形态)
|
|
1073
1025
|
".obx-group{display:flex;flex-direction:column}",
|
|
1074
1026
|
".obx-group-head{display:flex;align-items:baseline;gap:8px;padding-bottom:4px;flex-wrap:wrap}",
|
|
1075
|
-
".obx-group-title{margin:0;font-size:
|
|
1027
|
+
".obx-group-title{margin:0;font-size:16px;font-weight:500;line-height:22px}",
|
|
1076
1028
|
".obx-group-desc{margin:0;color:var(--obx-fg-tertiary);font-size:12px;line-height:18px}",
|
|
1077
|
-
".obx-subgroup-title{margin:14px 0 2px;font-size:
|
|
1029
|
+
".obx-subgroup-title{margin:14px 0 2px;font-size:14px;font-weight:600;line-height:20px}",
|
|
1078
1030
|
".obx-subgroup-title:first-child{margin-top:0}",
|
|
1079
1031
|
// 字段行:值/枚举/多行为纵向(label 上、控件下、hint 再下),布尔/通知为左右行
|
|
1080
1032
|
".obx-field{display:flex;flex-direction:column;gap:6px;padding:12px 0;border-top:.5px solid var(--obx-hairline)}",
|
|
@@ -1082,7 +1034,7 @@ window.__ModuleLoader__.load({
|
|
|
1082
1034
|
".obx-field--row{flex-direction:row;align-items:center;justify-content:space-between;gap:16px}",
|
|
1083
1035
|
".obx-field-text{display:flex;flex:1;min-width:0;flex-direction:column;gap:3px}",
|
|
1084
1036
|
".obx-field-head{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap}",
|
|
1085
|
-
".obx-label{font-size:
|
|
1037
|
+
".obx-label{font-size:14px;font-weight:500;line-height:1.5;color:var(--obx-fg)}",
|
|
1086
1038
|
".obx-hint{margin:0;color:var(--obx-fg-tertiary);font-size:12px;line-height:1.5;min-width:0}",
|
|
1087
1039
|
".obx-hint--warn{color:var(--obx-warn)}",
|
|
1088
1040
|
".obx-hint--invalid{color:var(--obx-error)}",
|
|
@@ -1116,9 +1068,13 @@ window.__ModuleLoader__.load({
|
|
|
1116
1068
|
".obx-btn--primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,#3c3c3d)}",
|
|
1117
1069
|
"@media (prefers-color-scheme: dark){.obx-btn--primary{background:var(--dsw-alias-label-primary,#eceef2);color:var(--dsw-alias-label-primary-foreground,#17181a)}}",
|
|
1118
1070
|
".obx-segmented{display:inline-flex;gap:2px;padding:3px;border-radius:var(--obx-radius-md);background:var(--obx-well-bg);max-width:100%}",
|
|
1119
|
-
".obx-segmented-tab{box-sizing:border-box;height:26px;padding:0 12px;border:0;border-radius:var(--obx-radius-sm);background:transparent;color:var(--obx-fg-secondary);font:inherit;font-size:
|
|
1071
|
+
".obx-segmented-tab{box-sizing:border-box;height:26px;padding:0 12px;border:0;border-radius:var(--obx-radius-sm);background:transparent;color:var(--obx-fg-secondary);font:inherit;font-size:14px;font-weight:500;line-height:20px;cursor:pointer;white-space:nowrap}",
|
|
1120
1072
|
".obx-segmented-tab[aria-selected=true]{background:var(--obx-input-bg);color:var(--obx-fg);box-shadow:0 1px 2px rgba(0,0,0,.08)}",
|
|
1121
1073
|
".obx-segmented-tab:disabled{cursor:default;opacity:.4}",
|
|
1074
|
+
// 本地改(2026-11-18):顶部组切换条(连接/权限/行为…)字号 16,比字段枚举控件大一档。
|
|
1075
|
+
".obx-group-tabs .obx-segmented-tab{font-size:16px;font-weight:500;height:32px;padding:0 14px;line-height:24px}",
|
|
1076
|
+
// 同一档字号的兜底选择器(老的 .obx-tabs 容器类仍在用,双保险)。
|
|
1077
|
+
".obx-tabs .obx-segmented-tab{font-size:16px;font-weight:500;height:32px;padding:0 14px;line-height:24px}",
|
|
1122
1078
|
// workspace 快速填入行(卡内嵌次级行;说明独占一行)
|
|
1123
1079
|
".obx-workspace-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:10px 12px;border-radius:var(--obx-radius-md);background:var(--obx-well-bg)}",
|
|
1124
1080
|
".obx-workspace-row .obx-hint{flex-basis:100%}",
|
|
@@ -1258,12 +1214,11 @@ window.__ModuleLoader__.load({
|
|
|
1258
1214
|
*/
|
|
1259
1215
|
var NUMBER_RANGE = {
|
|
1260
1216
|
port: [1, 65535],
|
|
1261
|
-
|
|
1262
|
-
reactionEmoji: [0, undefined],
|
|
1263
|
-
interimRecallMs: [0, undefined],
|
|
1217
|
+
groupContextLines: [0, 200],
|
|
1264
1218
|
rateLimitPerMinute: [0, undefined],
|
|
1265
|
-
|
|
1219
|
+
interimRecallMs: [0, undefined],
|
|
1266
1220
|
inboxQueueDelayMs: [0, undefined],
|
|
1221
|
+
deferredTimeoutMs: [0, undefined],
|
|
1267
1222
|
// #58 旁观:容量条数 / 冷却分钟 / 每日上限。
|
|
1268
1223
|
bystanderCapacity: [5, 500],
|
|
1269
1224
|
bystanderCooldownMinutes: [5, 1440],
|
|
@@ -1294,7 +1249,7 @@ window.__ModuleLoader__.load({
|
|
|
1294
1249
|
var n = coerceValue(field, raw);
|
|
1295
1250
|
if (Number.isFinite(n) && n >= range[0] && (range[1] === undefined || n <= range[1]))
|
|
1296
1251
|
return null;
|
|
1297
|
-
return range[1] === undefined ? "≥" + range[0] : range[0] + "–" + range[1];
|
|
1252
|
+
return range[1] === undefined ? "≥" + range[0] + " 的整数" : range[0] + "–" + range[1] + " 的整数";
|
|
1298
1253
|
}
|
|
1299
1254
|
/**
|
|
1300
1255
|
* 批 3(UX §5.4):冲突合并保留——保存遇 revision 冲突重拉快照后,不再
|
|
@@ -1438,7 +1393,7 @@ window.__ModuleLoader__.load({
|
|
|
1438
1393
|
return h(ReactImpl, "div", { className: "obx-segmented", role: "tablist", "aria-label": props.label }, props.options.map(function (option) { return segmentedItem(props, "tab", option); }));
|
|
1439
1394
|
};
|
|
1440
1395
|
var segmentedTabs = function (props) {
|
|
1441
|
-
return h(ReactImpl, "div", { className: "obx-segmented obx-tabs", role: "tablist", "aria-label": props.label }, props.items.map(function (item) { return segmentedItem(props, "tab", item); }));
|
|
1396
|
+
return h(ReactImpl, "div", { className: "obx-segmented obx-tabs obx-group-tabs", role: "tablist", "aria-label": props.label }, props.items.map(function (item) { return segmentedItem(props, "tab", item); }));
|
|
1442
1397
|
};
|
|
1443
1398
|
var input = function (props) {
|
|
1444
1399
|
var rest = Object.assign({}, props);
|
|
@@ -1687,22 +1642,21 @@ window.__ModuleLoader__.load({
|
|
|
1687
1642
|
});
|
|
1688
1643
|
// T8:notices 通知开关——每条一行开关 + 一个文案框(开关关着就不显示)。
|
|
1689
1644
|
// 文案框默认显示上游原文;改成别的就发改后的那句;改回原文等于跟随默认。
|
|
1690
|
-
|
|
1645
|
+
// 本地改(2026-11-18):notices 文案不在 ALL_FIELDS 里,之前永远不挂「非默认」
|
|
1646
|
+
// 徽标。判定统一走 nonDefaultKeys(与普通字段同源,反映已保存值)。
|
|
1647
|
+
var noticeNonDefaultBadge = function (nk) {
|
|
1648
|
+
if (nonDefaultKeys.indexOf("notices." + nk.key) < 0)
|
|
1649
|
+
return null;
|
|
1650
|
+
return h(ReactImpl, ui.Tag, { tone: "neutral", children: h(ReactImpl, "span", { title: tr("field.nonDefaultTitle", "与默认值不同") }, tr("field.nonDefault", "非默认")) });
|
|
1651
|
+
};
|
|
1652
|
+
var renderNoticeRows = function (group, byKeyEarly, consumed) {
|
|
1691
1653
|
if (group.id !== "behavior" && group.id !== "session")
|
|
1692
1654
|
return [];
|
|
1693
1655
|
var rows = [];
|
|
1694
|
-
//
|
|
1695
|
-
//
|
|
1696
|
-
// 压根不生效,别摆那儿误导。
|
|
1697
|
-
var policy = draft["newMessagePolicy"];
|
|
1656
|
+
// 本地改(2026-11-18):排队提示 / 插话提示两条都恒显(各自可关、可改文案),
|
|
1657
|
+
// 不再随「任务运行中的新消息」档位隐藏。
|
|
1698
1658
|
var wanted = NOTICE_KEYS.filter(function (nk) {
|
|
1699
|
-
|
|
1700
|
-
return false;
|
|
1701
|
-
if (nk.key === "queue")
|
|
1702
|
-
return policy === "queue";
|
|
1703
|
-
if (nk.key === "steerAccepted")
|
|
1704
|
-
return policy !== "queue";
|
|
1705
|
-
return true;
|
|
1659
|
+
return group.id === "behavior";
|
|
1706
1660
|
});
|
|
1707
1661
|
// 用 forEach 而不是 for-of:var 在循环里只有一个变量,回调全指到最后一项,
|
|
1708
1662
|
// 点「排队提示」会改成「插话提示」——串味的根儿在这儿。
|
|
@@ -1721,7 +1675,7 @@ window.__ModuleLoader__.load({
|
|
|
1721
1675
|
});
|
|
1722
1676
|
};
|
|
1723
1677
|
var rowNodes = [
|
|
1724
|
-
h(ReactImpl, "div", { className: "obx-field obx-field--row", key: "nt-" + nk.key }, h(ReactImpl, "div", { className: "obx-field-text" }, h(ReactImpl, "div", { className: "obx-field-head" }, h(ReactImpl, "span", { className: "obx-label" }, noticeLabel))), h(ReactImpl, ui.Switch, {
|
|
1678
|
+
h(ReactImpl, "div", { className: "obx-field obx-field--row", key: "nt-" + nk.key }, h(ReactImpl, "div", { className: "obx-field-text" }, h(ReactImpl, "div", { className: "obx-field-head" }, h(ReactImpl, "span", { className: "obx-label" }, noticeLabel), noticeNonDefaultBadge(nk))), h(ReactImpl, ui.Switch, {
|
|
1725
1679
|
checked: nOn, label: noticeLabel, disabled: options.disabled === true,
|
|
1726
1680
|
onChange: function () { if (options.disabled !== true)
|
|
1727
1681
|
setNoticeState({ on: !nOn }); },
|
|
@@ -1737,25 +1691,70 @@ window.__ModuleLoader__.load({
|
|
|
1737
1691
|
"aria-label": format(tr("notice.textAria", "{label}文案"), { label: noticeLabel }),
|
|
1738
1692
|
})));
|
|
1739
1693
|
}
|
|
1694
|
+
// 本地改(2026-11-18):发送错误通知挪到整组最下面(notices 段之后再插回)。
|
|
1695
|
+
if (nk.key === "steerAccepted" && group.id === "behavior")
|
|
1696
|
+
consumed["sendErrorNotice"] = "tail";
|
|
1697
|
+
// 本地改(2026-11-18):等待模型回复超时挪到「超时补发提示」下面,只在它开着时显示。
|
|
1698
|
+
if (nk.key === "deferredTimeout" && nOn && byKeyEarly["deferredTimeoutMs"] != null) {
|
|
1699
|
+
consumed["deferredTimeoutMs"] = true;
|
|
1700
|
+
rows = rows.concat(rowNodes);
|
|
1701
|
+
rows = rows.concat(byKeyEarly["deferredTimeoutMs"]);
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1740
1704
|
rows = rows.concat(rowNodes);
|
|
1741
1705
|
});
|
|
1742
1706
|
return rows;
|
|
1743
1707
|
};
|
|
1744
|
-
|
|
1708
|
+
// 本地改(2026-11-18):先按 key 建索引,好把 deferredTimeoutMs 这类字段挪进 notices 段渲染。
|
|
1709
|
+
var byKeyEarly = {};
|
|
1710
|
+
group.fields.forEach(function (field, index) { byKeyEarly[field.key] = fieldNodes[index]; });
|
|
1711
|
+
var consumedNoticeFields = {};
|
|
1712
|
+
var noticeRows = renderNoticeRows(group, byKeyEarly, consumedNoticeFields);
|
|
1713
|
+
var tailFieldNodes = [];
|
|
1714
|
+
fieldNodes = fieldNodes.map(function (node, index) {
|
|
1715
|
+
var noticeField = group.fields[index];
|
|
1716
|
+
if (noticeField == null)
|
|
1717
|
+
return node;
|
|
1718
|
+
var consumedMode = consumedNoticeFields[noticeField.key];
|
|
1719
|
+
if (consumedMode === "tail") {
|
|
1720
|
+
tailFieldNodes.push(node);
|
|
1721
|
+
return null;
|
|
1722
|
+
}
|
|
1723
|
+
if (consumedMode === true)
|
|
1724
|
+
return null;
|
|
1725
|
+
return node;
|
|
1726
|
+
});
|
|
1727
|
+
var extraNodes = noticeRows.concat(tailFieldNodes);
|
|
1728
|
+
fieldNodes = fieldNodes.concat(extraNodes);
|
|
1745
1729
|
// 本地加:组内分区(如权限的私聊/群聊)——按 keys 顺序取已渲染的字段节点,
|
|
1746
1730
|
// 每块前面插一个小标题(标题走词条,zh 源 = GROUPS.sections.title 自动灌入)。
|
|
1747
1731
|
if (Array.isArray(group.sections) && group.sections.length > 0) {
|
|
1748
1732
|
var byKey = {};
|
|
1733
|
+
// 本地改(2026-11-18):sections 重排后 fieldNodes 长度已变(通知行/尾部字段
|
|
1734
|
+
// 追加在后面),所以索引只按前 group.fields.length 项取。
|
|
1749
1735
|
group.fields.forEach(function (field, index) { byKey[field.key] = fieldNodes[index]; });
|
|
1750
|
-
var
|
|
1736
|
+
var looseNodes = [];
|
|
1737
|
+
var sectionNodes = [];
|
|
1738
|
+
// 本地加:没归进任何分区的字段先渲染 —— 落在组标题下、第一个分区标题之上
|
|
1739
|
+
//(如权限组的「管理员用户列表」)。
|
|
1740
|
+
var claimedBySection = {};
|
|
1741
|
+
for (var claimSection of group.sections) {
|
|
1742
|
+
for (var claimKey of claimSection.keys)
|
|
1743
|
+
claimedBySection[claimKey] = true;
|
|
1744
|
+
}
|
|
1745
|
+
for (var looseField of group.fields) {
|
|
1746
|
+
if (claimedBySection[looseField.key] !== true && byKey[looseField.key] != null)
|
|
1747
|
+
looseNodes.push(byKey[looseField.key]);
|
|
1748
|
+
}
|
|
1751
1749
|
for (var section of group.sections) {
|
|
1752
|
-
|
|
1750
|
+
sectionNodes.push(h(ReactImpl, "h4", { className: "obx-subgroup-title", key: "sec-" + section.id }, tr("group." + group.id + ".section." + section.id, section.title)));
|
|
1753
1751
|
for (var sectionKey of section.keys) {
|
|
1754
1752
|
if (byKey[sectionKey] != null)
|
|
1755
|
-
|
|
1753
|
+
sectionNodes.push(byKey[sectionKey]);
|
|
1756
1754
|
}
|
|
1757
1755
|
}
|
|
1758
|
-
|
|
1756
|
+
// 本地改(2026-11-18):分区块排在通知段之后、尾部字段(发送错误通知)之前。
|
|
1757
|
+
fieldNodes = looseNodes.concat(noticeRows).concat(sectionNodes).concat(tailFieldNodes);
|
|
1759
1758
|
}
|
|
1760
1759
|
// 组标题 + 一句人话描述(经 opts.groupDesc 传入;缺省不渲染)。标题走词条
|
|
1761
1760
|
//(zh 源 = GROUPS.title 自动灌入)。
|
|
@@ -2155,6 +2154,15 @@ window.__ModuleLoader__.load({
|
|
|
2155
2154
|
for (var field of ALL_FIELDS) {
|
|
2156
2155
|
if (valueEquals(snapshot.config[field.key], DEFAULTS[field.key]) === false)
|
|
2157
2156
|
nonDefaultKeys.push(field.key);
|
|
2157
|
+
// 本地改(2026-11-18):notices 文案不在 ALL_FIELDS 里,按已保存值单独判一遍,
|
|
2158
|
+
// 让「插话提示/排队提示/回答回执/超时补发/限流提示」也能挂「非默认」徽标。
|
|
2159
|
+
var savedNotices = snapshot.config.notices != null && typeof snapshot.config.notices === "object" ? snapshot.config.notices : {};
|
|
2160
|
+
for (var noticeMeta of NOTICE_KEYS) {
|
|
2161
|
+
var savedNotice = Object.prototype.hasOwnProperty.call(savedNotices, noticeMeta.key) ? savedNotices[noticeMeta.key] : undefined;
|
|
2162
|
+
var savedNoticeState = noticeToDraft(savedNotice, noticeMeta.def);
|
|
2163
|
+
if (savedNoticeState.on !== true || savedNoticeState.text !== noticeMeta.def)
|
|
2164
|
+
nonDefaultKeys.push("notices." + noticeMeta.key);
|
|
2165
|
+
}
|
|
2158
2166
|
}
|
|
2159
2167
|
}
|
|
2160
2168
|
// 批 2(UX §3.2):mode 联动变暗禁用——reverse→url、forward→host/port;
|
|
@@ -2360,7 +2368,7 @@ window.__ModuleLoader__.load({
|
|
|
2360
2368
|
var sidebarEnabled = true;
|
|
2361
2369
|
try {
|
|
2362
2370
|
var sidebarSnapshot = await remote.getSettings();
|
|
2363
|
-
sidebarEnabled =
|
|
2371
|
+
sidebarEnabled = true; // 本地改(2026-11-18):首页侧边栏入口写死开启(设置项已下架)
|
|
2364
2372
|
}
|
|
2365
2373
|
catch (error) {
|
|
2366
2374
|
sidebarEnabled = true; // 快照读取失败按 schema 默认值(开)兜底
|
package/lib/inbound.js
CHANGED
|
@@ -142,10 +142,9 @@ export class InboundPipeline {
|
|
|
142
142
|
// 置回 false。角色档取管理员/成员各自的唤醒词表。
|
|
143
143
|
let wakeNameHit = false;
|
|
144
144
|
if (kind === 'group' && !mentioned) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
: this.ctx.config.wakeNamesMember ?? [];
|
|
145
|
+
// 2026-11-18 本地改:用户唤醒词 / 他人唤醒词合并成一张「唤醒词」表,
|
|
146
|
+
// 群里任何人(不管是不是管理员)说了都算叫到我。
|
|
147
|
+
const wakeNames = [...(this.ctx.config.wakeNamesAdmin ?? []), ...(this.ctx.config.wakeNamesMember ?? [])];
|
|
149
148
|
if (wakeNames.length > 0) {
|
|
150
149
|
const text = segmentText(inbound.segments, inbound.raw);
|
|
151
150
|
if (detectWakeName(text, wakeNames)) {
|
|
@@ -154,7 +153,7 @@ export class InboundPipeline {
|
|
|
154
153
|
currentTrace()?.emit('mention', {
|
|
155
154
|
ok: true,
|
|
156
155
|
reason: TRACE_REASONS.inboundWakeName,
|
|
157
|
-
data: { names: [...wakeNames], textLen: text.length, preview: text.slice(0, 40)
|
|
156
|
+
data: { names: [...wakeNames], textLen: text.length, preview: text.slice(0, 40) },
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
159
|
}
|
|
@@ -517,37 +516,6 @@ export class InboundPipeline {
|
|
|
517
516
|
const segments = Array.isArray(data.message) ? data.message : undefined;
|
|
518
517
|
const raw = typeof data.raw_message === 'string' ? data.raw_message : '';
|
|
519
518
|
const text = cqUnescape(segmentText(segments, raw));
|
|
520
|
-
// 引用的是一条合并转发:被引消息的 segments 里只有一个 forward 段
|
|
521
|
-
// (id / resId),正文是空的,走下面的文字路径只会剩下空壳。这里
|
|
522
|
-
// 直接按 forward 展开,和消息体自带 forward 段时同一套处理。
|
|
523
|
-
const quotedForward = (segments ?? []).find((segment) => segment?.type === 'forward');
|
|
524
|
-
if (quotedForward !== undefined) {
|
|
525
|
-
const forwardRef = quotedForward.data?.id ?? quotedForward.data?.resId;
|
|
526
|
-
if (forwardRef !== undefined && forwardRef !== '') {
|
|
527
|
-
const expansion = await this.expandForward(String(forwardRef));
|
|
528
|
-
// 引用消息自带的文字(基本上只剩 '[合并转发]' 这个占位)也要留下。
|
|
529
|
-
const residual = text.replace('[合并转发]', '').trim();
|
|
530
|
-
const quotedLines = residual !== '' ? [residual, expansion.text] : [expansion.text];
|
|
531
|
-
for (const ref of expansion.media ?? []) {
|
|
532
|
-
try {
|
|
533
|
-
const resolved = await this.ctx.media.resolve(ref, async (_kind, refFile) => {
|
|
534
|
-
const got = await this.ctx.call('get_image', { file: refFile });
|
|
535
|
-
return { url: got.url, file: got.file };
|
|
536
|
-
});
|
|
537
|
-
if (resolved !== undefined && typeof resolved.path === 'string' && resolved.path !== '') {
|
|
538
|
-
quotedLines.push('[引用合并转发里的图片:' + resolved.path + ']'
|
|
539
|
-
+ await gifFramesNote(resolved.path, this.ctx.config.gifFramesEnabled === true));
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
catch {
|
|
543
|
-
// 单图失败静默跳过:合并转发的文字部分照常展开。
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
const quotedName = data.sender?.nickname ?? '';
|
|
547
|
-
currentTrace()?.emit('quote', { ok: true, reason: '引用的合并转发已展开' });
|
|
548
|
-
return '[引用]' + (quotedName !== '' ? quotedName + ': ' : '') + quotedLines.join('\n');
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
519
|
// T1 (PR port): 引用里带图片时把图落成本地文件喂给模型(上游只留
|
|
552
520
|
// 文字)。单图落地失败只降级为纯文字引用,不影响其余内容。
|
|
553
521
|
const imageNotes = [];
|
package/lib/index.js
CHANGED
|
@@ -252,13 +252,15 @@ export const Config = z.object({
|
|
|
252
252
|
.description('私聊附加设定文件路径(T4 PR 移植):支持 ~/ 展开;文件内容(剥行首尾空白)注入私聊会话 system prompt 的「本会话附加设定」段,文件编辑后即时生效(mtime 缓存失效);留空 = 不注入(默认)'),
|
|
253
253
|
groupPromptFile: z.string().default('')
|
|
254
254
|
.description('群聊附加设定文件路径(T4 PR 移植):同 dmPromptFile,只对群聊(group:)会话生效;留空 = 不注入(默认)'),
|
|
255
|
+
groupContextLines: z.number().min(0).max(200).default(0)
|
|
256
|
+
.description('群聊参考上下文条数(本地加 2026-11-18):被 @ 时把群里最近 N 条消息拼进上下文;0 = 不参考'),
|
|
255
257
|
memoryFilesEnabled: z.boolean().default(false)
|
|
256
258
|
.description('记忆文件开关(T4 PR 移植):开启后把 memoryFiles 列表里的文件内容注入私聊会话 system prompt 的「我的记忆」段(单文件 8000 字符、总量 12000 字符截断;群聊不喂记忆);默认关'),
|
|
257
259
|
memoryFiles: z.array(z.string()).default([])
|
|
258
260
|
.description('记忆文件路径列表(T4 PR 移植):支持 ~/ 展开;仅在 memoryFilesEnabled 开启且私聊会话生效'),
|
|
259
261
|
chatTailsEnabled: z.boolean().default(false)
|
|
260
262
|
.description('上下文尾巴开关(T4 PR 移植):开启后 /new 把上一会话最后几句(最多 8 条、每条 300 字符,落盘 mediaDir/chat-tails.json)带进新会话,模型开场先接上一段话头;默认关(/new 维持纯新会话)'),
|
|
261
|
-
titleSyncEnabled: z.boolean().default(
|
|
263
|
+
titleSyncEnabled: z.boolean().default(true)
|
|
262
264
|
.description('会话标题同步(T24 PR 移植):开启后每条 QQ 用户消息派发回合后触发宿主会话标题刷新(一次小 LLM 调用,等价宿主自动标题 all-prompts 的原行为——QQ 消息的来源标记不会触发宿主自动标题,本开关补上);用户在宿主里手动钉住的标题永不覆盖;标题服务未部署或刷新失败时静默降级(仅告警日志);默认关闭;改动需刷新页面/重启后生效'),
|
|
263
265
|
inboundFileMaxBytes: z.number().default(INBOUND_FILE_MAX_BYTES)
|
|
264
266
|
.description('QQ 入站文件最大字节数(直链/base64 拉取,0 = 不限制)'),
|
|
@@ -515,7 +517,7 @@ export function apply(ctx, config) {
|
|
|
515
517
|
},
|
|
516
518
|
config: {
|
|
517
519
|
botQQ: config.botQQ,
|
|
518
|
-
ignoreSelf:
|
|
520
|
+
ignoreSelf: true, // 本地改(2026-11-18):忽略自己发的消息恒开(设置项已下架)
|
|
519
521
|
requireMention: config.requireMention,
|
|
520
522
|
reactionOnMention: config.reactionOnMention,
|
|
521
523
|
reactionEmoji: config.reactionEmoji,
|
|
@@ -559,6 +561,7 @@ export function apply(ctx, config) {
|
|
|
559
561
|
startupResumeEnabled: config.startupResumeEnabled,
|
|
560
562
|
dmPromptFile: config.dmPromptFile,
|
|
561
563
|
groupPromptFile: config.groupPromptFile,
|
|
564
|
+
groupContextLines: config.groupContextLines,
|
|
562
565
|
memoryFilesEnabled: config.memoryFilesEnabled,
|
|
563
566
|
memoryFiles: config.memoryFiles,
|
|
564
567
|
chatTailsEnabled: config.chatTailsEnabled,
|