dsh-fish-soul 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client.js +4 -3
- package/lib/config-schema.js +2 -1
- package/lib/gateway.js +4 -1
- package/lib/routes.js +2 -0
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -348,7 +348,7 @@ window.__ModuleLoader__.load({
|
|
|
348
348
|
const [busy, setBusy] = react.useState(false);
|
|
349
349
|
const [form, setForm, patch] = useForm(data, () => ({
|
|
350
350
|
enabled: qq.enabled === true, wsUrl: qq.wsUrl ?? "ws://127.0.0.1:3001", accessToken: "", masterQqUin: data.masterQqUin ?? "",
|
|
351
|
-
groupAllowList: (qq.groupAllowList ?? []).join(", "), followUpCount: qq.followUpCount ?? 3, followUpSeconds: qq.followUpSeconds ?? 120,
|
|
351
|
+
groupAllowList: (qq.groupAllowList ?? []).join(", "), allGroups: qq.allGroups === true, followUpCount: qq.followUpCount ?? 3, followUpSeconds: qq.followUpSeconds ?? 120,
|
|
352
352
|
callNames: (qq.callNames ?? []).join(", "), ij: { ...(qq.interject ?? {}), chance: Math.round((qq.interject?.chance ?? 0.05) * 100), keywords: (qq.interject?.keywords ?? []).join(", ") }
|
|
353
353
|
}));
|
|
354
354
|
if (!data || !form) return null;
|
|
@@ -358,7 +358,7 @@ window.__ModuleLoader__.load({
|
|
|
358
358
|
setForm(next);
|
|
359
359
|
const res = await api("POST", "/channels/qq-config", {
|
|
360
360
|
enabled: next.enabled, wsUrl: next.wsUrl, ...(next.accessToken !== "" ? { accessToken: next.accessToken } : {}),
|
|
361
|
-
masterQqUin: next.masterQqUin, groupAllowList: split(next.groupAllowList),
|
|
361
|
+
masterQqUin: next.masterQqUin, groupAllowList: split(next.groupAllowList), allGroups: next.allGroups === true,
|
|
362
362
|
followUpCount: Number(next.followUpCount), followUpSeconds: Number(next.followUpSeconds), callNames: split(next.callNames),
|
|
363
363
|
interject: { enabled: next.ij.enabled === true, chance: Number(next.ij.chance) / 100, cooldownMinutes: Number(next.ij.cooldownMinutes), maxPerHour: Number(next.ij.maxPerHour), keywords: split(next.ij.keywords) }
|
|
364
364
|
});
|
|
@@ -387,7 +387,8 @@ window.__ModuleLoader__.load({
|
|
|
387
387
|
form.enabled ? Row({ title: "SnowLuma 地址" }, field("wsUrl", { placeholder: "ws://127.0.0.1:3001" })) : null,
|
|
388
388
|
form.enabled ? Row({ title: "访问令牌" }, h(Secret, { label: "访问令牌", value: form.accessToken, placeholder: qq.hasToken ? qq.tokenMasked : "accessToken", onChange: (e) => patch({ accessToken: e.target.value }), onBlur: () => { if (form.accessToken !== "") save(); } })) : null,
|
|
389
389
|
form.enabled ? Row({ title: "主人 QQ" }, field("masterQqUin", { inputMode: "numeric" })) : null,
|
|
390
|
-
form.enabled ? Row({ title: "
|
|
390
|
+
form.enabled ? Row({ title: "所有群" }, h(Switch, { label: "所有群", checked: form.allGroups, onChange: (v) => save({ allGroups: v }) }), Muted(form.allGroups ? "任何群里 @ 都回" : "只回下面列的群")) : null,
|
|
391
|
+
form.enabled && !form.allGroups ? Row({ title: "只在这些群" }, field("groupAllowList", { placeholder: "群号,逗号分隔;空 = 谁都不回" })) : null,
|
|
391
392
|
form.enabled ? Row({ title: "点名后接着听" },
|
|
392
393
|
Num({ min: 0, max: 20, value: form.followUpCount, "aria-label": "条数", onChange: (e) => patch({ followUpCount: e.target.value }), onBlur: () => save() }), Muted("条"),
|
|
393
394
|
Num({ min: 0, max: 1800, value: form.followUpSeconds, "aria-label": "秒数", onChange: (e) => patch({ followUpSeconds: e.target.value }), onBlur: () => save() }), Muted("秒")) : null,
|
package/lib/config-schema.js
CHANGED
|
@@ -9,7 +9,8 @@ export function fishSoulConfigSchema(z) {
|
|
|
9
9
|
enabled: z.boolean().default(false),
|
|
10
10
|
wsUrl: z.string().default('ws://127.0.0.1:3001'), // SnowLuma OneBot 11 正向 WS(Universal)
|
|
11
11
|
accessToken: z.string().default(''),
|
|
12
|
-
groupAllowList: z.array(z.string()).default([]), //
|
|
12
|
+
groupAllowList: z.array(z.string()).default([]), // 白名单:空 = 谁都不放行(默认拒绝);群要在这里列出才会被回应
|
|
13
|
+
allGroups: z.boolean().default(false), // 显式放开:true = 所有群(仍然只听点名)
|
|
13
14
|
followUpCount: z.number().default(3),
|
|
14
15
|
followUpSeconds: z.number().default(120),
|
|
15
16
|
batchMs: z.number().default(1500),
|
package/lib/gateway.js
CHANGED
|
@@ -158,6 +158,7 @@ export class ChatGateway {
|
|
|
158
158
|
return {
|
|
159
159
|
enabled: q.enabled === true,
|
|
160
160
|
groupAllowList: Array.isArray(q.groupAllowList) ? q.groupAllowList.map(String) : [],
|
|
161
|
+
allGroups: q.allGroups === true,
|
|
161
162
|
followUpCount: Number.isFinite(Number(q.followUpCount)) ? Number(q.followUpCount) : 3,
|
|
162
163
|
followUpSeconds: Number.isFinite(Number(q.followUpSeconds)) ? Number(q.followUpSeconds) : 120,
|
|
163
164
|
batchMs: Number.isFinite(Number(q.batchMs)) ? Number(q.batchMs) : 1500,
|
|
@@ -523,8 +524,10 @@ export class ChatGateway {
|
|
|
523
524
|
setKv(this.db, `qq.cursor.${channelId}`, { timeMs, messageId });
|
|
524
525
|
}
|
|
525
526
|
|
|
527
|
+
// 默认拒绝:白名单为空、也没显式打开 allGroups 时,任何群都不放行。
|
|
526
528
|
groupAllowed(groupId, cfg) {
|
|
527
|
-
|
|
529
|
+
if (cfg.allGroups === true) return true;
|
|
530
|
+
return cfg.groupAllowList.includes(String(groupId));
|
|
528
531
|
}
|
|
529
532
|
|
|
530
533
|
/** OneBot 事件入口(实时推送和断线补拉共用)。 */
|
package/lib/routes.js
CHANGED
|
@@ -432,6 +432,7 @@ export function registerRoutes(ctx, deps) {
|
|
|
432
432
|
hasToken: Boolean(q.accessToken),
|
|
433
433
|
tokenMasked: maskKey(q.accessToken ?? ''),
|
|
434
434
|
groupAllowList: Array.isArray(q.groupAllowList) ? q.groupAllowList : [],
|
|
435
|
+
allGroups: q.allGroups === true,
|
|
435
436
|
followUpCount: q.followUpCount ?? 3,
|
|
436
437
|
followUpSeconds: q.followUpSeconds ?? 120,
|
|
437
438
|
callNames: Array.isArray(q.callNames) ? q.callNames : [],
|
|
@@ -473,6 +474,7 @@ export function registerRoutes(ctx, deps) {
|
|
|
473
474
|
...(typeof body.accessToken === 'string' && body.accessToken !== '' ? { accessToken: body.accessToken.trim() } : {}),
|
|
474
475
|
...(body.clearToken === true ? { accessToken: '' } : {}),
|
|
475
476
|
groupAllowList: groups,
|
|
477
|
+
allGroups: body.allGroups === undefined ? cur.allGroups === true : body.allGroups === true,
|
|
476
478
|
followUpCount: Math.min(20, Math.max(0, Math.floor(Number(body.followUpCount ?? cur.followUpCount ?? 3)) || 0)),
|
|
477
479
|
followUpSeconds: Math.min(1800, Math.max(0, Math.floor(Number(body.followUpSeconds ?? cur.followUpSeconds ?? 120)) || 0)),
|
|
478
480
|
callNames: Array.isArray(body.callNames) ? body.callNames.map((x) => String(x).trim()).filter(Boolean).slice(0, 10) : (cur.callNames ?? []),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-fish-soul",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记(DSH 插件,单角色 feiyu)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|