dsh-onebot-genji 0.12.0 → 0.12.1
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 +109 -109
- package/lib/inbound.js +0 -31
- package/lib/index.js +2 -2
- package/lib/interim.js +1 -10
- package/lib/outbound.js +7 -15
- package/lib/settings-remote.js +6 -5
- package/lib/split.js +0 -50
- package/lib/tools.js +0 -2
- package/package.json +1 -1
package/lib/bridge.js
CHANGED
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
11
11
|
import { realpath } from 'node:fs/promises';
|
|
12
|
-
// 2026-11-17 本地补丁:会话标题按昵称/群名定名——同步日志 + 文件名工具。
|
|
13
|
-
const __qqTitleNickPatched = true;
|
|
14
|
-
import { appendFileSync as __qqTitleAppend } from 'node:fs';
|
|
15
|
-
import { homedir as __qqTitleHome } from 'node:os';
|
|
16
12
|
import { transcriptLabel } from './stt.js';
|
|
17
13
|
import { buildChatId, classifyUserRole, splitChatId } from './chat.js';
|
|
18
14
|
import { buildPlatformPrompt } from './prompt.js';
|
|
@@ -41,19 +37,6 @@ import { currentTrace, newTraceId, runWithTrace, TRACE_REASONS } from './trace.j
|
|
|
41
37
|
import { runInjectRound, currentInjectRound, isWriteAction, INTERCEPTED_MESSAGE_ID } from './inject.js';
|
|
42
38
|
import { healthReport, exportDiagnostics } from './health.js';
|
|
43
39
|
import { FailureRefRegistry, failureRefSuffix } from './ref.js';
|
|
44
|
-
// ── 回合形式掷骰(2026-11-16 重打;0.11.0 把老 turn-form.js 整个删了)──────
|
|
45
|
-
// 私聊 / 群聊同一套:语音 10%、表情包 39%,其余纯文字。主人 2026-11-13 定。
|
|
46
|
-
const VOICE_PROB = 0.10;
|
|
47
|
-
const STICKER_PROB = 0.39;
|
|
48
|
-
const VOICE_HINT = '(插件掷骰:本轮形式 = 语音)\n'
|
|
49
|
-
+ '这一回合把回复做成一条语音条:先在 D:\\Software\\dsh-workspace\\voice-lab 下用 cosy-venv 的 python 跑 '
|
|
50
|
-
+ 'say.py "<要说的内容>" <唯一文件名> 生成 silk,再用 qq_send_voice 发出去。\n'
|
|
51
|
-
+ '语音内容要像开口说话:短、口语、有语气,别念稿。\n'
|
|
52
|
-
+ '⚠️ 语音就是这一轮要说的话:**不要再用 qq_send_text 把同一句打一遍**(对方会听一遍看一遍)。'
|
|
53
|
-
+ '真要张口招呼,最多半句不带内容的「来了」「等下」;语音里念过的意思,文字里一个字都别重复。';
|
|
54
|
-
const STICKER_HINT = '(插件掷骰:本轮形式 = 表情包)\n'
|
|
55
|
-
+ '这一回合文字照常短着说,另外从 D:\\Software\\dsh-workspace\\stickers\\<分类>\\ 里挑一张贴题的表情包,'
|
|
56
|
-
+ '用 qq_send_image 发出来。挑不到合适的就跳过,别硬凑一张不搭的。';
|
|
57
40
|
/** T2 (P1): the queue notice sent to a chat when a message arrives while its
|
|
58
41
|
* task is running under the default 'queue' policy — at most ONE per running
|
|
59
42
|
* turn (the flag resets at turn/end) so a burst of queued messages never
|
|
@@ -247,8 +230,6 @@ export class ChatBridge {
|
|
|
247
230
|
this.interim = new InterimTracker({
|
|
248
231
|
sendToChat: (chatId, text, options) => this.sendToChat(chatId, text, options),
|
|
249
232
|
sendMsg: (chatId, segments, options) => this.sendMsg(chatId, segments, options),
|
|
250
|
-
// 2026-11-16 双发闸:本回合已用工具发过东西 → 终稿正文不再发。
|
|
251
|
-
toolWroteThisTurn: chatId => this.toolWroteThisTurn(chatId),
|
|
252
233
|
call: (action, params) => this.guardedConnectionCall(action, params),
|
|
253
234
|
chainTail: chatId => this.outbound.chainTail(chatId),
|
|
254
235
|
relayHostCards: (chatId, content) => this.relayHostCards(chatId, content),
|
|
@@ -431,8 +412,6 @@ export class ChatBridge {
|
|
|
431
412
|
* @returns the sent message id.
|
|
432
413
|
*/
|
|
433
414
|
sendSegments(chatId, segments) {
|
|
434
|
-
// 2026-11-16 双发闸:图片/语音/视频/文件/分段的统一出口,先记一笔。
|
|
435
|
-
this.noteToolWrite(chatId);
|
|
436
415
|
return this.outbound.sendSegments(chatId, segments);
|
|
437
416
|
}
|
|
438
417
|
/**
|
|
@@ -600,96 +579,23 @@ export class ChatBridge {
|
|
|
600
579
|
* - refresh 后台执行不 await 主流程;get/refresh 同步抛或拒绝都只
|
|
601
580
|
* warn(标题是辅助功能,失败静默降级,不冒泡进派发主流程)。 */
|
|
602
581
|
syncSessionTitle(chat) {
|
|
603
|
-
|
|
604
|
-
try {
|
|
605
|
-
__qqTitleAppend(__qqTitleHome() + '\\.dsh\\onebot-title-sync.log', '[' + new Date().toISOString() + '] ' + msg + '\n');
|
|
606
|
-
}
|
|
607
|
-
catch {
|
|
608
|
-
/* 日志失败不影响同步 */
|
|
609
|
-
}
|
|
610
|
-
};
|
|
611
|
-
if (this.deps.config.titleSyncEnabled !== true) {
|
|
612
|
-
dbg('skip: titleSyncEnabled=' + String(this.deps.config.titleSyncEnabled) + ' chat=' + chat.chatId);
|
|
582
|
+
if (this.deps.config.titleSyncEnabled !== true)
|
|
613
583
|
return;
|
|
614
|
-
}
|
|
615
584
|
const service = this.deps.sessionTitle;
|
|
616
|
-
if (service === undefined)
|
|
617
|
-
dbg('skip: no sessionTitle service chat=' + chat.chatId);
|
|
618
|
-
return;
|
|
619
|
-
}
|
|
620
|
-
const session = chat.agent?.session;
|
|
621
|
-
if (session === undefined) {
|
|
622
|
-
dbg('skip: no session chat=' + chat.chatId);
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
// 本地补丁 2026-11-17:先按身份定名(私聊=昵称(QQ号),群聊=群名(群号)),
|
|
626
|
-
// 定不了才退回官方 LLM refresh。身份标题的 source 是 user,所以后续比较
|
|
627
|
-
// 标题文本本身:昵称/群名没变就一次都不重写。
|
|
628
|
-
const applyTitle = (desired) => {
|
|
629
|
-
const title = typeof desired === 'string' ? desired.trim() : '';
|
|
630
|
-
if (title === '')
|
|
631
|
-
return false;
|
|
632
|
-
try {
|
|
633
|
-
const current = service.get(session);
|
|
634
|
-
if (current?.title === title) {
|
|
635
|
-
dbg('title ok: ' + title);
|
|
636
|
-
return true;
|
|
637
|
-
}
|
|
638
|
-
service.rename(session, title);
|
|
639
|
-
dbg('rename ok: ' + title + ' (was ' + JSON.stringify(current?.title ?? null) + ') chat=' + chat.chatId);
|
|
640
|
-
return true;
|
|
641
|
-
}
|
|
642
|
-
catch (error) {
|
|
643
|
-
dbg('rename fail: ' + describeError(error) + ' chat=' + chat.chatId);
|
|
644
|
-
this.deps.log('warn', '会话标题写入失败 (' + chat.sessionId + '): ' + describeError(error));
|
|
645
|
-
return false;
|
|
646
|
-
}
|
|
647
|
-
};
|
|
648
|
-
const ref = splitChatId(chat.chatId);
|
|
649
|
-
if (ref.kind === 'group') {
|
|
650
|
-
const titles = this.__qqGroupTitles ?? (this.__qqGroupTitles = {});
|
|
651
|
-
const cached = titles[ref.target];
|
|
652
|
-
if (typeof cached === 'string' && applyTitle(cached + '(' + ref.target + ')'))
|
|
653
|
-
return;
|
|
654
|
-
void this.guardedConnectionCall('get_group_info', { group_id: Number(ref.target) }, chat.chatId)
|
|
655
|
-
.then((info) => {
|
|
656
|
-
const rawName = info?.group_name;
|
|
657
|
-
const name = typeof rawName === 'string' ? rawName.trim() : '';
|
|
658
|
-
if (name === '') {
|
|
659
|
-
dbg('group name empty: ' + ref.target);
|
|
660
|
-
return false;
|
|
661
|
-
}
|
|
662
|
-
titles[ref.target] = name;
|
|
663
|
-
return applyTitle(name + '(' + ref.target + ')');
|
|
664
|
-
})
|
|
665
|
-
.catch((error) => {
|
|
666
|
-
dbg('group info fail: ' + describeError(error));
|
|
667
|
-
return false;
|
|
668
|
-
})
|
|
669
|
-
.then((done) => {
|
|
670
|
-
if (done === true)
|
|
671
|
-
return;
|
|
672
|
-
void service.refresh(session).catch((error) => {
|
|
673
|
-
dbg('refresh fail: ' + describeError(error));
|
|
674
|
-
});
|
|
675
|
-
});
|
|
676
|
-
return;
|
|
677
|
-
}
|
|
678
|
-
const nickname = typeof chat.lastNickname === 'string' ? chat.lastNickname.trim() : '';
|
|
679
|
-
if (nickname !== '' && applyTitle(nickname + '(' + ref.target + ')'))
|
|
585
|
+
if (service === undefined)
|
|
680
586
|
return;
|
|
587
|
+
const session = chat.agent.session;
|
|
681
588
|
try {
|
|
682
|
-
|
|
589
|
+
const snapshot = service.get(session);
|
|
590
|
+
if (snapshot?.source?.kind === 'user')
|
|
683
591
|
return;
|
|
592
|
+
void service.refresh(session).catch((error) => {
|
|
593
|
+
this.deps.log('warn', '会话标题刷新失败 (' + chat.sessionId + '): ' + describeError(error));
|
|
594
|
+
});
|
|
684
595
|
}
|
|
685
596
|
catch (error) {
|
|
686
|
-
dbg('get fail: ' + describeError(error));
|
|
687
|
-
}
|
|
688
|
-
dbg('fallback refresh chat=' + chat.chatId);
|
|
689
|
-
void service.refresh(session).catch((error) => {
|
|
690
|
-
dbg('refresh fail: ' + describeError(error));
|
|
691
597
|
this.deps.log('warn', '会话标题刷新失败 (' + chat.sessionId + '): ' + describeError(error));
|
|
692
|
-
}
|
|
598
|
+
}
|
|
693
599
|
}
|
|
694
600
|
/**
|
|
695
601
|
* 群聊旁观 (#58):把一条未通过 @ 门控的群消息喂进旁听缓冲;规则触发命中
|
|
@@ -737,49 +643,12 @@ export class ChatBridge {
|
|
|
737
643
|
* so the agent's own plan-mode instruction section governs planning. */
|
|
738
644
|
prefixTurn(chatId, text) {
|
|
739
645
|
let out = text;
|
|
740
|
-
// 2026-11-16 重打:这里同时是回合起点——回合序号 +1,双发闸据此比对。
|
|
741
|
-
this.bumpTurnSeq(chatId);
|
|
742
646
|
const goal = this.registry.getSettings(chatId).goal;
|
|
743
647
|
if (goal !== undefined && goal.trim() !== '') {
|
|
744
648
|
out = '【当前目标】' + goal + '\n' + out;
|
|
745
649
|
}
|
|
746
|
-
// 2026-11-16 重打:每回合掷一次形式(语音 / 表情包 / 纯文字)。
|
|
747
|
-
// 老实现按 dm|group 分叉,2026-11-13 主人要求两边一致,所以一律同一套概率。
|
|
748
|
-
const form = this.rollTurnForm();
|
|
749
|
-
if (form !== '')
|
|
750
|
-
out = out + '\n' + form;
|
|
751
650
|
return out.trim();
|
|
752
651
|
}
|
|
753
|
-
/** 掷本轮形式;空串 = 纯文字。 */
|
|
754
|
-
rollTurnForm() {
|
|
755
|
-
const r = Math.random();
|
|
756
|
-
if (r < VOICE_PROB)
|
|
757
|
-
return VOICE_HINT;
|
|
758
|
-
if (r < VOICE_PROB + STICKER_PROB)
|
|
759
|
-
return STICKER_HINT;
|
|
760
|
-
return '';
|
|
761
|
-
}
|
|
762
|
-
// ── 双发闸(2026-11-16 重打;0.11.0 官方把这套删了)──────────────────
|
|
763
|
-
// 语义:本回合只要用 qq_* 工具发过东西(文字/图/语音/文件),回合末那条
|
|
764
|
-
// 「终稿正文」就不再发一遍,免得同一句话出现两次。回合号每回合 +1。
|
|
765
|
-
/** chatId → 当前回合号。 */
|
|
766
|
-
turnSeqByChat = new Map();
|
|
767
|
-
/** chatId → 最近一次用工具发东西时的回合号。 */
|
|
768
|
-
toolWroteTurnByChat = new Map();
|
|
769
|
-
bumpTurnSeq(chatId) {
|
|
770
|
-
const n = (this.turnSeqByChat.get(chatId) ?? 0) + 1;
|
|
771
|
-
this.turnSeqByChat.set(chatId, n);
|
|
772
|
-
return n;
|
|
773
|
-
}
|
|
774
|
-
/** 工具出了一条 → 记下它属于哪一回合。 */
|
|
775
|
-
noteToolWrite(chatId) {
|
|
776
|
-
this.toolWroteTurnByChat.set(chatId, this.turnSeqByChat.get(chatId) ?? 0);
|
|
777
|
-
}
|
|
778
|
-
/** 本回合是否已经用工具发过东西。 */
|
|
779
|
-
toolWroteThisTurn(chatId) {
|
|
780
|
-
const seq = this.turnSeqByChat.get(chatId) ?? 0;
|
|
781
|
-
return seq > 0 && this.toolWroteTurnByChat.get(chatId) === seq;
|
|
782
|
-
}
|
|
783
652
|
/** Per-chat outbound-mode override (/mode), falling back to the global config. */
|
|
784
653
|
effectiveInterim(chatId) {
|
|
785
654
|
return this.registry.getSettings(chatId).interimOverride ?? this.deps.config.interimMessages;
|
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: ["requireMention", "memberTools", "groupPolicy", "groupAllowFrom", "wakeNamesAdmin", "wakeNamesMember", "atAllCountsAsMention", "pokeEnabled"] },
|
|
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: "groupAllowFrom", label: "群聊白名单", type: "stringArray" },
|
|
142
|
+
{ key: "allowFrom", label: "私聊白名单", showIf: { key: "dmPolicy", value: "allowlist" }, type: "stringArray" },
|
|
143
|
+
{ key: "groupAllowFrom", label: "群聊白名单", showIf: { key: "groupPolicy", value: "allowlist" }, type: "stringArray" },
|
|
145
144
|
{ key: "wakeNamesAdmin", label: "用户唤醒词", type: "stringArray" },
|
|
146
145
|
{ key: "wakeNamesMember", label: "他人唤醒词", type: "stringArray" },
|
|
147
|
-
{ key: "replyCountsAsMention", label: "被引用唤醒", type: "boolean", hint: "引用别人的消息也算叫我" },
|
|
148
146
|
{ 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
147
|
{ key: "pokeEnabled", label: "戳一戳叫醒", type: "boolean" },
|
|
153
|
-
{ key: "restrictedMemberPrefix", label: "群聊非管理员加受限前缀", type: "boolean", hint: "打开后非管理员的消息带 [受限用户:仅问答] 标记:只答问题,可以要图片和表情包;关掉一视同仁" },
|
|
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 文件服务/反代在本机或内网时,下载检查得放行。
|
|
@@ -285,14 +261,14 @@ window.__ModuleLoader__.load({
|
|
|
285
261
|
dmPolicy: "open",
|
|
286
262
|
groupPolicy: "open",
|
|
287
263
|
allowAllUsers: false,
|
|
264
|
+
sidebarEntryEnabled: true,
|
|
265
|
+
titleSyncEnabled: true,
|
|
288
266
|
allowFrom: [],
|
|
289
267
|
groupAllowFrom: [],
|
|
290
268
|
wakeNamesAdmin: [],
|
|
291
269
|
wakeNamesMember: [],
|
|
292
270
|
replyCountsAsMention: false,
|
|
293
271
|
atAllCountsAsMention: false,
|
|
294
|
-
reactionOnMention: false,
|
|
295
|
-
reactionEmoji: 178,
|
|
296
272
|
faceStyle: "name",
|
|
297
273
|
pokeEnabled: true,
|
|
298
274
|
interimMessages: true,
|
|
@@ -312,7 +288,6 @@ window.__ModuleLoader__.load({
|
|
|
312
288
|
memoryFiles: [],
|
|
313
289
|
ignoreSelf: true,
|
|
314
290
|
// T11:侧边栏入口开关(用户裁定默认开)。
|
|
315
|
-
sidebarEntryEnabled: true,
|
|
316
291
|
sttEnabled: true,
|
|
317
292
|
agentPreset: "",
|
|
318
293
|
chatIdleEvictDays: 7,
|
|
@@ -345,7 +320,6 @@ window.__ModuleLoader__.load({
|
|
|
345
320
|
inboxQueueEnabled: false,
|
|
346
321
|
inboxQueueDelayMs: 600,
|
|
347
322
|
// T24:QQ 会话标题同步开关(默认关)。
|
|
348
|
-
titleSyncEnabled: false,
|
|
349
323
|
};
|
|
350
324
|
// T8:notices 通知开关补上面板。值可以是 false=不发 / true=默认文案 /
|
|
351
325
|
// 字符串=自定义文案。5 键对齐 src/settings-remote.ts NOTICE_KEYS(本仓
|
|
@@ -513,8 +487,6 @@ window.__ModuleLoader__.load({
|
|
|
513
487
|
wakeNamesMember: vArray(vString(0, 64)),
|
|
514
488
|
replyCountsAsMention: vBoolean(),
|
|
515
489
|
atAllCountsAsMention: vBoolean(),
|
|
516
|
-
reactionOnMention: vBoolean(),
|
|
517
|
-
reactionEmoji: vNumber(),
|
|
518
490
|
faceStyle: vEnum(["name", "emoji"]),
|
|
519
491
|
pokeEnabled: vBoolean(),
|
|
520
492
|
interimMessages: vBoolean(),
|
|
@@ -625,8 +597,6 @@ window.__ModuleLoader__.load({
|
|
|
625
597
|
wakeNamesMember: vOptional(vArray(vString(0, 64))),
|
|
626
598
|
replyCountsAsMention: vOptional(vBoolean()),
|
|
627
599
|
atAllCountsAsMention: vOptional(vBoolean()),
|
|
628
|
-
reactionOnMention: vOptional(vBoolean()),
|
|
629
|
-
reactionEmoji: vOptional(vNumber(0)),
|
|
630
600
|
faceStyle: vOptional(vEnum(["name", "emoji"])),
|
|
631
601
|
pokeEnabled: vOptional(vBoolean()),
|
|
632
602
|
restrictedMemberPrefix: vOptional(vBoolean()),
|
|
@@ -766,7 +736,7 @@ window.__ModuleLoader__.load({
|
|
|
766
736
|
// zh/en 同批齐平;既有键文案不改)。
|
|
767
737
|
"conflict.kept": "已保留 {count} 项未冲突的修改,请核对后重新保存。",
|
|
768
738
|
"conflict.secretCleared": "accessToken 输入已清空,如需修改请重新输入。",
|
|
769
|
-
"field.numberInvalid": "必须是 {range}
|
|
739
|
+
"field.numberInvalid": "必须是 {range}",
|
|
770
740
|
"field.remoteOverwritten": "已被其他来源修改,已同步为最新值",
|
|
771
741
|
// T11:首页左侧边栏入口词条(sidebar.panellist 的 label;en 同批齐平)。
|
|
772
742
|
"sidebar.panel": "QQ Bot",
|
|
@@ -824,7 +794,7 @@ window.__ModuleLoader__.load({
|
|
|
824
794
|
// 批 3(UX §5.4/§5.6):与 zh 同批新增的 4 键(冲突合并保留 + 数字行内校验)。
|
|
825
795
|
"conflict.kept": "Kept {count} non-conflicting change(s) — review and save again.",
|
|
826
796
|
"conflict.secretCleared": "The accessToken input has been cleared; re-enter it if you still want to change it.",
|
|
827
|
-
"field.numberInvalid": "Must be
|
|
797
|
+
"field.numberInvalid": "Must be {range}",
|
|
828
798
|
"field.remoteOverwritten": "Changed by another source — synced to the latest value",
|
|
829
799
|
"sidebar.panel": "QQ Bot",
|
|
830
800
|
// 0.10.0 字段文案词条化:与 zh 同批的面板自有 UI 串。
|
|
@@ -898,13 +868,8 @@ window.__ModuleLoader__.load({
|
|
|
898
868
|
groupAllowFrom: { label: "Group allowlist" },
|
|
899
869
|
wakeNamesAdmin: { label: "User wake names" },
|
|
900
870
|
wakeNamesMember: { label: "Member wake names" },
|
|
901
|
-
replyCountsAsMention: { label: "Quoted-message wakes", hint: "Quoting someone else's message also wakes me" },
|
|
902
871
|
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
872
|
pokeEnabled: { label: "Poke wakes" },
|
|
907
|
-
restrictedMemberPrefix: { label: "Restricted prefix for non-admins", hint: "When on, non-admin group messages carry a [restricted user: Q&A only] marker: answers questions only, may still request images and stickers; off = treat everyone the same" },
|
|
908
873
|
sensitivePatterns: { label: "Outbound sensitive-word regexes", placeholder: "One regex per line; empty = built-in list" },
|
|
909
874
|
},
|
|
910
875
|
},
|
|
@@ -922,33 +887,18 @@ window.__ModuleLoader__.load({
|
|
|
922
887
|
deferredTimeoutMs: { label: "Model reply wait timeout (ms)" },
|
|
923
888
|
inboxQueueEnabled: { label: "Inbound burst merging", hint: "Merge several messages burst-sent to one session into a single delivery" },
|
|
924
889
|
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
890
|
},
|
|
939
891
|
},
|
|
940
892
|
session: {
|
|
941
893
|
title: "Session",
|
|
942
894
|
fields: {
|
|
943
895
|
newSessionGreeting: { label: "Greet on new sessions", hint: "After /new I say hello first" },
|
|
944
|
-
|
|
896
|
+
titleSyncEnabled: { label: "Auto-rename sessions", hint: "DM: nickname (QQ number); group: group name (group number)" },
|
|
945
897
|
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
898
|
memoryFilesEnabled: { label: "Read memory files on new sessions" },
|
|
947
899
|
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
900
|
workspacePath: { label: "Default DM workspace path", hint: "Default directory for new DM sessions" },
|
|
950
901
|
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
902
|
dmPromptFile: { label: "DM prompt file (txt path)" },
|
|
953
903
|
groupPromptFile: { label: "Group prompt file (txt path)" },
|
|
954
904
|
},
|
|
@@ -1072,9 +1022,9 @@ window.__ModuleLoader__.load({
|
|
|
1072
1022
|
// 分组(平铺文档流;字段行间发丝分隔 = 原生表单形态)
|
|
1073
1023
|
".obx-group{display:flex;flex-direction:column}",
|
|
1074
1024
|
".obx-group-head{display:flex;align-items:baseline;gap:8px;padding-bottom:4px;flex-wrap:wrap}",
|
|
1075
|
-
".obx-group-title{margin:0;font-size:
|
|
1025
|
+
".obx-group-title{margin:0;font-size:16px;font-weight:500;line-height:22px}",
|
|
1076
1026
|
".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:
|
|
1027
|
+
".obx-subgroup-title{margin:14px 0 2px;font-size:14px;font-weight:600;line-height:20px}",
|
|
1078
1028
|
".obx-subgroup-title:first-child{margin-top:0}",
|
|
1079
1029
|
// 字段行:值/枚举/多行为纵向(label 上、控件下、hint 再下),布尔/通知为左右行
|
|
1080
1030
|
".obx-field{display:flex;flex-direction:column;gap:6px;padding:12px 0;border-top:.5px solid var(--obx-hairline)}",
|
|
@@ -1082,7 +1032,7 @@ window.__ModuleLoader__.load({
|
|
|
1082
1032
|
".obx-field--row{flex-direction:row;align-items:center;justify-content:space-between;gap:16px}",
|
|
1083
1033
|
".obx-field-text{display:flex;flex:1;min-width:0;flex-direction:column;gap:3px}",
|
|
1084
1034
|
".obx-field-head{display:flex;align-items:center;gap:6px;min-width:0;flex-wrap:wrap}",
|
|
1085
|
-
".obx-label{font-size:
|
|
1035
|
+
".obx-label{font-size:14px;font-weight:500;line-height:1.5;color:var(--obx-fg)}",
|
|
1086
1036
|
".obx-hint{margin:0;color:var(--obx-fg-tertiary);font-size:12px;line-height:1.5;min-width:0}",
|
|
1087
1037
|
".obx-hint--warn{color:var(--obx-warn)}",
|
|
1088
1038
|
".obx-hint--invalid{color:var(--obx-error)}",
|
|
@@ -1116,9 +1066,13 @@ window.__ModuleLoader__.load({
|
|
|
1116
1066
|
".obx-btn--primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover,#3c3c3d)}",
|
|
1117
1067
|
"@media (prefers-color-scheme: dark){.obx-btn--primary{background:var(--dsw-alias-label-primary,#eceef2);color:var(--dsw-alias-label-primary-foreground,#17181a)}}",
|
|
1118
1068
|
".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:
|
|
1069
|
+
".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
1070
|
".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
1071
|
".obx-segmented-tab:disabled{cursor:default;opacity:.4}",
|
|
1072
|
+
// 本地改(2026-11-18):顶部组切换条(连接/权限/行为…)字号 16,比字段枚举控件大一档。
|
|
1073
|
+
".obx-group-tabs .obx-segmented-tab{font-size:16px;font-weight:500;height:32px;padding:0 14px;line-height:24px}",
|
|
1074
|
+
// 同一档字号的兜底选择器(老的 .obx-tabs 容器类仍在用,双保险)。
|
|
1075
|
+
".obx-tabs .obx-segmented-tab{font-size:16px;font-weight:500;height:32px;padding:0 14px;line-height:24px}",
|
|
1122
1076
|
// workspace 快速填入行(卡内嵌次级行;说明独占一行)
|
|
1123
1077
|
".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
1078
|
".obx-workspace-row .obx-hint{flex-basis:100%}",
|
|
@@ -1258,12 +1212,10 @@ window.__ModuleLoader__.load({
|
|
|
1258
1212
|
*/
|
|
1259
1213
|
var NUMBER_RANGE = {
|
|
1260
1214
|
port: [1, 65535],
|
|
1261
|
-
// T1 reaction:表情 ID(非负整数)。
|
|
1262
|
-
reactionEmoji: [0, undefined],
|
|
1263
|
-
interimRecallMs: [0, undefined],
|
|
1264
1215
|
rateLimitPerMinute: [0, undefined],
|
|
1265
|
-
|
|
1216
|
+
interimRecallMs: [0, undefined],
|
|
1266
1217
|
inboxQueueDelayMs: [0, undefined],
|
|
1218
|
+
deferredTimeoutMs: [0, undefined],
|
|
1267
1219
|
// #58 旁观:容量条数 / 冷却分钟 / 每日上限。
|
|
1268
1220
|
bystanderCapacity: [5, 500],
|
|
1269
1221
|
bystanderCooldownMinutes: [5, 1440],
|
|
@@ -1294,7 +1246,7 @@ window.__ModuleLoader__.load({
|
|
|
1294
1246
|
var n = coerceValue(field, raw);
|
|
1295
1247
|
if (Number.isFinite(n) && n >= range[0] && (range[1] === undefined || n <= range[1]))
|
|
1296
1248
|
return null;
|
|
1297
|
-
return range[1] === undefined ? "≥" + range[0] : range[0] + "–" + range[1];
|
|
1249
|
+
return range[1] === undefined ? "≥" + range[0] + " 的整数" : range[0] + "–" + range[1] + " 的整数";
|
|
1298
1250
|
}
|
|
1299
1251
|
/**
|
|
1300
1252
|
* 批 3(UX §5.4):冲突合并保留——保存遇 revision 冲突重拉快照后,不再
|
|
@@ -1438,7 +1390,7 @@ window.__ModuleLoader__.load({
|
|
|
1438
1390
|
return h(ReactImpl, "div", { className: "obx-segmented", role: "tablist", "aria-label": props.label }, props.options.map(function (option) { return segmentedItem(props, "tab", option); }));
|
|
1439
1391
|
};
|
|
1440
1392
|
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); }));
|
|
1393
|
+
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
1394
|
};
|
|
1443
1395
|
var input = function (props) {
|
|
1444
1396
|
var rest = Object.assign({}, props);
|
|
@@ -1687,22 +1639,21 @@ window.__ModuleLoader__.load({
|
|
|
1687
1639
|
});
|
|
1688
1640
|
// T8:notices 通知开关——每条一行开关 + 一个文案框(开关关着就不显示)。
|
|
1689
1641
|
// 文案框默认显示上游原文;改成别的就发改后的那句;改回原文等于跟随默认。
|
|
1690
|
-
|
|
1642
|
+
// 本地改(2026-11-18):notices 文案不在 ALL_FIELDS 里,之前永远不挂「非默认」
|
|
1643
|
+
// 徽标。判定统一走 nonDefaultKeys(与普通字段同源,反映已保存值)。
|
|
1644
|
+
var noticeNonDefaultBadge = function (nk) {
|
|
1645
|
+
if (nonDefaultKeys.indexOf("notices." + nk.key) < 0)
|
|
1646
|
+
return null;
|
|
1647
|
+
return h(ReactImpl, ui.Tag, { tone: "neutral", children: h(ReactImpl, "span", { title: tr("field.nonDefaultTitle", "与默认值不同") }, tr("field.nonDefault", "非默认")) });
|
|
1648
|
+
};
|
|
1649
|
+
var renderNoticeRows = function (group, byKeyEarly, consumed) {
|
|
1691
1650
|
if (group.id !== "behavior" && group.id !== "session")
|
|
1692
1651
|
return [];
|
|
1693
1652
|
var rows = [];
|
|
1694
|
-
//
|
|
1695
|
-
//
|
|
1696
|
-
// 压根不生效,别摆那儿误导。
|
|
1697
|
-
var policy = draft["newMessagePolicy"];
|
|
1653
|
+
// 本地改(2026-11-18):排队提示 / 插话提示两条都恒显(各自可关、可改文案),
|
|
1654
|
+
// 不再随「任务运行中的新消息」档位隐藏。
|
|
1698
1655
|
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;
|
|
1656
|
+
return group.id === "behavior";
|
|
1706
1657
|
});
|
|
1707
1658
|
// 用 forEach 而不是 for-of:var 在循环里只有一个变量,回调全指到最后一项,
|
|
1708
1659
|
// 点「排队提示」会改成「插话提示」——串味的根儿在这儿。
|
|
@@ -1721,7 +1672,7 @@ window.__ModuleLoader__.load({
|
|
|
1721
1672
|
});
|
|
1722
1673
|
};
|
|
1723
1674
|
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, {
|
|
1675
|
+
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
1676
|
checked: nOn, label: noticeLabel, disabled: options.disabled === true,
|
|
1726
1677
|
onChange: function () { if (options.disabled !== true)
|
|
1727
1678
|
setNoticeState({ on: !nOn }); },
|
|
@@ -1737,17 +1688,57 @@ window.__ModuleLoader__.load({
|
|
|
1737
1688
|
"aria-label": format(tr("notice.textAria", "{label}文案"), { label: noticeLabel }),
|
|
1738
1689
|
})));
|
|
1739
1690
|
}
|
|
1691
|
+
// 本地改(2026-11-18):发送错误通知挪到整组最下面(notices 段之后再插回)。
|
|
1692
|
+
if (nk.key === "steerAccepted" && group.id === "behavior")
|
|
1693
|
+
consumed["sendErrorNotice"] = "tail";
|
|
1694
|
+
// 本地改(2026-11-18):等待模型回复超时挪到「超时补发提示」下面,只在它开着时显示。
|
|
1695
|
+
if (nk.key === "deferredTimeout" && nOn && byKeyEarly["deferredTimeoutMs"] != null) {
|
|
1696
|
+
consumed["deferredTimeoutMs"] = true;
|
|
1697
|
+
rows = rows.concat(rowNodes);
|
|
1698
|
+
rows = rows.concat(byKeyEarly["deferredTimeoutMs"]);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1740
1701
|
rows = rows.concat(rowNodes);
|
|
1741
1702
|
});
|
|
1742
1703
|
return rows;
|
|
1743
1704
|
};
|
|
1744
|
-
|
|
1705
|
+
// 本地改(2026-11-18):先按 key 建索引,好把 deferredTimeoutMs 这类字段挪进 notices 段渲染。
|
|
1706
|
+
var byKeyEarly = {};
|
|
1707
|
+
group.fields.forEach(function (field, index) { byKeyEarly[field.key] = fieldNodes[index]; });
|
|
1708
|
+
var consumedNoticeFields = {};
|
|
1709
|
+
var noticeRows = renderNoticeRows(group, byKeyEarly, consumedNoticeFields);
|
|
1710
|
+
var tailFieldNodes = [];
|
|
1711
|
+
fieldNodes = fieldNodes.map(function (node, index) {
|
|
1712
|
+
var noticeField = group.fields[index];
|
|
1713
|
+
if (noticeField == null)
|
|
1714
|
+
return node;
|
|
1715
|
+
var consumedMode = consumedNoticeFields[noticeField.key];
|
|
1716
|
+
if (consumedMode === "tail") {
|
|
1717
|
+
tailFieldNodes.push(node);
|
|
1718
|
+
return null;
|
|
1719
|
+
}
|
|
1720
|
+
if (consumedMode === true)
|
|
1721
|
+
return null;
|
|
1722
|
+
return node;
|
|
1723
|
+
});
|
|
1724
|
+
fieldNodes = fieldNodes.concat(noticeRows).concat(tailFieldNodes);
|
|
1745
1725
|
// 本地加:组内分区(如权限的私聊/群聊)——按 keys 顺序取已渲染的字段节点,
|
|
1746
1726
|
// 每块前面插一个小标题(标题走词条,zh 源 = GROUPS.sections.title 自动灌入)。
|
|
1747
1727
|
if (Array.isArray(group.sections) && group.sections.length > 0) {
|
|
1748
1728
|
var byKey = {};
|
|
1749
1729
|
group.fields.forEach(function (field, index) { byKey[field.key] = fieldNodes[index]; });
|
|
1750
1730
|
var sectioned = [];
|
|
1731
|
+
// 本地加:没归进任何分区的字段先渲染 —— 落在组标题下、第一个分区标题之上
|
|
1732
|
+
//(如权限组的「管理员用户列表」)。
|
|
1733
|
+
var claimedBySection = {};
|
|
1734
|
+
for (var claimSection of group.sections) {
|
|
1735
|
+
for (var claimKey of claimSection.keys)
|
|
1736
|
+
claimedBySection[claimKey] = true;
|
|
1737
|
+
}
|
|
1738
|
+
for (var looseField of group.fields) {
|
|
1739
|
+
if (claimedBySection[looseField.key] !== true && byKey[looseField.key] != null)
|
|
1740
|
+
sectioned.push(byKey[looseField.key]);
|
|
1741
|
+
}
|
|
1751
1742
|
for (var section of group.sections) {
|
|
1752
1743
|
sectioned.push(h(ReactImpl, "h4", { className: "obx-subgroup-title", key: "sec-" + section.id }, tr("group." + group.id + ".section." + section.id, section.title)));
|
|
1753
1744
|
for (var sectionKey of section.keys) {
|
|
@@ -2155,6 +2146,15 @@ window.__ModuleLoader__.load({
|
|
|
2155
2146
|
for (var field of ALL_FIELDS) {
|
|
2156
2147
|
if (valueEquals(snapshot.config[field.key], DEFAULTS[field.key]) === false)
|
|
2157
2148
|
nonDefaultKeys.push(field.key);
|
|
2149
|
+
// 本地改(2026-11-18):notices 文案不在 ALL_FIELDS 里,按已保存值单独判一遍,
|
|
2150
|
+
// 让「插话提示/排队提示/回答回执/超时补发/限流提示」也能挂「非默认」徽标。
|
|
2151
|
+
var savedNotices = snapshot.config.notices != null && typeof snapshot.config.notices === "object" ? snapshot.config.notices : {};
|
|
2152
|
+
for (var noticeMeta of NOTICE_KEYS) {
|
|
2153
|
+
var savedNotice = Object.prototype.hasOwnProperty.call(savedNotices, noticeMeta.key) ? savedNotices[noticeMeta.key] : undefined;
|
|
2154
|
+
var savedNoticeState = noticeToDraft(savedNotice, noticeMeta.def);
|
|
2155
|
+
if (savedNoticeState.on !== true || savedNoticeState.text !== noticeMeta.def)
|
|
2156
|
+
nonDefaultKeys.push("notices." + noticeMeta.key);
|
|
2157
|
+
}
|
|
2158
2158
|
}
|
|
2159
2159
|
}
|
|
2160
2160
|
// 批 2(UX §3.2):mode 联动变暗禁用——reverse→url、forward→host/port;
|
|
@@ -2360,7 +2360,7 @@ window.__ModuleLoader__.load({
|
|
|
2360
2360
|
var sidebarEnabled = true;
|
|
2361
2361
|
try {
|
|
2362
2362
|
var sidebarSnapshot = await remote.getSettings();
|
|
2363
|
-
sidebarEnabled =
|
|
2363
|
+
sidebarEnabled = true; // 本地改(2026-11-18):首页侧边栏入口写死开启(设置项已下架)
|
|
2364
2364
|
}
|
|
2365
2365
|
catch (error) {
|
|
2366
2366
|
sidebarEnabled = true; // 快照读取失败按 schema 默认值(开)兜底
|
package/lib/inbound.js
CHANGED
|
@@ -517,37 +517,6 @@ export class InboundPipeline {
|
|
|
517
517
|
const segments = Array.isArray(data.message) ? data.message : undefined;
|
|
518
518
|
const raw = typeof data.raw_message === 'string' ? data.raw_message : '';
|
|
519
519
|
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
520
|
// T1 (PR port): 引用里带图片时把图落成本地文件喂给模型(上游只留
|
|
552
521
|
// 文字)。单图落地失败只降级为纯文字引用,不影响其余内容。
|
|
553
522
|
const imageNotes = [];
|
package/lib/index.js
CHANGED
|
@@ -258,7 +258,7 @@ export const Config = z.object({
|
|
|
258
258
|
.description('记忆文件路径列表(T4 PR 移植):支持 ~/ 展开;仅在 memoryFilesEnabled 开启且私聊会话生效'),
|
|
259
259
|
chatTailsEnabled: z.boolean().default(false)
|
|
260
260
|
.description('上下文尾巴开关(T4 PR 移植):开启后 /new 把上一会话最后几句(最多 8 条、每条 300 字符,落盘 mediaDir/chat-tails.json)带进新会话,模型开场先接上一段话头;默认关(/new 维持纯新会话)'),
|
|
261
|
-
titleSyncEnabled: z.boolean().default(
|
|
261
|
+
titleSyncEnabled: z.boolean().default(true)
|
|
262
262
|
.description('会话标题同步(T24 PR 移植):开启后每条 QQ 用户消息派发回合后触发宿主会话标题刷新(一次小 LLM 调用,等价宿主自动标题 all-prompts 的原行为——QQ 消息的来源标记不会触发宿主自动标题,本开关补上);用户在宿主里手动钉住的标题永不覆盖;标题服务未部署或刷新失败时静默降级(仅告警日志);默认关闭;改动需刷新页面/重启后生效'),
|
|
263
263
|
inboundFileMaxBytes: z.number().default(INBOUND_FILE_MAX_BYTES)
|
|
264
264
|
.description('QQ 入站文件最大字节数(直链/base64 拉取,0 = 不限制)'),
|
|
@@ -515,7 +515,7 @@ export function apply(ctx, config) {
|
|
|
515
515
|
},
|
|
516
516
|
config: {
|
|
517
517
|
botQQ: config.botQQ,
|
|
518
|
-
ignoreSelf:
|
|
518
|
+
ignoreSelf: true, // 本地改(2026-11-18):忽略自己发的消息恒开(设置项已下架)
|
|
519
519
|
requireMention: config.requireMention,
|
|
520
520
|
reactionOnMention: config.reactionOnMention,
|
|
521
521
|
reactionEmoji: config.reactionEmoji,
|
package/lib/interim.js
CHANGED
|
@@ -141,11 +141,6 @@ export class InterimTracker {
|
|
|
141
141
|
const final = chat.loopPending;
|
|
142
142
|
if (final !== null) {
|
|
143
143
|
chat.loopPending = null;
|
|
144
|
-
// 2026-11-16 双发闸:本回合已经用工具发过东西 → 正文不再重复一遍。
|
|
145
|
-
if (this.ctx.toolWroteThisTurn?.(chatId) === true) {
|
|
146
|
-
this.ctx.log('info', '本回合已用工具发过,终稿正文跳过: ' + chatId);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
144
|
// T4 (PR port 沉默哨兵):整段只有哨兵 → 只记日志,不发送。
|
|
150
145
|
if (isSilenceText(final)) {
|
|
151
146
|
this.ctx.log('info', 'silenced turn for ' + chatId);
|
|
@@ -326,12 +321,8 @@ export class InterimTracker {
|
|
|
326
321
|
if (chat.loopPending !== null) {
|
|
327
322
|
const final = chat.loopPending;
|
|
328
323
|
chat.loopPending = null;
|
|
329
|
-
// 2026-11-16 双发闸:本回合已经用工具发过东西 → 正文不再重复一遍。
|
|
330
|
-
if (this.ctx.toolWroteThisTurn?.(chatId) === true) {
|
|
331
|
-
this.ctx.log('info', '本回合已用工具发过,终稿正文跳过: ' + chatId);
|
|
332
|
-
}
|
|
333
324
|
// T4 (PR port 沉默哨兵):整段只有哨兵 → 只记日志,不发送。
|
|
334
|
-
|
|
325
|
+
if (isSilenceText(final)) {
|
|
335
326
|
this.ctx.log('info', 'silenced turn for ' + chatId);
|
|
336
327
|
}
|
|
337
328
|
else {
|
package/lib/outbound.js
CHANGED
|
@@ -13,7 +13,7 @@ import { appendFile, mkdir } from 'node:fs/promises';
|
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
import { splitChatId } from './chat.js';
|
|
15
15
|
import { OneBotActionError, OneBotNotConnectedError } from './connection.js';
|
|
16
|
-
import { extractForwardBlocks, scanSensitive,
|
|
16
|
+
import { extractForwardBlocks, scanSensitive, stripMarkdown } from './split.js';
|
|
17
17
|
import { renderTextImage } from './t2i/index.js';
|
|
18
18
|
import { describeError } from './errors.js';
|
|
19
19
|
import { TRACE_REASONS } from './trace.js';
|
|
@@ -439,20 +439,12 @@ export class OutboundPipeline {
|
|
|
439
439
|
// T2 (PR port): 纯旁白按空正文处理(同一独立开关)。
|
|
440
440
|
const plain = this.ctx.config.asideOnlySilentEnabled === true && isAsideOnly(plainRaw) ? '' : plainRaw;
|
|
441
441
|
if (plain !== '') {
|
|
442
|
-
//
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
//(防御开关内;关闭时保持上游的单 text 段)。
|
|
449
|
-
const segments = defense ? splitAtSegments(bubble) : [{ type: 'text', data: { text: bubble } }];
|
|
450
|
-
const bubbleOptions = firstBubble ? { ...options, replyTo } : { ...options, replyTo: undefined };
|
|
451
|
-
firstBubble = false;
|
|
452
|
-
const id = await this.sendMsg(chatId, segments, bubbleOptions);
|
|
453
|
-
if (id !== undefined)
|
|
454
|
-
ids.push(id);
|
|
455
|
-
}
|
|
442
|
+
// T2 (PR port): 出站防御第三闸——正文里的 [[at:QQ]] 换成真 at 段
|
|
443
|
+
//(防御开关内;关闭时保持上游的单 text 段)。
|
|
444
|
+
const segments = defense ? splitAtSegments(plain) : [{ type: 'text', data: { text: plain } }];
|
|
445
|
+
const id = await this.sendMsg(chatId, segments, { ...options, replyTo });
|
|
446
|
+
if (id !== undefined)
|
|
447
|
+
ids.push(id);
|
|
456
448
|
}
|
|
457
449
|
else {
|
|
458
450
|
// pipeline-hooks.md #30: the empty-body skip used to be silent.
|
package/lib/settings-remote.js
CHANGED
|
@@ -68,11 +68,12 @@ export const SETTINGS_GROUPS = {
|
|
|
68
68
|
// 0.10.0 重排(用户裁定方案 A):连接=通道配置 6 键;工作区/强制会话/提示词文件
|
|
69
69
|
// 归 session;allowPrivateHosts 归 media;ignoreSelf/sidebarEntryEnabled 归 behavior。
|
|
70
70
|
connection: ['mode', 'host', 'port', 'url', 'accessToken', 'botQQ'],
|
|
71
|
-
|
|
71
|
+
// 2026-11-18:allowAllUsers 从权限组摘掉——dmPolicy=open 现在就是对所有人开放,
|
|
72
|
+
// 这个开关不再有界面入口(schema 与 BOOLEAN_KEYS 保留,老配置里的键照样能读)。
|
|
73
|
+
permissions: ['requireMention', 'memberTools', 'adminUsers', 'dmPolicy', 'groupPolicy', 'allowFrom', 'groupAllowFrom', 'wakeNamesAdmin', 'wakeNamesMember', 'replyCountsAsMention', 'atAllCountsAsMention', 'reactionOnMention', 'reactionEmoji', 'faceStyle', 'pokeEnabled', 'restrictedMemberPrefix', 'sensitivePatterns'],
|
|
72
74
|
behavior: ['interimMessages', 'interimRecall', 'interimRecallMs', 'sendErrorNotice', 'unknownCommand', 'rateLimitPerMinute', 'newMessagePolicy', 'autoSteerPolicy', 'deferredTimeoutMs', 'inboxQueueEnabled', 'inboxQueueDelayMs', 'titleSyncEnabled', 'ignoreSelf', 'sidebarEntryEnabled'],
|
|
73
75
|
// #58 群聊旁观:默认全关/空(enabled=false 时其余四键零行为)。
|
|
74
|
-
|
|
75
|
-
session: ['newSessionGreeting', 'firstMessageAsUser', 'memoryFilesEnabled', 'memoryFiles', 'agentPreset', 'workspacePath', 'groupWorkspacePath', 'forceSessionId', 'dmPromptFile', 'groupPromptFile', 'startupResumeEnabled'],
|
|
76
|
+
session: ['titleSyncEnabled', 'startupResumeEnabled', 'newSessionGreeting', 'memoryFilesEnabled', 'memoryFiles', 'agentPreset', 'workspacePath', 'groupWorkspacePath', 'forceSessionId', 'dmPromptFile', 'groupPromptFile'],
|
|
76
77
|
media: ['sttEnabled', 'sttEngine', 'sttCommand', 'sttArgs', 'sttModel', 'textImageEnabled', 'textImageThreshold', 'cardFooter', 'fontFiles', 'fontFamilies', 'outboundImageMaxBytes', 'maxVoiceBytes', 'maxFileBytes', 'inboundImageMaxPx', 'inboundFileMaxBytes', 'gifFramesEnabled', 'allowPrivateHosts'],
|
|
77
78
|
diagnostics: ['actionAuditEnabled', 'traceEnabled', 'recordInbound', 'inboxRedact', 'injectEnabled', 'injectDryRun', 'logLevel'],
|
|
78
79
|
};
|
|
@@ -151,7 +152,7 @@ export const SCHEMA_DEFAULTS = {
|
|
|
151
152
|
inboxQueueEnabled: false,
|
|
152
153
|
inboxQueueDelayMs: 600,
|
|
153
154
|
// T24 (PR port 会话标题同步):开关默认关(裁定口径;钉住态标题永不覆盖)。
|
|
154
|
-
titleSyncEnabled:
|
|
155
|
+
titleSyncEnabled: true,
|
|
155
156
|
// PENDING:新会话欢迎语/首条消息按用户身份发送。
|
|
156
157
|
newSessionGreeting: true,
|
|
157
158
|
firstMessageAsUser: true,
|
|
@@ -406,7 +407,7 @@ export function validatePatch(patch) {
|
|
|
406
407
|
if (typeof value === 'number' && Number.isFinite(value) && value >= min && (max === undefined || value <= max))
|
|
407
408
|
clean[key] = value;
|
|
408
409
|
else
|
|
409
|
-
issues.push(`${key} 必须是 ${max === undefined ? `≥${min}` : `${min}–${max}`}
|
|
410
|
+
issues.push(`${key} 必须是 ${max === undefined ? `≥${min}` : `${min}–${max}`} 的整数`);
|
|
410
411
|
}
|
|
411
412
|
else if (BOOLEAN_KEYS.includes(key)) {
|
|
412
413
|
if (typeof value === 'boolean')
|
package/lib/split.js
CHANGED
|
@@ -83,56 +83,6 @@ export function extractForwardBlocks(text, defaultName) {
|
|
|
83
83
|
});
|
|
84
84
|
return { body, nodes };
|
|
85
85
|
}
|
|
86
|
-
// ── 气泡切分(2026-11-16 重打;0.11.0 把老 splitIntoBubbles 删了)──────────
|
|
87
|
-
// 主人 2026-11-07 定的规矩:正文里有换行就一行一条;没有换行且超过 30 字就
|
|
88
|
-
// 按句号/问号/叹号切;最多 5 条,超了相邻合并(从末尾往前合,尾巴最长)。
|
|
89
|
-
/** 一回合最多几个气泡。 */
|
|
90
|
-
export const BUBBLE_MAX = 5;
|
|
91
|
-
/** 单段没有换行时,超过这个字数才按句子切。 */
|
|
92
|
-
export const BUBBLE_SENTENCE_MIN = 30;
|
|
93
|
-
/**
|
|
94
|
-
* Strip trailing CJK full stops from every line.
|
|
95
|
-
* 2026-11-16 主人要求:聊天里句末不带「。」;问号、叹号照留。
|
|
96
|
-
* @param text - outbound text.
|
|
97
|
-
* @returns the same text with line-ending 「。」 removed.
|
|
98
|
-
*/
|
|
99
|
-
export function stripTrailingPeriods(text) {
|
|
100
|
-
return text
|
|
101
|
-
.split('\n')
|
|
102
|
-
.map(line => line.replace(/[。。]+[ \t]*$/u, ''))
|
|
103
|
-
.join('\n');
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Split a reply body into QQ bubbles.
|
|
107
|
-
* @param text - plain outbound text (after Markdown stripping).
|
|
108
|
-
* @returns the bubbles, or [] when the text is blank.
|
|
109
|
-
*/
|
|
110
|
-
export function splitIntoBubbles(text) {
|
|
111
|
-
// 2026-11-16 主人要的:句末的「。」一律剥掉(问号叹号照留)。
|
|
112
|
-
const raw = stripTrailingPeriods(text).trim();
|
|
113
|
-
if (raw === '')
|
|
114
|
-
return [];
|
|
115
|
-
let parts;
|
|
116
|
-
if (raw.includes('\n')) {
|
|
117
|
-
// 换行(单行或空行都算)→ 一行一条。
|
|
118
|
-
parts = raw.split('\n').map(line => line.trim()).filter(line => line !== '');
|
|
119
|
-
}
|
|
120
|
-
else if (raw.length > BUBBLE_SENTENCE_MIN) {
|
|
121
|
-
// 单段长文 → 按句末标点切,标点留在前一句尾巴上。
|
|
122
|
-
parts = raw.split(/(?<=[。!?!?;;])/u).map(part => part.trim()).filter(part => part !== '');
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return [raw];
|
|
126
|
-
}
|
|
127
|
-
if (parts.length <= 1)
|
|
128
|
-
return [raw];
|
|
129
|
-
// 超过上限:从末尾往前把相邻两条合并,保证顺序不变。
|
|
130
|
-
while (parts.length > BUBBLE_MAX) {
|
|
131
|
-
const n = parts.length;
|
|
132
|
-
parts.splice(n - 2, 2, parts[n - 2] + parts[n - 1]);
|
|
133
|
-
}
|
|
134
|
-
return parts;
|
|
135
|
-
}
|
|
136
86
|
/** Sensitive-intent audit: log a WARNING when outbound text matches. */
|
|
137
87
|
const DEFAULT_SENSITIVE_PATTERNS = [
|
|
138
88
|
/(?:rm\s+-rf|format\s+[a-z]:|diskpart|mkfs\.)/i,
|
package/lib/tools.js
CHANGED
|
@@ -325,8 +325,6 @@ export function registerTools(ctx, bridge, connection, limits, log) {
|
|
|
325
325
|
if (text.trim() === '')
|
|
326
326
|
throw new Error('qq_send_text: text 不能为空');
|
|
327
327
|
const chatId = resolveChat(bridge, exec, a.chat_id);
|
|
328
|
-
// 2026-11-16 双发闸:用工具说过话,本回合终稿正文就不再重复一遍。
|
|
329
|
-
bridge.noteToolWrite?.(chatId);
|
|
330
328
|
const replyTo = typeof a.reply_to === 'string' && a.reply_to.trim() !== '' ? a.reply_to.trim() : undefined;
|
|
331
329
|
const ids = await bridge.sendToChat(chatId, text, replyTo === undefined ? {} : { replyTo });
|
|
332
330
|
return { sent: true, messageId: ids.length > 0 ? String(ids[ids.length - 1]) : null };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-onebot-genji",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"dsh",
|