dsh-onebot-genji 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -9
- package/lib/bridge.js +220 -9
- package/lib/client.js +708 -12
- package/lib/inbound.js +8 -0
- package/lib/index.js +143 -13
- package/lib/interim.js +9 -0
- package/lib/outbound.js +137 -6
- package/lib/proactive.js +635 -0
- package/lib/prompt.js +4 -3
- package/lib/registry.js +37 -1
- package/lib/settings-remote.js +347 -7
- package/lib/stickers.js +669 -0
- package/lib/tools.js +5 -62
- package/lib/types/bridge.d.ts +40 -0
- package/lib/types/client.d.ts +121 -0
- package/lib/types/inbound.d.ts +8 -0
- package/lib/types/index.d.ts +23 -3
- package/lib/types/interim.d.ts +2 -0
- package/lib/types/outbound.d.ts +31 -0
- package/lib/types/proactive.d.ts +170 -0
- package/lib/types/registry.d.ts +10 -0
- package/lib/types/settings-remote.d.ts +84 -0
- package/lib/types/stickers.d.ts +197 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -151,9 +151,30 @@ window.__ModuleLoader__.load({
|
|
|
151
151
|
{
|
|
152
152
|
id: "behavior",
|
|
153
153
|
title: "行为",
|
|
154
|
+
// 2026-11-19(本地加):行为分「通用 / 私聊」两块。「@notices」是占位键——
|
|
155
|
+
// 渲染到这一格时把上面攒的通知段插进来(通知条目紧跟在「合并等待窗口」之后)。
|
|
156
|
+
sections: [
|
|
157
|
+
{ id: "common", title: "通用", keys: [
|
|
158
|
+
"rateLimitPerMinute", "voiceReplyEnabled", "voiceReplyProb", "stickerReplyEnabled", "stickerReplyProb",
|
|
159
|
+
"interimMessages", "interimRecall", "interimRecallMs", "sendErrorNotice", "unknownCommand",
|
|
160
|
+
"newMessagePolicy", "autoSteerPolicy", "deferredTimeoutMs", "inboxQueueEnabled", "inboxQueueDelayMs",
|
|
161
|
+
"@notices",
|
|
162
|
+
] },
|
|
163
|
+
{ id: "dm", title: "私聊", keys: [
|
|
164
|
+
"proactiveEnabled", "proactiveTargetUsers", "proactiveMinIdleMinutes", "proactiveMinGapMinutes",
|
|
165
|
+
"proactiveMaxPerDay", "proactiveQuietFrom", "proactiveQuietTo", "proactiveAttemptGapMinutes",
|
|
166
|
+
"proactiveBurstProb", "proactiveFollowupEnabled", "proactiveFollowupMinSec",
|
|
167
|
+
"proactiveFollowupMaxSec", "proactiveFollowupProb", "proactiveFollowupMaxPerDay",
|
|
168
|
+
] },
|
|
169
|
+
],
|
|
154
170
|
fields: [
|
|
155
171
|
// T7 转正:入站连发合并(开关默认关;合并窗口 600ms,首条起最多 3000ms 封顶)。
|
|
156
172
|
{ key: "rateLimitPerMinute", label: "每分钟消息频率上限", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
173
|
+
// 2026-11-19(本地加):回合形式掷骰改配置(原写死语音 10%、表情包 39%)。
|
|
174
|
+
{ key: "voiceReplyEnabled", label: "回复转成语音", type: "boolean", hint: "开着才有概率把一回合的回复变成语音条" },
|
|
175
|
+
{ key: "voiceReplyProb", label: "语音概率", type: "number", hint: "0–1 之间的小数,默认 0.1(10%)", showIf: { key: "voiceReplyEnabled", value: true } },
|
|
176
|
+
{ key: "stickerReplyEnabled", label: "发表情包", type: "boolean", hint: "开着才有概率在回复里带一张表情包" },
|
|
177
|
+
{ key: "stickerReplyProb", label: "表情包概率", type: "number", hint: "0–1 之间的小数,默认 0.39(39%)", showIf: { key: "stickerReplyEnabled", value: true } },
|
|
157
178
|
{ key: "unknownCommand", label: "未知命令处理", type: "enum", options: ["intercept", "passthrough"], optionLabels: { intercept: "拦截", passthrough: "透传" } },
|
|
158
179
|
{ key: "newMessagePolicy", label: "任务运行中的新消息", type: "enum", options: ["queue", "steer"], optionLabels: { queue: "排队", steer: "插话" } },
|
|
159
180
|
{ key: "autoSteerPolicy", label: "自动插话资格", showIf: { key: "newMessagePolicy", value: "steer" }, type: "enum", options: ["admin", "all"], optionLabels: { admin: "仅管理员", all: "所有成员" } },
|
|
@@ -164,10 +185,37 @@ window.__ModuleLoader__.load({
|
|
|
164
185
|
{ key: "interimRecallMs", label: "中间消息保留时长(毫秒)", showIf: { key: "interimRecall", value: true }, type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
165
186
|
{ key: "sendErrorNotice", label: "发送错误通知", type: "boolean" },
|
|
166
187
|
{ key: "deferredTimeoutMs", label: "等待模型回复超时(毫秒)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数" },
|
|
188
|
+
// 2026-11-19(本地加):主动搭话——排在「行为 → 私聊」分区(原来在「权限 → 私聊」)。
|
|
189
|
+
// 原文在 lib/proactive.js,配置读宿主 Config.proactive(面板键带 proactive 前缀)。
|
|
190
|
+
{ key: "proactiveEnabled", label: "主动搭话", type: "boolean", hint: "隔一阵自己来找你(安静时段和频率都由下面几项控制)" },
|
|
191
|
+
{ key: "proactiveTargetUsers", label: "搭话目标用户", type: "stringArray", hint: "留空等于管理员列表", showIf: { key: "proactiveEnabled", value: true } },
|
|
192
|
+
{ key: "proactiveMinIdleMinutes", label: "你安静多久才搭话(分钟)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
193
|
+
{ key: "proactiveMinGapMinutes", label: "两次搭话最小间隔(分钟)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
194
|
+
{ key: "proactiveMaxPerDay", label: "每天最多搭话次数", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
195
|
+
{ key: "proactiveQuietFrom", label: "安静时段起(小时)", type: "number", pattern: "^[0-9]+$", patternHint: "0–23 的整数", hint: "这段时间内不发;起止填一样 = 不设安静时段", showIf: { key: "proactiveEnabled", value: true } },
|
|
196
|
+
{ key: "proactiveQuietTo", label: "安静时段止(小时)", type: "number", pattern: "^[0-9]+$", patternHint: "0–23 的整数", showIf: { key: "proactiveEnabled", value: true } },
|
|
197
|
+
{ key: "proactiveAttemptGapMinutes", label: "判定间隔(分钟)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", hint: "每次判定要不要发话的最小间隔", showIf: { key: "proactiveEnabled", value: true } },
|
|
198
|
+
{ key: "proactiveBurstProb", label: "连发概率", type: "number", hint: "0–1 之间的小数,比如 0.5;越大越容易一次说两三句", showIf: { key: "proactiveEnabled", value: true } },
|
|
199
|
+
{ key: "proactiveFollowupEnabled", label: "补一句话", type: "boolean", hint: "你先开口后,过一小会儿再补一句", showIf: { key: "proactiveEnabled", value: true } },
|
|
200
|
+
{ key: "proactiveFollowupMinSec", label: "补话最短等待(秒)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveFollowupEnabled", values: [true] } },
|
|
201
|
+
{ key: "proactiveFollowupMaxSec", label: "补话最长等待(秒)", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveFollowupEnabled", values: [true] } },
|
|
202
|
+
{ key: "proactiveFollowupProb", label: "补话概率", type: "number", hint: "0–1 之间的小数", showIf: { key: "proactiveFollowupEnabled", values: [true] } },
|
|
203
|
+
{ key: "proactiveFollowupMaxPerDay", label: "补话每天上限", type: "number", pattern: "^[0-9]+$", patternHint: "≥0 的整数", showIf: { key: "proactiveFollowupEnabled", values: [true] } },
|
|
167
204
|
// T11:DSH 首页左侧边栏入口开关(关=不注册侧边栏入口与配对面板;
|
|
168
205
|
// 插件菜单下的设置页入口保留。客户端按启动时快照决定,改完刷新生效)。
|
|
169
206
|
],
|
|
170
207
|
},
|
|
208
|
+
{
|
|
209
|
+
// 2026-11-19(本地加):表情包库。上面两个是配置项,下面挂一块自定义
|
|
210
|
+
// 「表情包库」面板(列表/新增/删除/审核),走 remote 方法不占键表。
|
|
211
|
+
id: "stickers",
|
|
212
|
+
title: "表情包",
|
|
213
|
+
desc: "表情包管理",
|
|
214
|
+
fields: [
|
|
215
|
+
{ key: "stickerAutoCollect", label: "自动收集表情包", type: "boolean", hint: "收到的新图自动收进「未审核」,不会直接进聊天" },
|
|
216
|
+
{ key: "stickerRoot", label: "表情包库目录", type: "string", placeholder: "留空 = %USERPROFILE%\\.dsh\\dsh-onebot-genji\\stickers", hint: "里面有「已审核」(聊天只从这里挑图)与「未审核」两个子目录" },
|
|
217
|
+
],
|
|
218
|
+
},
|
|
171
219
|
{
|
|
172
220
|
id: "session",
|
|
173
221
|
title: "会话",
|
|
@@ -250,7 +298,7 @@ window.__ModuleLoader__.load({
|
|
|
250
298
|
forceSessionId: "",
|
|
251
299
|
dmPromptFile: "", // T4 拍板默认关(贡献者默认 ~/.dsh 路径不收)
|
|
252
300
|
groupPromptFile: "", // 同上
|
|
253
|
-
groupContextLines:
|
|
301
|
+
groupContextLines: 3, // 本地加(2026-11-18):被 @ 时带上的群聊上下文条数;默认 3
|
|
254
302
|
requireMention: true,
|
|
255
303
|
memberTools: "none",
|
|
256
304
|
bystanderEnabled: false,
|
|
@@ -278,6 +326,27 @@ window.__ModuleLoader__.load({
|
|
|
278
326
|
sendErrorNotice: false,
|
|
279
327
|
unknownCommand: "intercept",
|
|
280
328
|
rateLimitPerMinute: 30,
|
|
329
|
+
voiceReplyEnabled: true,
|
|
330
|
+
voiceReplyProb: 0.1,
|
|
331
|
+
stickerReplyEnabled: true,
|
|
332
|
+
stickerReplyProb: 0.39,
|
|
333
|
+
stickerAutoCollect: true,
|
|
334
|
+
stickerRoot: "",
|
|
335
|
+
// 2026-11-19(本地加):主动搭话(宿主 Config.proactive 的扁平镜像)。
|
|
336
|
+
proactiveEnabled: true,
|
|
337
|
+
proactiveTargetUsers: [],
|
|
338
|
+
proactiveMinIdleMinutes: 60,
|
|
339
|
+
proactiveMinGapMinutes: 90,
|
|
340
|
+
proactiveMaxPerDay: 6,
|
|
341
|
+
proactiveQuietFrom: 22,
|
|
342
|
+
proactiveQuietTo: 6,
|
|
343
|
+
proactiveAttemptGapMinutes: 30,
|
|
344
|
+
proactiveBurstProb: 0.5,
|
|
345
|
+
proactiveFollowupEnabled: true,
|
|
346
|
+
proactiveFollowupMinSec: 45,
|
|
347
|
+
proactiveFollowupMaxSec: 180,
|
|
348
|
+
proactiveFollowupProb: 0.3,
|
|
349
|
+
proactiveFollowupMaxPerDay: 3,
|
|
281
350
|
newMessagePolicy: "steer",
|
|
282
351
|
autoSteerPolicy: "admin",
|
|
283
352
|
deferredTimeoutMs: 600000,
|
|
@@ -472,6 +541,9 @@ window.__ModuleLoader__.load({
|
|
|
472
541
|
dmPromptFile: vString(0, 1024),
|
|
473
542
|
groupPromptFile: vString(0, 1024),
|
|
474
543
|
groupContextLines: vNumber(),
|
|
544
|
+
// 本地加(2026-11-19):群聊 @ 表情回执两键(index.ts 早已有 schema,面板这条一直缺)。
|
|
545
|
+
reactionOnMention: vBoolean(),
|
|
546
|
+
reactionEmoji: vNumber(0, 1000),
|
|
475
547
|
requireMention: vBoolean(),
|
|
476
548
|
memberTools: vEnum(["none", "send", "all"]),
|
|
477
549
|
bystanderEnabled: vBoolean(),
|
|
@@ -497,6 +569,12 @@ window.__ModuleLoader__.load({
|
|
|
497
569
|
sendErrorNotice: vBoolean(),
|
|
498
570
|
unknownCommand: vEnum(["intercept", "passthrough"]),
|
|
499
571
|
rateLimitPerMinute: vNumber(),
|
|
572
|
+
voiceReplyEnabled: vBoolean(),
|
|
573
|
+
voiceReplyProb: vNumber(0, 1),
|
|
574
|
+
stickerReplyEnabled: vBoolean(),
|
|
575
|
+
stickerReplyProb: vNumber(0, 1),
|
|
576
|
+
stickerAutoCollect: vBoolean(),
|
|
577
|
+
stickerRoot: vString(0, 512),
|
|
500
578
|
newMessagePolicy: vEnum(["queue", "steer"]),
|
|
501
579
|
autoSteerPolicy: vEnum(["admin", "all"]),
|
|
502
580
|
deferredTimeoutMs: vNumber(),
|
|
@@ -541,6 +619,21 @@ window.__ModuleLoader__.load({
|
|
|
541
619
|
inboxQueueDelayMs: vNumber(),
|
|
542
620
|
// T24:QQ 会话标题同步开关。
|
|
543
621
|
titleSyncEnabled: vBoolean(),
|
|
622
|
+
// 2026-11-19(本地加):主动搭话 17 键(不在此声明会被网关剥掉)。
|
|
623
|
+
proactiveEnabled: vBoolean(),
|
|
624
|
+
proactiveTargetUsers: vArray(vString(0, 64)),
|
|
625
|
+
proactiveMinIdleMinutes: vNumber(),
|
|
626
|
+
proactiveMinGapMinutes: vNumber(),
|
|
627
|
+
proactiveMaxPerDay: vNumber(),
|
|
628
|
+
proactiveQuietFrom: vNumber(),
|
|
629
|
+
proactiveQuietTo: vNumber(),
|
|
630
|
+
proactiveAttemptGapMinutes: vNumber(),
|
|
631
|
+
proactiveBurstProb: vNumber(),
|
|
632
|
+
proactiveFollowupEnabled: vBoolean(),
|
|
633
|
+
proactiveFollowupMinSec: vNumber(),
|
|
634
|
+
proactiveFollowupMaxSec: vNumber(),
|
|
635
|
+
proactiveFollowupProb: vNumber(),
|
|
636
|
+
proactiveFollowupMaxPerDay: vNumber(),
|
|
544
637
|
notices: vObject({
|
|
545
638
|
steerAccepted: vNoticeValue(),
|
|
546
639
|
queue: vNoticeValue(),
|
|
@@ -579,6 +672,10 @@ window.__ModuleLoader__.load({
|
|
|
579
672
|
forceSessionId: vOptional(vString(0, 256)),
|
|
580
673
|
dmPromptFile: vOptional(vString(0, 1024)),
|
|
581
674
|
groupPromptFile: vOptional(vString(0, 1024)),
|
|
675
|
+
// 本地加(2026-11-19):这三个键补进 patchSchema,否则网关按 schema 剥键、面板改了也不落盘。
|
|
676
|
+
groupContextLines: vOptional(vNumber(0, 200)),
|
|
677
|
+
reactionOnMention: vOptional(vBoolean()),
|
|
678
|
+
reactionEmoji: vOptional(vNumber(0, 1000)),
|
|
582
679
|
allowPrivateHosts: vOptional(vBoolean()),
|
|
583
680
|
ignoreSelf: vOptional(vBoolean()),
|
|
584
681
|
sidebarEntryEnabled: vOptional(vBoolean()),
|
|
@@ -609,6 +706,12 @@ window.__ModuleLoader__.load({
|
|
|
609
706
|
sendErrorNotice: vOptional(vBoolean()),
|
|
610
707
|
unknownCommand: vOptional(vEnum(["intercept", "passthrough"])),
|
|
611
708
|
rateLimitPerMinute: vOptional(vNumber(0)),
|
|
709
|
+
voiceReplyEnabled: vOptional(vBoolean()),
|
|
710
|
+
voiceReplyProb: vOptional(vNumber(0, 1)),
|
|
711
|
+
stickerReplyEnabled: vOptional(vBoolean()),
|
|
712
|
+
stickerReplyProb: vOptional(vNumber(0, 1)),
|
|
713
|
+
stickerAutoCollect: vOptional(vBoolean()),
|
|
714
|
+
stickerRoot: vOptional(vString(0, 512)),
|
|
612
715
|
newMessagePolicy: vOptional(vEnum(["queue", "steer"])),
|
|
613
716
|
autoSteerPolicy: vOptional(vEnum(["admin", "all"])),
|
|
614
717
|
deferredTimeoutMs: vOptional(vNumber(0)),
|
|
@@ -647,6 +750,21 @@ window.__ModuleLoader__.load({
|
|
|
647
750
|
inboxRedact: vOptional(vBoolean()),
|
|
648
751
|
injectEnabled: vOptional(vBoolean()),
|
|
649
752
|
injectDryRun: vOptional(vBoolean()),
|
|
753
|
+
// 2026-11-19(本地加):主动搭话 17 键(缺声明 = 编辑被静默丢弃)。
|
|
754
|
+
proactiveEnabled: vOptional(vBoolean()),
|
|
755
|
+
proactiveTargetUsers: vOptional(vArray(vString(0, 64))),
|
|
756
|
+
proactiveMinIdleMinutes: vOptional(vNumber(0, 1440)),
|
|
757
|
+
proactiveMinGapMinutes: vOptional(vNumber(0, 1440)),
|
|
758
|
+
proactiveMaxPerDay: vOptional(vNumber(1, 48)),
|
|
759
|
+
proactiveQuietFrom: vOptional(vNumber(0, 23)),
|
|
760
|
+
proactiveQuietTo: vOptional(vNumber(0, 23)),
|
|
761
|
+
proactiveAttemptGapMinutes: vOptional(vNumber(0, 1440)),
|
|
762
|
+
proactiveBurstProb: vOptional(vNumber(0, 1)),
|
|
763
|
+
proactiveFollowupEnabled: vOptional(vBoolean()),
|
|
764
|
+
proactiveFollowupMinSec: vOptional(vNumber(0, 3600)),
|
|
765
|
+
proactiveFollowupMaxSec: vOptional(vNumber(0, 3600)),
|
|
766
|
+
proactiveFollowupProb: vOptional(vNumber(0, 1)),
|
|
767
|
+
proactiveFollowupMaxPerDay: vOptional(vNumber(0, 48)),
|
|
650
768
|
notices: vOptional(vObject({
|
|
651
769
|
steerAccepted: vNoticeValue(),
|
|
652
770
|
queue: vNoticeValue(),
|
|
@@ -683,6 +801,56 @@ window.__ModuleLoader__.load({
|
|
|
683
801
|
result: strictCodec(typeSymbol != null ? typeSymbol : "OnebotSettingsSnapshot", resultSchema || snapshotSchema),
|
|
684
802
|
};
|
|
685
803
|
}
|
|
804
|
+
// 2026-11-19(本地加):表情包库 remote 方法的返回 schema
|
|
805
|
+
// (与 host lib/settings-remote.js 的 snapshotOf / readImage 结构逐字对齐)。
|
|
806
|
+
var stickerItemSchema = vObject({
|
|
807
|
+
hash: vString(1, 64),
|
|
808
|
+
file: vString(0, 256),
|
|
809
|
+
approved: vBoolean(),
|
|
810
|
+
dir: vString(0, 64),
|
|
811
|
+
tags: vArray(vString(0, 256)),
|
|
812
|
+
description: vString(0, 8192),
|
|
813
|
+
bytes: vInt(0),
|
|
814
|
+
addedAt: vInt(0),
|
|
815
|
+
exists: vBoolean(),
|
|
816
|
+
});
|
|
817
|
+
var stickerStatsSchema = vObject({
|
|
818
|
+
total: vInt(0),
|
|
819
|
+
approved: vInt(0),
|
|
820
|
+
pending: vInt(0),
|
|
821
|
+
bytes: vInt(0),
|
|
822
|
+
root: vString(0, 1024),
|
|
823
|
+
});
|
|
824
|
+
var stickerResultSchema = vObject({
|
|
825
|
+
hash: vString(0, 64),
|
|
826
|
+
ok: vBoolean(),
|
|
827
|
+
description: vOptional(vString(0, 8192)),
|
|
828
|
+
tags: vOptional(vArray(vString(0, 256))),
|
|
829
|
+
});
|
|
830
|
+
var stickerSnapshotSchema = vObject({
|
|
831
|
+
ok: vBoolean(),
|
|
832
|
+
root: vString(0, 1024),
|
|
833
|
+
autoCollect: vBoolean(),
|
|
834
|
+
approvedDir: vString(0, 1024),
|
|
835
|
+
pendingDir: vString(0, 1024),
|
|
836
|
+
stats: stickerStatsSchema,
|
|
837
|
+
items: vArray(stickerItemSchema),
|
|
838
|
+
added: vOptional(vObject({
|
|
839
|
+
added: vBoolean(),
|
|
840
|
+
reason: vOptional(vString(0, 256)),
|
|
841
|
+
item: vOptional(stickerItemSchema),
|
|
842
|
+
})),
|
|
843
|
+
removed: vOptional(vArray(vObject({ hash: vString(0, 64), ok: vBoolean() }))),
|
|
844
|
+
results: vOptional(vArray(stickerResultSchema)),
|
|
845
|
+
});
|
|
846
|
+
var stickerImageSchema = vObject({
|
|
847
|
+
ok: vBoolean(),
|
|
848
|
+
hash: vString(0, 64),
|
|
849
|
+
dataUrl: vOptional(vString(0, 20_000_000)),
|
|
850
|
+
bytes: vOptional(vInt(0)),
|
|
851
|
+
mime: vOptional(vString(0, 64)),
|
|
852
|
+
tooLarge: vOptional(vBoolean()),
|
|
853
|
+
});
|
|
686
854
|
var ONEBOT_SETTINGS_DESCRIPTORS = [
|
|
687
855
|
onebotMethod("getSettings", []),
|
|
688
856
|
onebotMethod("updateSettings", [
|
|
@@ -690,6 +858,24 @@ window.__ModuleLoader__.load({
|
|
|
690
858
|
jsonParameter("expectedRevision", "number", vOptional(vInt(0))),
|
|
691
859
|
]),
|
|
692
860
|
onebotMethod("listWorkspaces", [], workspaceListSchema, "WorkspaceListResult"),
|
|
861
|
+
// 2026-11-19(本地加):表情包库(列表 / 新增 / 删除 / 审核 / 撤回 / 看图 / 重新识别 / 改描述)。
|
|
862
|
+
onebotMethod("listStickers", [], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
863
|
+
onebotMethod("addSticker", [
|
|
864
|
+
jsonParameter("name", "string", vString(0, 256)),
|
|
865
|
+
jsonParameter("dataUrl", "string", vString(0, 20_000_000)),
|
|
866
|
+
], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
867
|
+
onebotMethod("deleteSticker", [jsonParameter("hashes", "string[]", vArray(vString(0, 64)))], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
868
|
+
onebotMethod("approveStickers", [jsonParameter("hashes", "string[]", vArray(vString(0, 64)))], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
869
|
+
onebotMethod("unapproveStickers", [jsonParameter("hashes", "string[]", vArray(vString(0, 64)))], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
870
|
+
onebotMethod("readSticker", [jsonParameter("hash", "string", vString(0, 64))], stickerImageSchema, "OnebotStickerImage"),
|
|
871
|
+
onebotMethod("retagStickers", [jsonParameter("hashes", "string[]", vArray(vString(0, 64)))], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
872
|
+
onebotMethod("updateSticker", [
|
|
873
|
+
jsonParameter("hash", "string", vString(0, 64)),
|
|
874
|
+
jsonParameter("patch", "object", vObject({
|
|
875
|
+
description: vOptional(vString(0, 8192)),
|
|
876
|
+
tags: vOptional(vArray(vString(0, 256))),
|
|
877
|
+
})),
|
|
878
|
+
], stickerSnapshotSchema, "OnebotStickerSnapshot"),
|
|
693
879
|
];
|
|
694
880
|
var ONEBOT_SETTINGS_REMOTE = { package: PLUGIN_ID, descriptors: ONEBOT_SETTINGS_DESCRIPTORS };
|
|
695
881
|
//#endregion
|
|
@@ -884,6 +1070,25 @@ window.__ModuleLoader__.load({
|
|
|
884
1070
|
sendErrorNotice: { label: "Send error notices" },
|
|
885
1071
|
unknownCommand: { label: "Unknown command handling", options: { intercept: "Intercept", passthrough: "Pass through" } },
|
|
886
1072
|
rateLimitPerMinute: { label: "Per-minute message rate cap" },
|
|
1073
|
+
voiceReplyEnabled: { label: "Reply as voice", hint: "When on, a turn may become a voice clip" },
|
|
1074
|
+
voiceReplyProb: { label: "Voice probability", hint: "0–1, default 0.1 (10%)" },
|
|
1075
|
+
stickerReplyEnabled: { label: "Reply with sticker", hint: "When on, a turn may include a sticker" },
|
|
1076
|
+
stickerReplyProb: { label: "Sticker probability", hint: "0–1, default 0.39 (39%)" },
|
|
1077
|
+
// 2026-11-19(本地加):主动搭话英文词条(从权限组搬过来;缺了会回落 zh,插件启动时打警告)。
|
|
1078
|
+
proactiveEnabled: { label: "Proactive messages", hint: "Come find you on my own after a while (quiet hours and frequency below)" },
|
|
1079
|
+
proactiveTargetUsers: { label: "Proactive target users", hint: "Empty = the admin list" },
|
|
1080
|
+
proactiveMinIdleMinutes: { label: "Idle minutes before reaching out" },
|
|
1081
|
+
proactiveMinGapMinutes: { label: "Min gap between proactive messages (minutes)" },
|
|
1082
|
+
proactiveMaxPerDay: { label: "Max proactive messages per day" },
|
|
1083
|
+
proactiveQuietFrom: { label: "Quiet hours start (hour)", hint: "Nothing is sent in this window; same start and end = no quiet hours" },
|
|
1084
|
+
proactiveQuietTo: { label: "Quiet hours end (hour)" },
|
|
1085
|
+
proactiveAttemptGapMinutes: { label: "Decision interval (minutes)", hint: "Minimum gap between two decide-run checks" },
|
|
1086
|
+
proactiveBurstProb: { label: "Burst probability", hint: "Decimal 0-1, e.g. 0.5; higher = more likely to send two or three lines at once" },
|
|
1087
|
+
proactiveFollowupEnabled: { label: "Follow-up line", hint: "After you speak first, add one more line a bit later" },
|
|
1088
|
+
proactiveFollowupMinSec: { label: "Follow-up min wait (seconds)" },
|
|
1089
|
+
proactiveFollowupMaxSec: { label: "Follow-up max wait (seconds)" },
|
|
1090
|
+
proactiveFollowupProb: { label: "Follow-up probability", hint: "Decimal 0-1" },
|
|
1091
|
+
proactiveFollowupMaxPerDay: { label: "Follow-up daily cap" },
|
|
887
1092
|
newMessagePolicy: { label: "New messages while a task runs", options: { queue: "Queue", steer: "Steer" } },
|
|
888
1093
|
autoSteerPolicy: { label: "Auto-steer eligibility", options: { admin: "Admins only", all: "All members" } },
|
|
889
1094
|
deferredTimeoutMs: { label: "Model reply wait timeout (ms)" },
|
|
@@ -891,6 +1096,13 @@ window.__ModuleLoader__.load({
|
|
|
891
1096
|
inboxQueueDelayMs: { label: "Merge wait window (ms)", hint: "Each message waits one window before delivery; 0 = immediately" },
|
|
892
1097
|
},
|
|
893
1098
|
},
|
|
1099
|
+
stickers: {
|
|
1100
|
+
title: "Stickers",
|
|
1101
|
+
fields: {
|
|
1102
|
+
stickerAutoCollect: { label: "Auto-collect stickers", hint: "New images land in Pending and never go into chats directly" },
|
|
1103
|
+
stickerRoot: { label: "Sticker library root", placeholder: "Empty = %USERPROFILE%\\.dsh\\dsh-onebot-genji\\stickers", hint: "Holds 已审核 (approved — chats only pick from here) and 未审核 (pending)" },
|
|
1104
|
+
},
|
|
1105
|
+
},
|
|
894
1106
|
session: {
|
|
895
1107
|
title: "Session",
|
|
896
1108
|
fields: {
|
|
@@ -1018,6 +1230,9 @@ window.__ModuleLoader__.load({
|
|
|
1018
1230
|
".obx-body{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:16px;padding:20px 24px 32px;-webkit-overflow-scrolling:touch}",
|
|
1019
1231
|
// 反馈行(原生表单语义:错误/成功为彩色文本行,不再是描边横幅)
|
|
1020
1232
|
".obx-effect{margin:0;color:var(--obx-fg-tertiary);font-size:12px;line-height:18px}",
|
|
1233
|
+
// 本地改(2026-11-19):热生效提示移到 navBar 上面,独占一行贴顶。
|
|
1234
|
+
".obx-effect--top{flex:none;padding:20px 24px 0}",
|
|
1235
|
+
".obx-effect--top+.obx-head{padding-top:10px}",
|
|
1021
1236
|
".obx-error{margin:0;color:var(--obx-error);font-size:12px;line-height:18px;white-space:pre-wrap}",
|
|
1022
1237
|
".obx-notice{margin:0;color:var(--obx-fg-secondary);font-size:12px;line-height:18px;white-space:pre-wrap}",
|
|
1023
1238
|
".obx-toast-wrap{position:sticky;top:0;z-index:20;display:flex;flex-direction:column;gap:4px}",
|
|
@@ -1026,7 +1241,68 @@ window.__ModuleLoader__.load({
|
|
|
1026
1241
|
".obx-group-head{display:flex;align-items:baseline;gap:8px;padding-bottom:4px;flex-wrap:wrap}",
|
|
1027
1242
|
".obx-group-title{margin:0;font-size:16px;font-weight:500;line-height:22px}",
|
|
1028
1243
|
".obx-group-desc{margin:0;color:var(--obx-fg-tertiary);font-size:12px;line-height:18px}",
|
|
1029
|
-
".obx-subgroup-title{margin:
|
|
1244
|
+
".obx-subgroup-title{margin:16px 0 2px;font-size:16px;font-weight:600;line-height:24px}",
|
|
1245
|
+
// 2026-11-19(本地加):表情包库面板样式。
|
|
1246
|
+
".obx-group-stack{display:flex;flex-direction:column;gap:6px}",
|
|
1247
|
+
".obx-sticker-panel{display:flex;flex-direction:column;gap:8px;padding-bottom:12px}",
|
|
1248
|
+
".obx-sticker-error{margin:0;padding:6px 10px;border-radius:6px;background:rgba(217,74,74,0.12);color:#d94a4a;font-size:13px;line-height:20px;word-break:break-all}",
|
|
1249
|
+
".obx-sticker-debug{margin:0;padding:6px 10px;border-radius:6px;background:rgba(120,120,120,0.14);color:#8a8a8a;font-size:12px;line-height:18px;word-break:break-all;font-family:monospace}",
|
|
1250
|
+
".obx-sticker-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}",
|
|
1251
|
+
".obx-sticker-upload{position:relative;display:inline-flex;align-items:center;font-size:13px;cursor:pointer;border:1px dashed currentColor;border-radius:8px;padding:4px 10px;opacity:.8}",
|
|
1252
|
+
".obx-sticker-upload input{position:absolute;inset:0;opacity:0;cursor:pointer}",
|
|
1253
|
+
".obx-sticker-row{display:grid;grid-template-columns:70px minmax(120px,1fr) minmax(80px,160px) auto auto auto auto;gap:8px;align-items:center;padding:4px 0;border-bottom:1px solid rgba(128,128,128,.18)}",
|
|
1254
|
+
".obx-sticker-grid{display:flex;flex-wrap:wrap;gap:10px;padding:4px 0}",
|
|
1255
|
+
".obx-sticker-card{margin:0;flex:0 0 calc((100% - 50px) / 6);max-width:calc((100% - 50px) / 6);min-width:0;display:flex;flex-direction:column;gap:4px;padding:6px;border-radius:10px;border:1px solid rgba(128,128,128,.22);background:rgba(128,128,128,.06)}",
|
|
1256
|
+
".obx-sticker-thumb{width:100%;aspect-ratio:1 / 1;height:auto;display:flex;align-items:center;justify-content:center;border-radius:8px;overflow:hidden;background:rgba(128,128,128,.12);cursor:zoom-in;position:relative}",
|
|
1257
|
+
// 悬停提示(2026-11-19 主人指定):底部居中的白字细边胶囊,鼠标移上去才出现。
|
|
1258
|
+
".obx-sticker-thumb-hint{position:absolute;left:50%;bottom:6px;transform:translateX(-50%);padding:1px 7px;border-radius:6px;border:1px solid rgba(255,255,255,.72);background:rgba(0,0,0,.62);color:#fff;font-size:12px;line-height:18px;white-space:nowrap;opacity:0;transition:opacity .12s ease;pointer-events:none}",
|
|
1259
|
+
".obx-sticker-thumb:hover .obx-sticker-thumb-hint,.obx-sticker-thumb:focus-visible .obx-sticker-thumb-hint{opacity:1}",
|
|
1260
|
+
".obx-sticker-panel .obx-sticker-title{font-size:16px}",
|
|
1261
|
+
".obx-lightbox{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.78)}",
|
|
1262
|
+
".obx-lightbox-img{max-width:92vw;max-height:92vh;border-radius:8px}",
|
|
1263
|
+
".obx-lightbox-close{position:absolute;top:16px;right:20px;font-size:26px;line-height:1;color:#fff;background:none;border:none;cursor:pointer}",
|
|
1264
|
+
// 2026-11-19 主人要求:未审核标题与按钮同一行,按钮靠右,各带底色;刷新单独放上面一行。
|
|
1265
|
+
".obx-sticker-statline{display:flex;align-items:center;justify-content:space-between;gap:8px}",
|
|
1266
|
+
".obx-sticker-statline .obx-hint{margin:0;flex:1 1 auto;min-width:0}",
|
|
1267
|
+
".obx-sticker-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:16px 0 2px}",
|
|
1268
|
+
".obx-sticker-head .obx-subgroup-title{margin:0}",
|
|
1269
|
+
".obx-sticker-head-actions,.obx-sticker-statline{display:flex;align-items:center;gap:6px}",
|
|
1270
|
+
".obx-accent-btn.obx-accent-btn{background:#2f6ea8;border-color:#265a8a;color:#fff}",
|
|
1271
|
+
".obx-accent-btn.obx-accent-btn:hover{background:#3579b8;border-color:#2a628f;color:#fff}",
|
|
1272
|
+
".obx-accent-btn.obx-accent-btn:disabled{opacity:.55}",
|
|
1273
|
+
".obx-green-btn.obx-green-btn{background:#2f8f5b;border-color:#26744a;color:#fff}",
|
|
1274
|
+
".obx-green-btn.obx-green-btn:hover{background:#359a62;border-color:#2b7f50;color:#fff}",
|
|
1275
|
+
".obx-green-btn.obx-green-btn:disabled{opacity:.55}",
|
|
1276
|
+
".obx-light-btn.obx-light-btn{background:#fff;border-color:#c9c9c9;color:#111}",
|
|
1277
|
+
".obx-light-btn.obx-light-btn:hover{background:#f2f2f2;border-color:#b5b5b5;color:#111}",
|
|
1278
|
+
".obx-light-btn.obx-light-btn:disabled{opacity:.55}",
|
|
1279
|
+
// 2026-11-19 主人要求:「恢复默认」红字红边暗底(危险操作),「重新加载」白底黑字。
|
|
1280
|
+
".obx-danger-outline.obx-danger-outline{background:rgba(90,32,32,.22);border:1px solid #6d2b2b;color:#ff5f5f}",
|
|
1281
|
+
".obx-danger-outline.obx-danger-outline:hover{background:rgba(150,50,50,.3);border:1px solid #8a3737;color:#ff7a7a}",
|
|
1282
|
+
".obx-danger-outline.obx-danger-outline:disabled{opacity:.5}",
|
|
1283
|
+
".obx-sticker-thumb img{width:100%;height:100%;object-fit:cover;display:block;cursor:inherit}",
|
|
1284
|
+
".obx-sticker-thumb-wait{font-size:12px;opacity:.5}",
|
|
1285
|
+
".obx-sticker-card-desc{margin:0;font-size:12px;line-height:16px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-all}",
|
|
1286
|
+
".obx-sticker-card-tags{font-size:11px;opacity:.55;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
1287
|
+
// 2026-11-19 主人要求:描述 / 标签悬停出铅笔,点开变输入框。
|
|
1288
|
+
".obx-sticker-editable{display:inline-flex;align-items:center;gap:3px;max-width:100%;min-width:0}",
|
|
1289
|
+
".obx-sticker-edit-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}",
|
|
1290
|
+
".obx-sticker-edit-btn{opacity:0;flex:0 0 auto;background:none;border:none;padding:0 2px;cursor:pointer;color:inherit;font-size:12px;line-height:1;transition:opacity .12s ease}",
|
|
1291
|
+
".obx-sticker-card:hover .obx-sticker-edit-btn,.obx-sticker-edit-btn:focus-visible{opacity:.7}",
|
|
1292
|
+
".obx-sticker-edit-input{width:100%;min-width:0;font:inherit;font-size:12px;line-height:16px;padding:3px 5px;border-radius:4px;resize:vertical;min-height:46px;border:1px solid rgba(128,128,128,.55);background:rgba(128,128,128,.08);color:inherit}",
|
|
1293
|
+
".obx-sticker-card-actions{display:flex;flex-wrap:wrap;gap:4px}",
|
|
1294
|
+
// 主人 2026-11-19:卡片上的「审核 / 补标签 / 删除」字号比默认小 2px(13 → 11),
|
|
1295
|
+
// 高度跟着收,不然小字号撑在 32px 按钮里很空。
|
|
1296
|
+
".obx-sticker-card-actions>*,.obx-sticker-card-actions button{font-size:12px;line-height:26px;height:26px;border-radius:6px}",
|
|
1297
|
+
// 删除按钮:危险实心红(主人 2026-11-19 指定样式),双类名压过宿主 ghost 变体。
|
|
1298
|
+
".obx-danger-btn.obx-danger-btn{background:#a12b2b;border-color:#7f1f1f;color:#fff}",
|
|
1299
|
+
".obx-danger-btn.obx-danger-btn:hover{background:#b23434;border-color:#8c2424;color:#fff}",
|
|
1300
|
+
".obx-danger-btn.obx-danger-btn:disabled{opacity:.5}",
|
|
1301
|
+
".obx-sticker-hash{font-family:ui-monospace,SFMono-Regular,monospace;font-size:12px;opacity:.6}",
|
|
1302
|
+
".obx-sticker-desc{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
1303
|
+
".obx-sticker-tags{font-size:12px;opacity:.6;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
|
|
1304
|
+
".obx-sticker-preview{display:flex;flex-direction:column;gap:6px;align-items:flex-start}",
|
|
1305
|
+
".obx-sticker-preview img{max-width:240px;max-height:240px;border-radius:8px}",
|
|
1030
1306
|
".obx-subgroup-title:first-child{margin-top:0}",
|
|
1031
1307
|
// 字段行:值/枚举/多行为纵向(label 上、控件下、hint 再下),布尔/通知为左右行
|
|
1032
1308
|
".obx-field{display:flex;flex-direction:column;gap:6px;padding:12px 0;border-top:.5px solid var(--obx-hairline)}",
|
|
@@ -1071,10 +1347,11 @@ window.__ModuleLoader__.load({
|
|
|
1071
1347
|
".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}",
|
|
1072
1348
|
".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)}",
|
|
1073
1349
|
".obx-segmented-tab:disabled{cursor:default;opacity:.4}",
|
|
1074
|
-
// 本地改(2026-11-
|
|
1075
|
-
".obx-group-tabs
|
|
1350
|
+
// 本地改(2026-11-19):顶部组切换条(连接/权限/行为…)字号 16、随页签增多自动换行(主人指定)。
|
|
1351
|
+
".obx-group-tabs{flex-wrap:wrap;gap:4px}",
|
|
1352
|
+
".obx-group-tabs .obx-segmented-tab{font-size:15px;font-weight:500;height:auto;padding:5px 14px;line-height:24px}",
|
|
1076
1353
|
// 同一档字号的兜底选择器(老的 .obx-tabs 容器类仍在用,双保险)。
|
|
1077
|
-
".obx-tabs .obx-segmented-tab{font-size:
|
|
1354
|
+
".obx-tabs .obx-segmented-tab{font-size:15px;font-weight:500;height:auto;padding:5px 14px;line-height:24px}",
|
|
1078
1355
|
// workspace 快速填入行(卡内嵌次级行;说明独占一行)
|
|
1079
1356
|
".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)}",
|
|
1080
1357
|
".obx-workspace-row .obx-hint{flex-basis:100%}",
|
|
@@ -1216,6 +1493,9 @@ window.__ModuleLoader__.load({
|
|
|
1216
1493
|
port: [1, 65535],
|
|
1217
1494
|
groupContextLines: [0, 200],
|
|
1218
1495
|
rateLimitPerMinute: [0, undefined],
|
|
1496
|
+
// 2026-11-19(本地加):回合形式掷骰概率(0–1 小数)。
|
|
1497
|
+
voiceReplyProb: [0, 1],
|
|
1498
|
+
stickerReplyProb: [0, 1],
|
|
1219
1499
|
interimRecallMs: [0, undefined],
|
|
1220
1500
|
inboxQueueDelayMs: [0, undefined],
|
|
1221
1501
|
deferredTimeoutMs: [0, undefined],
|
|
@@ -1231,6 +1511,18 @@ window.__ModuleLoader__.load({
|
|
|
1231
1511
|
maxFileBytes: [1, 4294967296],
|
|
1232
1512
|
inboundImageMaxPx: [0, undefined],
|
|
1233
1513
|
inboundFileMaxBytes: [0, undefined],
|
|
1514
|
+
// 2026-11-19(本地加):主动搭话(与 host NUMBER_RANGE 同界;概率类允许小数)。
|
|
1515
|
+
proactiveMinIdleMinutes: [0, 1440],
|
|
1516
|
+
proactiveMinGapMinutes: [0, 1440],
|
|
1517
|
+
proactiveMaxPerDay: [1, 48],
|
|
1518
|
+
proactiveQuietFrom: [0, 23],
|
|
1519
|
+
proactiveQuietTo: [0, 23],
|
|
1520
|
+
proactiveAttemptGapMinutes: [0, 1440],
|
|
1521
|
+
proactiveBurstProb: [0, 1],
|
|
1522
|
+
proactiveFollowupMinSec: [0, 3600],
|
|
1523
|
+
proactiveFollowupMaxSec: [0, 3600],
|
|
1524
|
+
proactiveFollowupProb: [0, 1],
|
|
1525
|
+
proactiveFollowupMaxPerDay: [0, 48],
|
|
1234
1526
|
};
|
|
1235
1527
|
/**
|
|
1236
1528
|
* 批 3(UX §5.6):数字行内校验——判定语义与 host validatePatch 逐字对齐
|
|
@@ -1403,12 +1695,31 @@ window.__ModuleLoader__.load({
|
|
|
1403
1695
|
onChange: function (event) { props.onChange(event); },
|
|
1404
1696
|
}));
|
|
1405
1697
|
};
|
|
1406
|
-
|
|
1698
|
+
// 本地加(2026-11-19):宿主 primitives 缺席时的图片查看器回落(固定遮罩 + 点击关闭)。
|
|
1699
|
+
var imageLightbox = function (props) {
|
|
1700
|
+
var labels = props.labels || {};
|
|
1701
|
+
return h(ReactImpl, "div", {
|
|
1702
|
+
className: "obx-lightbox",
|
|
1703
|
+
role: "dialog",
|
|
1704
|
+
"aria-modal": "true",
|
|
1705
|
+
"aria-label": labels.dialog || "原图预览",
|
|
1706
|
+
onClick: function () { if (typeof props.onClose === "function")
|
|
1707
|
+
props.onClose(); },
|
|
1708
|
+
}, h(ReactImpl, "img", { className: "obx-lightbox-img", src: props.src, alt: props.alt || "" }), h(ReactImpl, "button", { type: "button", className: "obx-lightbox-close", "aria-label": labels.close || "关闭" }, "×"));
|
|
1709
|
+
};
|
|
1710
|
+
return { Switch: switchControl, Checkbox: checkbox, Tag: tag, Button: button, SegmentedControl: segmentedControl, SegmentedTabs: segmentedTabs, Input: input, ImageLightbox: imageLightbox };
|
|
1407
1711
|
}
|
|
1408
1712
|
/**
|
|
1409
1713
|
* 面板统一 UI 组件表:宿主 primitives 在位时直用(组件 CSS 随宿主全局样式表
|
|
1410
1714
|
* 加载,明暗/主题跟随宿主);seed 表缺席时用回落 shim(视觉走本文件 CSS)。
|
|
1411
1715
|
*/
|
|
1716
|
+
/** 本地改(2026-11-19):顶部页签改用回落实现(宿主那版字号写死、改不动);按需构造一次。 */
|
|
1717
|
+
var localTabsUi = null;
|
|
1718
|
+
var localSegmentedTabs = function (props) {
|
|
1719
|
+
if (localTabsUi == null)
|
|
1720
|
+
localTabsUi = fallbackUi(React);
|
|
1721
|
+
return localTabsUi.SegmentedTabs(props);
|
|
1722
|
+
};
|
|
1412
1723
|
var UI = hostPrimitives != null
|
|
1413
1724
|
? {
|
|
1414
1725
|
Switch: hostPrimitives.Switch,
|
|
@@ -1416,8 +1727,13 @@ window.__ModuleLoader__.load({
|
|
|
1416
1727
|
Tag: hostPrimitives.Tag,
|
|
1417
1728
|
Button: hostPrimitives.Button,
|
|
1418
1729
|
SegmentedControl: hostPrimitives.SegmentedControl,
|
|
1419
|
-
|
|
1730
|
+
// 本地改(2026-11-19):页签用本地实现,这样顶部组切换条的字号/高度
|
|
1731
|
+
// 才归面板 CSS 管。注意这里不能直接引用 fallbackUi 内的局部函数
|
|
1732
|
+
// (hostPrimitives 在位时正是走这一支,会 ReferenceError 把插件打挂)。
|
|
1733
|
+
SegmentedTabs: localSegmentedTabs,
|
|
1420
1734
|
Input: hostPrimitives.Input,
|
|
1735
|
+
// 本地加(2026-11-19):面板里点表情包缩略图走宿主自己的大图查看器。
|
|
1736
|
+
ImageLightbox: hostPrimitives.ImageLightbox,
|
|
1421
1737
|
}
|
|
1422
1738
|
: fallbackUi(React);
|
|
1423
1739
|
//#endregion
|
|
@@ -1746,19 +2062,32 @@ window.__ModuleLoader__.load({
|
|
|
1746
2062
|
if (claimedBySection[looseField.key] !== true && byKey[looseField.key] != null)
|
|
1747
2063
|
looseNodes.push(byKey[looseField.key]);
|
|
1748
2064
|
}
|
|
2065
|
+
// 本地改(2026-11-19):分区里可以写占位键 "@notices",把通知段(插话提示…
|
|
2066
|
+
// 限流提示)插到该位置——放到「合并等待窗口(毫秒)」下面。
|
|
2067
|
+
var noticesPlaced = false;
|
|
1749
2068
|
for (var section of group.sections) {
|
|
1750
2069
|
sectionNodes.push(h(ReactImpl, "h4", { className: "obx-subgroup-title", key: "sec-" + section.id }, tr("group." + group.id + ".section." + section.id, section.title)));
|
|
1751
2070
|
for (var sectionKey of section.keys) {
|
|
2071
|
+
if (sectionKey === "@notices") {
|
|
2072
|
+
noticesPlaced = true;
|
|
2073
|
+
for (var noticeRow of noticeRows)
|
|
2074
|
+
sectionNodes.push(noticeRow);
|
|
2075
|
+
continue;
|
|
2076
|
+
}
|
|
1752
2077
|
if (byKey[sectionKey] != null)
|
|
1753
2078
|
sectionNodes.push(byKey[sectionKey]);
|
|
1754
2079
|
}
|
|
1755
2080
|
}
|
|
1756
2081
|
// 本地改(2026-11-18):分区块排在通知段之后、尾部字段(发送错误通知)之前。
|
|
1757
|
-
|
|
2082
|
+
// 本地改(2026-11-19):分区里写了 "@notices" 时通知段已就地插入,不再重复追加。
|
|
2083
|
+
fieldNodes = looseNodes.concat(noticesPlaced ? [] : noticeRows).concat(sectionNodes).concat(tailFieldNodes);
|
|
1758
2084
|
}
|
|
1759
2085
|
// 组标题 + 一句人话描述(经 opts.groupDesc 传入;缺省不渲染)。标题走词条
|
|
1760
2086
|
//(zh 源 = GROUPS.title 自动灌入)。
|
|
1761
|
-
|
|
2087
|
+
// 本地改(2026-11-19):去掉模块标题(连接 / 权限… 那个 16px 标题),只留一句描述。
|
|
2088
|
+
var sectionChildren = groupDesc != null
|
|
2089
|
+
? [h(ReactImpl, "div", { className: "obx-group-head" }, h(ReactImpl, "span", { className: "obx-group-desc" }, groupDesc))]
|
|
2090
|
+
: [];
|
|
1762
2091
|
return h.apply(null, [ReactImpl, "section", { className: "obx-group", "data-group": group.id }]
|
|
1763
2092
|
.concat(sectionChildren, [fieldNodes]));
|
|
1764
2093
|
}
|
|
@@ -1847,6 +2176,357 @@ window.__ModuleLoader__.load({
|
|
|
1847
2176
|
* @param props t 为宿主注入的翻译函数(locale: NS,语言切换自动重渲染);
|
|
1848
2177
|
* remote 为挂载后的 `remote.onebotSettings` API。
|
|
1849
2178
|
*/
|
|
2179
|
+
//#region 表情包库面板(2026-11-19 本地加)
|
|
2180
|
+
// 2026-11-19(本地加):表情包库 —— 面板整套(刷新 / 新增 / 审核 / 重新识别 / 删除 / 看图 / 改描述)。
|
|
2181
|
+
/**
|
|
2182
|
+
* 表情包库:挂在「表情包」页签下面(列表 / 新增 / 删除 / 审核 / 看图)。
|
|
2183
|
+
* 数据全走 remote 方法(listStickers / addSticker / deleteSticker /
|
|
2184
|
+
* approveStickers / unapproveStickers / readSticker),不占配置文件键。
|
|
2185
|
+
* 审核时由宿主模型看图写描述与标签——点按钮才跑,不常驻、不占显存。
|
|
2186
|
+
*/
|
|
2187
|
+
function StickerPanel(props) {
|
|
2188
|
+
var remote = props.remote;
|
|
2189
|
+
var ui = props.ui;
|
|
2190
|
+
var notify = typeof props.onNotify === "function" ? props.onNotify : function () { };
|
|
2191
|
+
var dataState = React.useState(null);
|
|
2192
|
+
var data = dataState[0];
|
|
2193
|
+
var setData = dataState[1];
|
|
2194
|
+
var busyState = React.useState("");
|
|
2195
|
+
var busy = busyState[0];
|
|
2196
|
+
var setBusy = busyState[1];
|
|
2197
|
+
var previewState = React.useState(null);
|
|
2198
|
+
var preview = previewState[0];
|
|
2199
|
+
var setPreview = previewState[1];
|
|
2200
|
+
// 2026-11-19 主人要求:描述 / 标签可手动改(悬停出铅笔,点开变输入框,失焦保存)。
|
|
2201
|
+
var editState = React.useState(null);
|
|
2202
|
+
var edit = editState[0];
|
|
2203
|
+
var setEdit = editState[1];
|
|
2204
|
+
var aliveRef = React.useRef(true);
|
|
2205
|
+
// 2026-11-19:新增按钮改成宿主 Button,真 file input 藏在后面,三个按钮尺寸才一致。
|
|
2206
|
+
var fileRef = React.useRef(null);
|
|
2207
|
+
var errorState = React.useState("");
|
|
2208
|
+
var error = errorState[0];
|
|
2209
|
+
var setError = errorState[1];
|
|
2210
|
+
// 临时调试:把接口原始返回截一段显示在面板上(2026-11-19 排查「0 张」用,修好后删掉)。
|
|
2211
|
+
var debugState = React.useState("");
|
|
2212
|
+
var debug = debugState[0];
|
|
2213
|
+
var setDebug = debugState[1];
|
|
2214
|
+
React.useEffect(function () {
|
|
2215
|
+
aliveRef.current = true;
|
|
2216
|
+
return function () { aliveRef.current = false; };
|
|
2217
|
+
}, []);
|
|
2218
|
+
var describeError = function (error) {
|
|
2219
|
+
var box = error;
|
|
2220
|
+
var text = String((box != null && box.message) || error || "");
|
|
2221
|
+
return text === "" ? "未知错误" : text;
|
|
2222
|
+
};
|
|
2223
|
+
var apply = function (result) {
|
|
2224
|
+
if (!aliveRef.current)
|
|
2225
|
+
return;
|
|
2226
|
+
if (result == null || typeof result !== "object") {
|
|
2227
|
+
setError("表情包接口没返回数据(插件可能还没重启到位): " + String(result));
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2230
|
+
var snapshot = result;
|
|
2231
|
+
setDebug("");
|
|
2232
|
+
setError(snapshot.ok === false ? "表情包库读取失败:" + String(snapshot.error || "未知原因") : "");
|
|
2233
|
+
setData({
|
|
2234
|
+
loaded: true,
|
|
2235
|
+
root: typeof snapshot.root === "string" ? snapshot.root : "",
|
|
2236
|
+
autoCollect: snapshot.autoCollect !== false,
|
|
2237
|
+
stats: snapshot.stats || null,
|
|
2238
|
+
items: Array.isArray(snapshot.items) ? snapshot.items : [],
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
var fail = function (error) {
|
|
2242
|
+
notify(describeError(error), true);
|
|
2243
|
+
if (aliveRef.current)
|
|
2244
|
+
setError("调用失败:" + describeError(error));
|
|
2245
|
+
};
|
|
2246
|
+
var load = function () {
|
|
2247
|
+
if (typeof remote.listStickers !== "function") {
|
|
2248
|
+
setError("插件没有暴露 listStickers 方法(设置页与插件版本不一致,重启 DSH 后再试)");
|
|
2249
|
+
return Promise.resolve();
|
|
2250
|
+
}
|
|
2251
|
+
setBusy("读取");
|
|
2252
|
+
return Promise.resolve(remote.listStickers()).then(unwrap).then(apply).catch(fail).then(function () {
|
|
2253
|
+
if (aliveRef.current)
|
|
2254
|
+
setBusy("");
|
|
2255
|
+
});
|
|
2256
|
+
};
|
|
2257
|
+
React.useEffect(function () { void load(); }, []);
|
|
2258
|
+
/** 统一的动作执行:置忙 → 调 remote → 用返回的新快照刷新 → 收尾。 */
|
|
2259
|
+
var run = function (label, action) {
|
|
2260
|
+
setBusy(label);
|
|
2261
|
+
Promise.resolve().then(action).then(unwrap).then(apply).catch(fail).then(function () {
|
|
2262
|
+
if (aliveRef.current)
|
|
2263
|
+
setBusy("");
|
|
2264
|
+
});
|
|
2265
|
+
};
|
|
2266
|
+
// 2026-11-19 主人要求:已审核的图点「重新识别」重跑一次宿主模型识别,结果显示在调试行。
|
|
2267
|
+
// 2026-11-19 主人要求:描述 / 标签可手动改——悬停出铅笔,点开变输入框,失焦即保存(Enter 保存、Esc 取消)。
|
|
2268
|
+
var commitEdit = function (hash, field, value) {
|
|
2269
|
+
var patch = {};
|
|
2270
|
+
if (field === "description") {
|
|
2271
|
+
patch.description = String(value == null ? "" : value).trim();
|
|
2272
|
+
}
|
|
2273
|
+
else {
|
|
2274
|
+
patch.tags = String(value == null ? "" : value).split(/[\s,,、;;]+/).filter(function (one) { return one !== ""; }).slice(0, 8);
|
|
2275
|
+
}
|
|
2276
|
+
setEdit(null);
|
|
2277
|
+
setBusy("保存");
|
|
2278
|
+
Promise.resolve().then(function () {
|
|
2279
|
+
return remote.updateSticker(hash, patch);
|
|
2280
|
+
}).then(unwrap).then(apply).then(function () {
|
|
2281
|
+
setDebug("已保存 " + String(hash).slice(0, 8) + " 的" + (field === "description" ? "描述" : "标签"));
|
|
2282
|
+
}).catch(fail).then(function () {
|
|
2283
|
+
if (aliveRef.current)
|
|
2284
|
+
setBusy("");
|
|
2285
|
+
});
|
|
2286
|
+
};
|
|
2287
|
+
var editableField = function (item, field, text) {
|
|
2288
|
+
var editing = edit != null && edit.hash === item.hash && edit.field === field;
|
|
2289
|
+
if (editing) {
|
|
2290
|
+
return h(React, "textarea", {
|
|
2291
|
+
className: "obx-sticker-edit-input",
|
|
2292
|
+
value: edit.value,
|
|
2293
|
+
rows: field === "tags" ? 2 : 3,
|
|
2294
|
+
autoFocus: true,
|
|
2295
|
+
spellCheck: false,
|
|
2296
|
+
onChange: function (event) { setEdit({ hash: item.hash, field: field, value: event.target.value }); },
|
|
2297
|
+
onBlur: function (event) { commitEdit(item.hash, field, event.target.value); },
|
|
2298
|
+
onKeyDown: function (event) {
|
|
2299
|
+
// 2026-11-19:改成多行文本,Enter 换行;Ctrl/⌘+Enter 或失焦才保存。
|
|
2300
|
+
if (event.key === "Enter" && (event.ctrlKey || event.metaKey)) {
|
|
2301
|
+
event.preventDefault();
|
|
2302
|
+
commitEdit(item.hash, field, event.target.value);
|
|
2303
|
+
}
|
|
2304
|
+
if (event.key === "Escape") {
|
|
2305
|
+
event.preventDefault();
|
|
2306
|
+
setEdit(null);
|
|
2307
|
+
}
|
|
2308
|
+
},
|
|
2309
|
+
onClick: function (event) { event.stopPropagation(); },
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
var current = field === "tags"
|
|
2313
|
+
? (Array.isArray(item.tags) && item.tags.length > 0 ? item.tags.join("、") : "无标签")
|
|
2314
|
+
: (String(item.description || "").trim() !== "" ? String(item.description) : String(item.file || item.hash));
|
|
2315
|
+
return h(React, "span", { className: "obx-sticker-editable" }, h(React, "span", { className: "obx-sticker-edit-text" }, text != null ? text : current), h(React, "button", {
|
|
2316
|
+
type: "button",
|
|
2317
|
+
className: "obx-sticker-edit-btn",
|
|
2318
|
+
title: "修改",
|
|
2319
|
+
"aria-label": "修改",
|
|
2320
|
+
onClick: function (event) {
|
|
2321
|
+
event.stopPropagation();
|
|
2322
|
+
setEdit({
|
|
2323
|
+
hash: item.hash,
|
|
2324
|
+
field: field,
|
|
2325
|
+
value: field === "tags" ? (Array.isArray(item.tags) ? item.tags.join("、") : "") : String(item.description || ""),
|
|
2326
|
+
});
|
|
2327
|
+
},
|
|
2328
|
+
}, "✎"));
|
|
2329
|
+
};
|
|
2330
|
+
var retagOne = function (hash) {
|
|
2331
|
+
setBusy("重新识别");
|
|
2332
|
+
Promise.resolve().then(function () {
|
|
2333
|
+
return remote.retagStickers([hash]);
|
|
2334
|
+
}).then(unwrap).then(function (result) {
|
|
2335
|
+
var snapshot = result;
|
|
2336
|
+
apply(snapshot);
|
|
2337
|
+
var one = Array.isArray(snapshot.results) ? snapshot.results[0] : null;
|
|
2338
|
+
if (one == null) {
|
|
2339
|
+
setDebug("重新识别:没有返回结果");
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
if (one.ok === true) {
|
|
2343
|
+
var tags = Array.isArray(one.tags) && one.tags.length > 0 ? one.tags.join("、") : "(空)";
|
|
2344
|
+
setDebug("重新识别 " + String(hash).slice(0, 8) + ":描述「" + String(one.description || "(空)") + "」 标签 " + tags);
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
setDebug("重新识别失败 " + String(hash).slice(0, 8) + ":" + String(one.reason || "unknown"));
|
|
2348
|
+
}).catch(fail).then(function () {
|
|
2349
|
+
if (aliveRef.current)
|
|
2350
|
+
setBusy("");
|
|
2351
|
+
});
|
|
2352
|
+
};
|
|
2353
|
+
var onPick = function (event) {
|
|
2354
|
+
var input = event && event.target;
|
|
2355
|
+
var files = input && input.files ? Array.prototype.slice.call(input.files) : [];
|
|
2356
|
+
if (files.length === 0)
|
|
2357
|
+
return;
|
|
2358
|
+
input.value = "";
|
|
2359
|
+
setBusy("新增");
|
|
2360
|
+
var chain = Promise.resolve();
|
|
2361
|
+
for (var index = 0; index < files.length; index += 1) {
|
|
2362
|
+
(function (file) {
|
|
2363
|
+
chain = chain.then(function () {
|
|
2364
|
+
return new Promise(function (resolve) {
|
|
2365
|
+
var reader = new FileReader();
|
|
2366
|
+
reader.onload = function () { resolve(String(reader.result || "")); };
|
|
2367
|
+
reader.onerror = function () { resolve(""); };
|
|
2368
|
+
reader.readAsDataURL(file);
|
|
2369
|
+
}).then(function (dataUrl) {
|
|
2370
|
+
if (dataUrl === "")
|
|
2371
|
+
return null;
|
|
2372
|
+
return remote.addSticker(file.name || "sticker", dataUrl);
|
|
2373
|
+
});
|
|
2374
|
+
});
|
|
2375
|
+
})(files[index]);
|
|
2376
|
+
}
|
|
2377
|
+
chain.then(function () { return remote.listStickers(); }).then(unwrap).then(apply).catch(fail).then(function () {
|
|
2378
|
+
if (aliveRef.current)
|
|
2379
|
+
setBusy("");
|
|
2380
|
+
});
|
|
2381
|
+
};
|
|
2382
|
+
var openPreview = function (hash) {
|
|
2383
|
+
// 缩略图已经读进缓存就直接开(省一次往返),否则现读原图再开。
|
|
2384
|
+
var cached = thumbsRef.current[hash];
|
|
2385
|
+
if (typeof cached === "string" && cached !== "") {
|
|
2386
|
+
setPreview({ hash: hash, dataUrl: cached });
|
|
2387
|
+
return;
|
|
2388
|
+
}
|
|
2389
|
+
setBusy("看图");
|
|
2390
|
+
Promise.resolve(remote.readSticker(hash)).then(unwrap).then(function (result) {
|
|
2391
|
+
if (!aliveRef.current || result == null)
|
|
2392
|
+
return;
|
|
2393
|
+
var image = result;
|
|
2394
|
+
if (typeof image.dataUrl === "string" && image.dataUrl !== "")
|
|
2395
|
+
setPreview({ hash: hash, dataUrl: image.dataUrl });
|
|
2396
|
+
else
|
|
2397
|
+
notify(image.tooLarge === true ? "这张图太大,面板里不预览(去文件夹里看)" : "读图失败");
|
|
2398
|
+
}).catch(fail).then(function () {
|
|
2399
|
+
if (aliveRef.current)
|
|
2400
|
+
setBusy("");
|
|
2401
|
+
});
|
|
2402
|
+
};
|
|
2403
|
+
// 2026-11-19:首屏 data 还是 null(正在读取),先按空库渲染,别崩。
|
|
2404
|
+
var items = data != null && Array.isArray(data.items) ? data.items : [];
|
|
2405
|
+
var pending = items.filter(function (item) { return item.approved !== true; });
|
|
2406
|
+
var approved = items.filter(function (item) { return item.approved === true; });
|
|
2407
|
+
var stats = (data != null ? data.stats : null) || { total: items.length, approved: approved.length, pending: pending.length, bytes: 0 };
|
|
2408
|
+
var disabled = busy !== "";
|
|
2409
|
+
// 图墙:进可视区才向 host 要图(懒加载)。2026-11-19 主人指定不要缩略图,
|
|
2410
|
+
// 一律读原图,只是靠 IntersectionObserver 控制一次只取可见的那几张。
|
|
2411
|
+
var thumbsRef = React.useRef({});
|
|
2412
|
+
var thumbState = React.useState({});
|
|
2413
|
+
var thumbs = thumbState[0];
|
|
2414
|
+
var setThumbs = thumbState[1];
|
|
2415
|
+
var askedRef = React.useRef({});
|
|
2416
|
+
var observerRef = React.useRef(null);
|
|
2417
|
+
var mountedRef = React.useRef(true);
|
|
2418
|
+
React.useEffect(function () {
|
|
2419
|
+
mountedRef.current = true;
|
|
2420
|
+
return function () {
|
|
2421
|
+
mountedRef.current = false;
|
|
2422
|
+
if (observerRef.current != null) {
|
|
2423
|
+
observerRef.current.disconnect();
|
|
2424
|
+
observerRef.current = null;
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
}, []);
|
|
2428
|
+
var urlOf = function (image) {
|
|
2429
|
+
var url = image != null && typeof image.dataUrl === "string" ? String(image.dataUrl) : "";
|
|
2430
|
+
if (url === "")
|
|
2431
|
+
throw new Error("empty image");
|
|
2432
|
+
return url;
|
|
2433
|
+
};
|
|
2434
|
+
var ensureThumb = function (hash) {
|
|
2435
|
+
if (askedRef.current[hash] === true || thumbsRef.current[hash] !== undefined)
|
|
2436
|
+
return;
|
|
2437
|
+
askedRef.current[hash] = true;
|
|
2438
|
+
// 2026-11-19 主人指定:不要缩略图,直接读原图。
|
|
2439
|
+
var trySticker = function () {
|
|
2440
|
+
return Promise.resolve(remote.readSticker(hash)).then(unwrap).then(urlOf);
|
|
2441
|
+
};
|
|
2442
|
+
trySticker().then(function (url) {
|
|
2443
|
+
thumbsRef.current[hash] = url;
|
|
2444
|
+
if (mountedRef.current)
|
|
2445
|
+
setThumbs(Object.assign({}, thumbsRef.current));
|
|
2446
|
+
}).catch(function (error) {
|
|
2447
|
+
thumbsRef.current[hash] = "";
|
|
2448
|
+
if (mountedRef.current) {
|
|
2449
|
+
setThumbs(Object.assign({}, thumbsRef.current));
|
|
2450
|
+
setDebug("读图失败:" + String(hash).slice(0, 8) + " " + describeError(error));
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2453
|
+
};
|
|
2454
|
+
var attachThumb = function (hash) {
|
|
2455
|
+
return function (node) {
|
|
2456
|
+
if (node == null)
|
|
2457
|
+
return;
|
|
2458
|
+
node.setAttribute("data-hash", hash);
|
|
2459
|
+
if (typeof IntersectionObserver !== "function") {
|
|
2460
|
+
ensureThumb(hash);
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2463
|
+
if (observerRef.current == null) {
|
|
2464
|
+
observerRef.current = new IntersectionObserver(function (entries) {
|
|
2465
|
+
for (var i = 0; i < entries.length; i += 1) {
|
|
2466
|
+
var entry = entries[i];
|
|
2467
|
+
if (entry.isIntersecting !== true)
|
|
2468
|
+
continue;
|
|
2469
|
+
var key = entry.target.getAttribute("data-hash");
|
|
2470
|
+
observerRef.current.unobserve(entry.target);
|
|
2471
|
+
if (key != null)
|
|
2472
|
+
ensureThumb(key);
|
|
2473
|
+
}
|
|
2474
|
+
}, { rootMargin: "240px" });
|
|
2475
|
+
}
|
|
2476
|
+
observerRef.current.observe(node);
|
|
2477
|
+
};
|
|
2478
|
+
};
|
|
2479
|
+
var cardOf = function (item) {
|
|
2480
|
+
var tagList = Array.isArray(item.tags) ? item.tags : [];
|
|
2481
|
+
var src = thumbs[item.hash];
|
|
2482
|
+
return h(React, "figure", { className: "obx-sticker-card", key: item.hash },
|
|
2483
|
+
// 2026-11-19:缩略图点击 = 用宿主自己的大图查看器(ImageLightbox)看原图。
|
|
2484
|
+
h(React, "div", {
|
|
2485
|
+
className: "obx-sticker-thumb",
|
|
2486
|
+
ref: attachThumb(item.hash),
|
|
2487
|
+
title: item.description || item.file || item.hash,
|
|
2488
|
+
role: "button",
|
|
2489
|
+
tabIndex: 0,
|
|
2490
|
+
"aria-label": "查看原图",
|
|
2491
|
+
onClick: function () { openPreview(item.hash); },
|
|
2492
|
+
onKeyDown: function (event) {
|
|
2493
|
+
if (event.key === "Enter" || event.key === " ")
|
|
2494
|
+
openPreview(item.hash);
|
|
2495
|
+
},
|
|
2496
|
+
}, src ? h(React, "img", { src: src, alt: item.description || item.hash, loading: "lazy" }) : h(React, "span", { className: "obx-sticker-thumb-wait" }, "…"), h(React, "span", { className: "obx-sticker-thumb-hint", "aria-hidden": "true" }, "查看原图")), h(React, "figcaption", { className: "obx-sticker-card-desc" }, editableField(item, "description")), h(React, "div", { className: "obx-sticker-card-tags" }, editableField(item, "tags", tagList.length > 0 ? tagList.slice(0, 4).join(" ") : "无标签")), h(React, "div", { className: "obx-sticker-card-actions" },
|
|
2497
|
+
// 主人 2026-11-19:已审核的图都带「重新识别」(原「补标签」文案改掉,且原来点了没反应)。
|
|
2498
|
+
item.approved === true
|
|
2499
|
+
? h(React, ui.Button, { variant: "ghost", className: "obx-accent-btn", disabled: disabled, onClick: function () { retagOne(item.hash); } }, "重新识别")
|
|
2500
|
+
: h(React, ui.Button, { variant: "primary", disabled: disabled, onClick: function () { run("审核", function () { return remote.approveStickers([item.hash]); }); } }, "审核"), h(React, ui.Button, { variant: "ghost", className: "obx-danger-btn", disabled: disabled, onClick: function () { run("删除", function () { return remote.deleteSticker([item.hash]); }); } }, "删除")));
|
|
2501
|
+
};
|
|
2502
|
+
return h(React, "section", { className: "obx-sticker-panel" }, error !== "" ? h(React, "p", { className: "obx-sticker-error" }, error) : null, debug !== "" ? h(React, "p", { className: "obx-sticker-debug" }, debug) : null, h(React, "div", { className: "obx-sticker-statline" }, h(React, "p", { className: "obx-hint" }, "库目录:" + ((data != null ? data.root : "") || "—") + " 已审核 " + String(stats.approved) + " 张 / 未审核 " + String(stats.pending) + " 张(聊天只从已审核里挑图)"), h(React, ui.Button, { variant: "ghost", className: "obx-light-btn", disabled: disabled, onClick: function () { void load(); } }, busy === "读取" ? "读取中…" : "刷新")), busy !== "" ? h(React, "p", { className: "obx-hint" }, "处理中:" + busy + "…") : null, preview != null
|
|
2503
|
+
? (typeof ui.ImageLightbox === "function"
|
|
2504
|
+
// 2026-11-19 主人要求:走宿主自己的大图查看器(Esc / 点遮罩关闭)。
|
|
2505
|
+
? h(React, ui.ImageLightbox, {
|
|
2506
|
+
src: preview.dataUrl,
|
|
2507
|
+
alt: preview.hash,
|
|
2508
|
+
labels: { dialog: "原图预览", close: "关闭预览" },
|
|
2509
|
+
onClose: function () { setPreview(null); },
|
|
2510
|
+
})
|
|
2511
|
+
: h(React, "div", { className: "obx-sticker-preview" }, h(React, "img", { src: preview.dataUrl, alt: preview.hash }), h(React, ui.Button, { variant: "ghost", onClick: function () { setPreview(null); } }, "关闭")))
|
|
2512
|
+
: null, h(React, "div", { className: "obx-sticker-head" }, h(React, "h4", { className: "obx-subgroup-title obx-sticker-title" }, "未审核(" + String(pending.length) + ")"), h(React, "div", { className: "obx-sticker-head-actions" }, h(React, "input", {
|
|
2513
|
+
ref: fileRef,
|
|
2514
|
+
type: "file",
|
|
2515
|
+
multiple: true,
|
|
2516
|
+
accept: "image/*",
|
|
2517
|
+
style: { display: "none" },
|
|
2518
|
+
onChange: onPick,
|
|
2519
|
+
}), h(React, ui.Button, { variant: "ghost", className: "obx-green-btn", disabled: disabled, onClick: function () {
|
|
2520
|
+
var node = fileRef.current;
|
|
2521
|
+
if (node != null)
|
|
2522
|
+
node.click();
|
|
2523
|
+
} }, "新增"), h(React, ui.Button, { variant: "ghost", className: "obx-light-btn", disabled: disabled, onClick: function () { run("审核全部", function () { return remote.approveStickers([]); }); } }, "审核全部"))), pending.length === 0
|
|
2524
|
+
? h(React, "p", { className: "obx-hint" }, "没有待审核的图")
|
|
2525
|
+
: h(React, "div", { className: "obx-sticker-grid" }, pending.map(cardOf)), h(React, "h4", { className: "obx-subgroup-title obx-sticker-title" }, "已审核(" + String(approved.length) + ")"), approved.length === 0
|
|
2526
|
+
? h(React, "p", { className: "obx-hint" }, "还没有已审核的表情包")
|
|
2527
|
+
: h(React, "div", { className: "obx-sticker-grid" }, approved.map(cardOf)));
|
|
2528
|
+
}
|
|
2529
|
+
//#endregion
|
|
1850
2530
|
function OnebotSettingsPanel(props) {
|
|
1851
2531
|
var t = props.t;
|
|
1852
2532
|
var remote = props.remote;
|
|
@@ -2286,19 +2966,35 @@ window.__ModuleLoader__.load({
|
|
|
2286
2966
|
// 0.10.0 页面骨架(对齐宿主原生页):头部(20px/500 标题 + 状态 + ghost 工具栏
|
|
2287
2967
|
// + SegmentedTabs 页签行)→ 滚动主体(反馈行 + 热生效提示 + 当前分组)→ 底部
|
|
2288
2968
|
// 保存条(原生 SettingsForm 式)。分组内容经 renderGroup 纯函数产出(ui 注入)。
|
|
2289
|
-
return h(React, "div", { className: "obx-panel" }, h(React, "div", { className: "obx-head" }, h(React, "div", { className: "obx-head-row" }, h(React, "h2", { className: "obx-title" }, t("settings.title")), dirtyCount > 0 ? h(React, "span", { className: "obx-status-warn" }, format(t("save.dirtyBadge"), { count: dirtyCount })) : null, snapshot.entryActive === true ? null : h(React, "span", { className: "obx-status-warn", title: t("effect.entryInactiveTitle") }, t("effect.entryInactive")), h(React, "span", { className: "obx-head-spacer" }), h(React, UI.Button, { variant: "ghost", disabled: busy, onClick: handleReset }, t("settings.reset")), h(React, UI.Button, { variant: "ghost", disabled: busy, onClick: handleReload }, t("settings.reload"))),
|
|
2969
|
+
return h(React, "div", { className: "obx-panel" }, h(React, "div", { className: "obx-head" }, h(React, "div", { className: "obx-head-row" }, h(React, "h2", { className: "obx-title" }, t("settings.title")), dirtyCount > 0 ? h(React, "span", { className: "obx-status-warn" }, format(t("save.dirtyBadge"), { count: dirtyCount })) : null, snapshot.entryActive === true ? null : h(React, "span", { className: "obx-status-warn", title: t("effect.entryInactiveTitle") }, t("effect.entryInactive")), h(React, "span", { className: "obx-head-spacer" }), h(React, UI.Button, { variant: "ghost", className: "obx-danger-outline", disabled: busy, onClick: handleReset }, t("settings.reset")), h(React, UI.Button, { variant: "ghost", className: "obx-light-btn", disabled: busy, onClick: handleReload }, t("settings.reload"))),
|
|
2970
|
+
// 本地改(2026-11-19):热生效提示移到页签行上面,独占一行贴顶。
|
|
2971
|
+
h(React, "p", { className: "obx-effect obx-effect--top" }, t("effect.hint")), h(React, "div", { className: "obx-head-row" }, h(React, UI.SegmentedTabs, {
|
|
2290
2972
|
items: GROUPS.map(function (group) { return { value: group.id, label: t("group." + group.id + ".title", group.title) }; }),
|
|
2291
2973
|
value: activeTab,
|
|
2292
2974
|
onChange: function (next) { setActiveTab(next); },
|
|
2293
2975
|
label: t("settings.groupsLabel", "设置分组"),
|
|
2294
|
-
}), h(React, "span", { className: "obx-head-spacer" })
|
|
2295
|
-
|
|
2976
|
+
}), h(React, "span", { className: "obx-head-spacer" }))), h(React, "div", { className: "obx-body" }, (error !== null || notice !== "") ? h(React, "div", { className: "obx-toast-wrap", "aria-live": "polite" }, error !== null ? h(React, "p", { className: "obx-error" + (conflictActive ? " obx-error--conflict" : ""), role: "alert" }, t("status.error") + ":" + error) : null, notice !== "" ? h(React, "p", { className: "obx-notice" }, notice) : null) : null, GROUPS.filter(function (group) { return group.id === activeTab; }).map(function (group) {
|
|
2977
|
+
var groupNode = renderGroup(React, group, Object.assign({}, changeHandlers, {
|
|
2296
2978
|
ui: UI,
|
|
2297
2979
|
texts: texts,
|
|
2298
2980
|
// 词条缺失(新组忘配 desc)时传 null,不把原始 key 当描述渲染
|
|
2299
2981
|
groupDesc: zh["group." + group.id + ".desc"] != null ? t("group." + group.id + ".desc") : null,
|
|
2300
2982
|
modeInactiveKeys: modeInactiveKeys,
|
|
2301
2983
|
}));
|
|
2984
|
+
if (group.id !== "stickers")
|
|
2985
|
+
return groupNode;
|
|
2986
|
+
// 2026-11-19(本地加):表情包组在字段之后挂「表情包库」面板。
|
|
2987
|
+
return h(React, "div", { key: "group-" + group.id, className: "obx-group-stack" }, groupNode, h(React, StickerPanel, {
|
|
2988
|
+
key: "sticker-panel",
|
|
2989
|
+
remote: remote,
|
|
2990
|
+
ui: UI,
|
|
2991
|
+
onNotify: function (message, isError) {
|
|
2992
|
+
if (isError === true)
|
|
2993
|
+
setError(message);
|
|
2994
|
+
else
|
|
2995
|
+
setNotice(message);
|
|
2996
|
+
},
|
|
2997
|
+
}));
|
|
2302
2998
|
}), h(React, "div", { className: "obx-foot" }, h(React, "span", { className: "obx-head-spacer" }), h(React, UI.Button, {
|
|
2303
2999
|
variant: "primary",
|
|
2304
3000
|
disabled: busy || dirtyCount === 0 || invalidNumberCount > 0,
|