dsh-fish-soul 0.18.25 → 0.19.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让一个 QQ 小号背后有"同一个人":固定人格、按人记记忆、有自己的生活节奏、会主动开口;同一个"她"同时出现在 QQ、B站、抖音。
4
4
 
5
- DSH 插件(单角色 `feiyu`)。版本 **0.18.25**。
5
+ DSH 插件(单角色 `feiyu`)。版本 **0.19.0**。
6
6
 
7
7
  QQ 交流群:**1125962189**
8
8
 
@@ -23,7 +23,12 @@ window.__ModuleLoader__.load({
23
23
  function NumField({ value, min, max, step, label, onSave, ui }) {
24
24
  const [v, setV] = react.useState(String(value));
25
25
  react.useEffect(() => { setV(String(value)); }, [value]);
26
- return ui.Num({ value: v, min, max, step, "aria-label": label, onChange: (e) => setV(e.target.value), onBlur: () => { if (v !== String(value) && v !== "") onSave(Number(v)); } });
26
+ return ui.Num({ value: v, min, max, step, "aria-label": label, onChange: (e) => setV(e.target.value), onBlur: () => {
27
+ if (v.trim() === "" || !Number.isFinite(Number(v))) { setV(String(value)); return; }
28
+ const clamped = Math.min(max ?? Infinity, Math.max(min ?? -Infinity, Number(v)));
29
+ setV(String(clamped));
30
+ if (clamped !== value) onSave(clamped);
31
+ } });
27
32
  }
28
33
 
29
34
  /** 失焦才保存的多行列表(一行一个) */
@@ -140,13 +145,13 @@ window.__ModuleLoader__.load({
140
145
  }
141
146
  const topics = d.topics?.items ?? [];
142
147
  const now = Date.now();
143
- return Group({ title: "日记", aside: Button({ variant: "ghost", disabled: busy, onClick: writeNow }, busy ? "在写…" : "现在写一篇") },
148
+ return Group({ title: "每晚记录", aside: Button({ disabled: busy, onClick: writeNow }, busy ? "在写…" : "现在写一篇") },
144
149
  Row({ title: "每晚写日记", desc: "记成她自己的私密记忆(群里不会想起),顺便想想明天想跟谁聊什么" },
145
150
  h(Switch, { label: "每晚写日记", checked: c.enabled, onChange: (v) => save({ diary: { enabled: v } }) })),
146
- c.enabled ? Row({ title: "几点写" }, h(NumField, { ui, value: c.hour, min: 18, max: 23, step: 1, label: "几点写", onSave: (n) => save({ diary: { hour: n } }) }), Muted("点以后(她的时间)")) : null,
151
+ c.enabled ? Row({ title: "几点写" }, h(NumField, { ui, value: c.hour, min: 18, max: 23, step: 1, label: "几点写", onSave: (n) => save({ diary: { hour: n } }) }), Muted("点以后")) : null,
147
152
  Row({ title: "发到 QQ 空间", desc: "默认关;SnowLuma 不支持的话会在动态里记一条失败" },
148
153
  h(Switch, { label: "发到 QQ 空间", checked: c.qzone, onChange: (v) => save({ diary: { qzone: v } }) })),
149
- topics.length === 0 ? null : h("div", { className: "fs-list" }, topics.map((x, i) => h("div", { className: "fs-item", key: `t${i}` },
154
+ topics.length === 0 ? null : h("div", { className: "fs-list" }, topics.map((x) => h("div", { className: "fs-item", key: `${x.who ?? ""}:${x.topic}` },
150
155
  Tag("想聊", "info"), h("span", { className: "fs-item-main" }, `${x.who ? `${x.who}:` : ""}${x.topic}`),
151
156
  h("span", { className: "fs-item-meta" }, IconButton("close", "删除", async () => {
152
157
  const r = await api("POST", "/diary/topic-remove", { who: x.who ?? "", topic: x.topic });
@@ -170,7 +175,7 @@ window.__ModuleLoader__.load({
170
175
  const groups = data.groups ?? [];
171
176
  return h(react.Fragment, null,
172
177
  section === "habits" ? h(Habits, { cfg: data.config, save, ui }) : null,
173
- section === "groups" ? Group({ title: "每个群" }, groups.length === 0 ? Empty("还没有群(在 QQ 页填群白名单,或者等群里有人叫她)")
178
+ section === "groups" ? Group({ title: "每个群" }, groups.length === 0 ? Empty("还没有群")
174
179
  : groups.map((g) => h(GroupNote, { key: g.groupId, g, api, notify, onSaved: load, ui }))) : null,
175
180
  section === "models" ? h(ChatModels, { data, api, notify, load, ui }) : null,
176
181
  section === "diary" ? h(Diary, { data, save, api, notify, load, relTime, ui }) : null);
@@ -23,25 +23,32 @@ window.__ModuleLoader__.load({
23
23
  /** 跟 ActivityPane 一样的轮询小工具(各分块页各有一份,不跨块 import)。 */
24
24
  function usePoll(api, path, ms) {
25
25
  const [data, setData] = react.useState(null);
26
- const load = react.useCallback(async () => {
26
+ const [err, setErr] = react.useState("");
27
+ const load = react.useCallback(async (guard) => {
27
28
  const r = await api("GET", path);
28
- if (r?.ok) setData(r);
29
+ if (guard && !guard()) return;
30
+ if (r?.ok) { setData(r); setErr(""); }
31
+ else setErr(r?.error ?? "日志读取失败");
29
32
  }, [api, path]);
30
33
  react.useEffect(() => {
31
34
  let alive = true;
32
- const run = async () => { if (alive) await load(); };
35
+ const run = () => load(() => alive);
33
36
  run();
34
37
  const t = setInterval(run, ms);
35
38
  return () => { alive = false; clearInterval(t); };
36
39
  }, [load, ms]);
37
- return [data, load];
40
+ return [data, () => load(), err];
38
41
  }
39
42
 
40
43
  function DiagPane({ api, notify, ui }) {
41
- const { h, Group, Tag, Button, Muted } = ui;
44
+ const { h, Group, Tag, Button, useConfirm = () => [async () => true, null] } = ui;
42
45
  const [raw, setRaw] = react.useState(false);
43
- const [data, load] = usePoll(api, "/diag-log", 15000);
44
- if (!data) return null;
46
+ const [data, load, err] = usePoll(api, "/diag-log", 15000);
47
+ const [confirm, confirmNode] = useConfirm();
48
+ if (!data) {
49
+ if (err) return h("div", { className: "fs-notice", role: "alert" }, h("b", null, "运行日志读取失败"), h("span", null, err), Button({ onClick: load }, "重试"));
50
+ return h("div", { className: "fs-empty" }, "加载中…");
51
+ }
45
52
 
46
53
  const entries = data.entries ?? [];
47
54
  const pad = (n) => String(n).padStart(2, "0");
@@ -57,52 +64,44 @@ window.__ModuleLoader__.load({
57
64
  if (d.sessionId) bits.push(`会话 ${String(d.sessionId).slice(0, 12)}…`);
58
65
  if (d.channelId) bits.push(`聊天 ${d.channelId}`);
59
66
  if (d.count !== undefined) bits.push(`${d.count} 条`);
60
- if (d.chars !== undefined) bits.push(`${d.chars} 字${d.budget ? ` / 预算 ${d.budget}` : ""}${d.over80 ? "(超 80%)" : ""}`);
67
+ if (d.chars !== undefined) bits.push(`${d.chars} 字${d.budget ? ` / 预算 ${d.budget}` : ""}${d.over80 ? " · 超 80%" : ""}`);
61
68
  if (d.code) bits.push(`错误码 ${String(d.code).slice(0, 48)}`);
62
69
  if (d.reason) bits.push(String(d.reason).slice(0, 120));
63
70
  if (d.error) bits.push(String(d.error).slice(0, 120));
64
71
  if (e.count > 1) bits.push(`重复 ${e.count} 次`);
65
- return bits.join(",") || "(没有细节)";
72
+ return bits.join(",") || "无细节";
73
+ };
74
+ const copy = async () => {
75
+ try { await navigator.clipboard.writeText(JSON.stringify(entries, null, 2)); notify("已复制"); }
76
+ catch { notify("复制失败,手动选中复制"); }
77
+ };
78
+ const clearLogs = async () => {
79
+ if (!(await confirm({ title: "清空运行日志", description: "清空当前的运行记录?", danger: true }))) return;
80
+ const r = await api("POST", "/diag-log/clear", {});
81
+ if (r?.ok) { notify("已清空"); load(); } else notify(r?.error ?? "清空失败");
66
82
  };
67
- const levelStyle = (lv) => (lv === "error"
68
- ? { color: "var(--dsw-alias-state-error-primary, #d93025)" }
69
- : lv === "warn" ? { color: "var(--dsw-alias-state-warning-primary, #b26a00)" } : null);
70
83
 
71
84
  return Group({
72
- title: "运行日志",
73
- aside: h("span", { style: { display: "flex", gap: 8, alignItems: "center" } },
85
+ title: "最近 200 条",
86
+ tip: "插件启动步骤、人格卡挂载与每轮上下文长度,仅留内存不落盘",
87
+ aside: h("span", { className: "fs-group-aside" },
74
88
  Tag(String(entries.length), "outline"),
75
- Button({ variant: "ghost", onClick: () => load() }, "刷新"),
76
- Button({ variant: "ghost", onClick: () => setRaw((v) => !v) }, raw ? "看时间线" : "看原始"),
77
- Button({
78
- variant: "ghost", disabled: entries.length === 0,
79
- onClick: async () => {
80
- const r = await api("POST", "/diag-log/clear", {});
81
- if (r?.ok) { notify("已清空"); load(); } else notify(r?.error ?? "清空失败");
82
- }
83
- }, "清空"))
89
+ Button({ onClick: () => load() }, "刷新"),
90
+ Button({ disabled: entries.length === 0, onClick: copy }, "复制"),
91
+ Button({ "aria-pressed": raw, onClick: () => setRaw((v) => !v) }, raw ? "看时间线" : "看原始"),
92
+ Button({ variant: "danger", disabled: entries.length === 0, onClick: clearLogs }, "清空"))
84
93
  },
85
- Muted("插件自己的运行记录:启动到哪一步、人格卡/瞬态块有没有挂上、会话是新建还是恢复、每轮上下文多长。只留最近 200 条,不落盘。"),
86
- Muted("这里没有「宿主压缩上下文」的记录 —— 宿主不广播那个事件,插件看不到。上下文变长能在「这一轮上下文长度」里看出来。"),
87
94
  entries.length === 0
88
95
  ? h("div", { className: "fs-empty" }, "还没有记录。重启宿主后回来就能看到启动过程。")
89
96
  : raw
90
- ? h("pre", {
91
- className: "fs-report",
92
- style: { maxHeight: 420, overflow: "auto", fontSize: 12, whiteSpace: "pre-wrap", wordBreak: "break-all" }
93
- }, JSON.stringify(entries, null, 2))
94
- : h("div", { style: { display: "flex", flexDirection: "column", gap: 2 } },
95
- entries.map((e, i) => h("div", {
96
- key: `${e.at}-${i}`,
97
- style: {
98
- display: "flex", gap: 10, alignItems: "baseline",
99
- padding: "4px 0", borderBottom: "1px solid var(--dsw-alias-border-l1, #eee)", fontSize: 13
100
- }
101
- },
102
- h("span", { style: { color: "var(--dsw-alias-text-3, #888)", fontVariantNumeric: "tabular-nums", flex: "0 0 auto" } }, fmtTime(e.at)),
103
- h("span", { style: { fontWeight: 500, flex: "0 0 auto", ...(levelStyle(e.level) ?? {}) } }, e.label),
104
- h("span", { style: { color: "var(--dsw-alias-text-2, #555)", wordBreak: "break-word" } }, describe(e)))))
105
- );
97
+ ? h("pre", { className: "fs-report fs-diag-raw" }, JSON.stringify(entries, null, 2))
98
+ : h("div", { className: "fs-diag-list" },
99
+ entries.map((e, i) => h("div", { key: `${e.at}-${e.key ?? i}`, className: "fs-diag-row" },
100
+ h("span", { className: "fs-diag-time" }, fmtTime(e.at)),
101
+ e.level === "error" ? Tag("错误", "danger") : e.level === "warn" ? Tag("警告", "warning") : null,
102
+ h("span", { className: "fs-diag-label", "data-level": e.level }, e.label),
103
+ h("span", { className: "fs-diag-detail" }, describe(e))))),
104
+ confirmNode);
106
105
  }
107
106
 
108
107
  return { DiagPane };
@@ -16,7 +16,7 @@ window.__ModuleLoader__.load({
16
16
  { value: "volc", label: "火山方舟" },
17
17
  { value: "minimax", label: "MiniMax" },
18
18
  { value: "openai-compat", label: "OpenAI 兼容" },
19
- { value: "openmotion", label: "OpenMotion(本地渲染)" }
19
+ { value: "openmotion", label: "OpenMotion 本地渲染" }
20
20
  ];
21
21
  // 各家常用接口地址示例(接口地址、API Key、模型名都必须填;填错会被对方拒绝)。
22
22
  const VIDEO_BASE_URLS = {
@@ -33,24 +33,34 @@ window.__ModuleLoader__.load({
33
33
  function LoginView({ api, notify, refresh, ui }) {
34
34
  const { h, Empty, Dot } = ui;
35
35
  const [shot, setShot] = react.useState(null);
36
+ const timerRef = react.useRef(null);
37
+ const aliveRef = react.useRef(true);
36
38
  const load = react.useCallback(async () => {
37
39
  const r = await api("POST", "/douyin/screenshot", { checkLogin: true });
40
+ if (!aliveRef.current) return;
38
41
  if (r?.ok) {
39
42
  setShot(r);
40
43
  if (r.loggedIn === true) { notify("抖音已登录"); refresh(); }
41
44
  }
42
- }, [api]);
45
+ }, [api, notify, refresh]);
43
46
  react.useEffect(() => {
47
+ aliveRef.current = true;
44
48
  load();
45
49
  const t = setInterval(load, 3000);
46
- return () => clearInterval(t);
50
+ return () => { aliveRef.current = false; clearInterval(t); if (timerRef.current) clearTimeout(timerRef.current); };
47
51
  }, [load]);
48
52
  const click = async (e) => {
49
53
  const rect = e.currentTarget.getBoundingClientRect();
50
54
  await api("POST", "/douyin/click", { x: (e.clientX - rect.left) / rect.width, y: (e.clientY - rect.top) / rect.height });
51
- setTimeout(load, 700);
55
+ if (timerRef.current) clearTimeout(timerRef.current);
56
+ timerRef.current = setTimeout(load, 700);
52
57
  };
53
- return h("figure", { className: "fs-shot", onClick: click, title: "点击会点到那个浏览器窗口" },
58
+ return h("figure", {
59
+ className: "fs-shot", role: "button", tabIndex: 0, "aria-label": "抖音浏览器截图,点击操作窗口",
60
+ onClick: click,
61
+ onKeyDown: (e) => { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); api("POST", "/douyin/click", { x: 0.5, y: 0.5 }).then(() => { if (timerRef.current) clearTimeout(timerRef.current); timerRef.current = setTimeout(load, 700); }); } },
62
+ title: "点击会点到那个浏览器窗口"
63
+ },
54
64
  shot === null ? Empty(Dot("ongoing")) : h("img", { alt: "抖音浏览器截图", src: shot.image, draggable: false }));
55
65
  }
56
66
 
@@ -110,11 +120,14 @@ window.__ModuleLoader__.load({
110
120
 
111
121
  const act = async (path, body, okMsg, failMsg) => {
112
122
  setBusy(true);
113
- const r = await api("POST", path, body);
114
- setBusy(false);
115
- if (!r?.ok) notify(r?.error ?? failMsg);
116
- else { if (okMsg) notify(okMsg); refresh(); }
117
- return r;
123
+ try {
124
+ const r = await api("POST", path, body);
125
+ if (!r?.ok) notify(r?.error ?? failMsg);
126
+ else { if (okMsg) notify(okMsg); refresh(); }
127
+ return r;
128
+ } finally {
129
+ setBusy(false);
130
+ }
118
131
  };
119
132
  const save = async (p = {}) => {
120
133
  const hadKey = form.videoApiKey !== "";
@@ -179,48 +192,42 @@ window.__ModuleLoader__.load({
179
192
  notices.length === 0 ? null : h("div", { className: "fs-notice", role: "alert" },
180
193
  ...notices.map(([t, text]) => h("span", { key: t }, h("b", null, t), ` · ${text}`))),
181
194
  Group({ title: "浏览器" },
195
+ Row({ title: "抖音接入" }, poll, sw("抖音接入", d.enabled === true, (v) => save({ top: { enabled: v } }))),
182
196
  Row({ title: "专用浏览器" },
183
197
  Select({ value: form.custom ? CUSTOM : (d.browserPref?.kind ?? "edge"), "aria-label": "专用浏览器", onChange: (e) => pick(e.target.value) },
184
198
  ...browsers.map((b) => h("option", { key: b.kind, value: b.kind }, `${b.name}${b.version ? ` ${b.version}` : ""}`)),
185
199
  browsers.length === 0 ? h("option", { key: "none", value: d.browserPref?.kind ?? "edge", disabled: true }, "没找到浏览器") : null,
186
200
  h("option", { key: CUSTOM, value: CUSTOM }, "手动指定路径…")),
187
201
  IconButton("refresh", "重新查找", () => act("/douyin/browser/rescan", {}, "已重新查找", "没找到"), { disabled: busy })),
188
- form.custom ? Row({ title: "浏览器路径" }, Input({ ...bind("customPath"), placeholder: "C:\\…\\chrome.exe" })) : null,
202
+ form.custom ? Row({ title: "浏览器路径" }, Input({ ...bind("customPath"), "aria-label": "浏览器路径", placeholder: "C:\\…\\chrome.exe" })) : null,
189
203
  Row({ title: "状态" }, hostState,
190
204
  running ? null : Button({ variant: "primary", disabled: busy || d.enabled !== true, onClick: () => act("/douyin/browser/start", {}, "浏览器已启动", "没启动起来") }, "启动"),
191
- running && host.loggedIn === true ? Button({ variant: "ghost", "aria-expanded": showShot, onClick: () => setShowShot(!showShot) }, showShot ? "收起截图" : "截图") : null,
192
- running ? Button({ variant: "danger", disabled: busy, onClick: () => act("/douyin/browser/close", {}, "浏览器已关闭", "关不掉") }, "关闭") : null),
205
+ running && host.loggedIn === true ? Button({ "aria-expanded": showShot, onClick: () => setShowShot(!showShot) }, showShot ? "收起截图" : "截图") : null,
206
+ running ? Button({ variant: "danger", disabled: busy, onClick: async () => { if (await confirm({ title: "关闭专用浏览器", description: "关闭正在运行的抖音浏览器?", danger: true })) await act("/douyin/browser/close", {}, "浏览器已关闭", "关不掉"); } }, "关闭") : null),
193
207
  Row({ title: "窗口", desc: d.window === "visible" ? "最小化了的话,她看私信 / 刷视频时会弹出来" : "停在屏幕外,不会弹出来打扰你;别在任务栏把它最小化" },
194
- running && d.window !== "visible" ? Button({ variant: "ghost", disabled: busy, onClick: () => act("/douyin/window", { show: !d.windowShown }, null, "窗口挪不动") }, d.windowShown ? "藏起来" : "显示一下") : null,
208
+ running && d.window !== "visible" ? Button({ disabled: busy, onClick: () => act("/douyin/window", { show: !d.windowShown }, null, "窗口挪不动") }, d.windowShown ? "藏起来" : "显示一下") : null,
195
209
  h(Seg, { label: "窗口", value: d.window === "visible" ? "visible" : "background", options: WINDOW_MODES, onChange: (v) => save({ top: { window: v } }) })),
196
210
  running && (host.loggedIn !== true || showShot) ? h(LoginView, { api, notify, refresh, ui }) : null),
197
211
  Group({ title: "私信" },
198
212
  d.channel?.identityBlocked
199
- ? Row({ title: "私信身份未就绪", desc: d.channel?.identityState?.disabledByFlag
200
- ? "身份绑定被手动停用(DOUYIN_IDENTITY_BLOCKED),私信一律不处理、不发送。"
201
- : "还不知道这个抖音号自己的 uid,所以无法确认会话里对方是谁;私信暂不处理。正常聊过一轮、或抖音自己推过一条会话消息后会自动学到。刷到的视频仍会走 QQ 分享。" })
202
- : Row({ title: "私信按会话认人", desc: `身份用会话 ID 判定(\`0:1:我方:对方\`),昵称只作展示:改名、同名都不会串人。发送前会用会话 ID 校验目标,拿不到就发不出去,不会发给错的人。${(d.channel?.identityState?.selfUids ?? []).length ? `\n这个抖音号自己的 uid:${(d.channel.identityState.selfUids).join(" / ")}(下面「主人身份」要填的就是你自己那个数字 uid)` : ""}` }),
203
- Row({ title: "抖音接入" }, poll, sw("抖音接入", d.enabled === true, (v) => save({ top: { enabled: v } }))),
213
+ ? Row({ title: "私信身份未就绪", meta: d.channel?.identityState?.disabledByFlag ? "已被 DOUYIN_IDENTITY_BLOCKED 手动停用" : "尚未学到这个抖音号自己的 uid,正常聊过一轮后自动学到" },
214
+ State("warning", "未就绪"))
215
+ : Row({ title: "私信按会话认人", meta: (d.channel?.identityState?.selfUids ?? []).length ? `本号 uid:${d.channel.identityState.selfUids.join(" / ")}` : "按会话 ID 0:1:我方:对方 认人", desc: "昵称只作展示,改名或同名都不会串人;发送前用会话 ID 校验目标" },
216
+ State("done", "已就绪")),
204
217
  Row({ title: "自动回复" }, d.autoReply ? null : Muted("只记不回"), sw("自动回复", d.autoReply === true, (v) => save({ top: { autoReply: v } }))),
205
218
  (d.channel?.inbox?.counts?.processing ?? 0) > 0 ? Muted(`正在处理 ${d.channel.inbox.counts.processing} 条;如果长时间不变,重启后核实`) : null,
206
- Row({ title: "主人身份(可选)", desc: `填**你自己**的抖音数字 uid,她就认得出「你是主人」:私聊里标「(主人)」,可以主动给你发视频卡片、把 B站/抖音会话并进你的 QQ 私聊。**不填也能正常收私信、记记忆、回复** —— 认人靠的是会话 ID,不是这个字段。${(d.channel?.identityState?.selfUids ?? []).length ? `\n注意:上面显示的是这个抖音号(机器人自己)的 uid,不是你的。` : ""}昵称可被同名冒充、改名又会对不上,所以不参与授权。只填数字就行,前缀会自动补。` },
207
- Input({ ...bind("masterUid"), placeholder: "你的抖音数字 uid" })),
208
- Row({ title: "主人的名字", desc: "仅作显示(提示词里怎么称呼);不授予任何权限" }, Input({ ...bind("masterName"), placeholder: "她私信列表里你的名字" })),
209
- // 🔴 填了「主人身份」但跟已学到的真实 uid 对不上 ⇒ 显式警告。
210
- // 静默失效是最坏的失败:用户看到的是「她不理我」,不会想到是配置。
211
- // 短号和真实 uid 都是纯数字,用户分不出来 —— 必须在这里点破。
219
+ Row({ title: "主人身份", meta: "可选,仅用于标为主人,不影响收发私信", desc: "填你自己的抖音数字 uid;注意上面显示的是机器人自己这个号的 uid,不是你的。只填数字就行" },
220
+ Input({ ...bind("masterUid"), inputMode: "numeric", "aria-label": "主人身份 uid", placeholder: "你的抖音数字 uid" })),
221
+ Row({ title: "主人的名字", desc: "仅作显示,不授予任何权限" }, Input({ ...bind("masterName"), "aria-label": "主人的名字", placeholder: "她私信列表里你的名字" })),
212
222
  d.channel?.identityState?.masterUidMismatch
213
223
  ? Row({ title: "这个 uid 认不出来" }, State("warning",
214
- `你填的 ${d.channel.identityState.masterUidMismatch.filled} 跟已学到的抖音身份都对不上。`
215
- + `多半是填成了账号短号(那个不是 uid)。**留空就行** —— 认人靠的是会话 ID,不靠这个字段。`
216
- + `已学到的身份:${d.channel.identityState.masterUidMismatch.learned.join(" / ")}`))
224
+ `你填的 ${d.channel.identityState.masterUidMismatch.filled} 跟已学到的抖音身份对不上,多半填成了账号短号。留空就行;已学到的身份:${d.channel.identityState.masterUidMismatch.learned.join(" / ")}`,
225
+ undefined, true))
217
226
  : null,
218
- // 待确认的抖音身份:昵称对应表只能「定位」,绑定必须主人亲手确认一次
219
- // (自动绑 = 谁先来谁被绑,冒充者改名就能顶身份;实测确认过这个洞)。
220
227
  (candidates ?? []).length === 0 ? null : Group({ title: "待确认的抖音身份" },
221
- Muted("这些昵称你配了对应表,但还没确认过真人。**看一眼 uid 是不是你自己**——对就点「是我」,不对就别点(那是别人冒用这个名字)。"),
228
+ Muted("请核对 uid 是不是你自己,确认后点「是我」。"),
222
229
  ...(candidates ?? []).map((c) => Row({ key: c.name, title: `${c.name} → QQ ${c.qq}`,
223
- desc: `抖音 uid ${c.uid}${c.at ? ` · ${new Date(c.at).toLocaleString()}` : ""}` },
230
+ meta: `抖音 uid ${c.uid}${c.at ? ` · ${new Date(c.at).toLocaleString()}` : ""}` },
224
231
  Button({ variant: "primary", disabled: busy, onClick: async () => {
225
232
  setBusy(true);
226
233
  try {
@@ -231,40 +238,46 @@ window.__ModuleLoader__.load({
231
238
  } }, "是我"),
232
239
  Button({ variant: "outline", disabled: busy, onClick: async () => {
233
240
  setBusy(true);
234
- try { await api("POST", "/douyin/uin-dismiss", { name: c.name }); await loadCandidates(); refresh(); } finally { setBusy(false); }
241
+ try {
242
+ const r = await api("POST", "/douyin/uin-dismiss", { name: c.name });
243
+ if (r?.ok) { notify(`已忽略:${c.name}`); await loadCandidates(); refresh(); }
244
+ else notify(r?.error ?? "操作失败");
245
+ } finally { setBusy(false); }
235
246
  } }, "不是我")))),
236
247
  Row({ title: "回所有能私信她的人", desc: d.replyAll ? "建议在抖音隐私设置里把「谁可以私信我」设为互关好友" : null },
237
248
  sw("回所有能私信她的人", d.replyAll === true, (v) => save({ top: { replyAll: v } }))),
238
- Row({ title: "超过多久的消息只记不回", desc: "断线补拉 / 重启后积压的老消息,超过这个时间就只记进记忆、不回复" },
249
+ Row({ title: "超过多久的消息只记不回", desc: "断线补拉或重启后积压的老消息,超过这个时间就只记进记忆、不回复" },
239
250
  Num({ min: 1, max: 1440, value: form.replyWindowMinutes, "aria-label": "分钟", onChange: (e) => patch({ replyWindowMinutes: e.target.value }), onBlur: () => save({ top: { replyWindowMinutes: form.replyWindowMinutes === "" ? 120 : Number(form.replyWindowMinutes) } }) }), Muted("分钟")),
240
- d.replyAll ? null : Row({ title: "白名单", stack: true }, Area({ ...bind("allowList"), placeholder: "对方的抖音数字 uid,每行一个;昵称不参与放行" }))),
251
+ d.replyAll ? null : Row({ title: "白名单", stack: true }, Area({ ...bind("allowList"), "aria-label": "白名单", placeholder: "对方的抖音数字 uid,每行一个;昵称不参与放行" }))),
241
252
  Group({ title: "群聊" },
242
253
  Row({ title: "群里被叫到时回", desc: "群聊按说话的人分开认,不会当成一个人;没人 @ 她或叫她名字时只看不说" },
243
254
  sw("群里被叫到时回", d.groupReply === true, (v) => save({ top: { groupReply: v } }))),
244
- Row({ title: "叫她的名字", stack: true }, Area({ ...bind("callNames"), placeholder: "她的抖音昵称等,每行一个(QQ 那边设的称呼也算)" })),
245
- Row({ title: "这些会话是群", stack: true }, Area({ ...bind("groups"), placeholder: "一般能自动认出来;认不出来的群在这里填会话名,每行一个" }))),
255
+ Row({ title: "叫她的名字", stack: true }, Area({ ...bind("callNames"), "aria-label": "叫她的名字", placeholder: "她的抖音昵称等,每行一个" })),
256
+ Row({ title: "这些会话是群", stack: true }, Area({ ...bind("groups"), "aria-label": "这些会话是群", placeholder: "认不出来的群在这里填会话名,每行一个" }))),
246
257
  Group({ title: "刷视频", aside: Tag(`今天 ${br.todayCount ?? 0} / ${br.perDay ?? 3}`, "outline") },
247
258
  Row({ title: "空闲时自己刷" },
248
- browseOn ? Button({ variant: "ghost", disabled: br.running === true || d.enabled !== true || !running, onClick: () => act("/douyin/browse-now", {}, "开始刷了", "没刷成") }, br.running ? "正在刷…" : "现在刷") : null,
259
+ browseOn ? Button({ disabled: busy || br.running === true || d.enabled !== true || !running, onClick: () => act("/douyin/browse-now", {}, "开始刷了", "没刷成") }, br.running ? "正在刷…" : "现在刷") : null,
249
260
  sw("空闲时自己刷", browseOn, (v) => save({ browse: { enabled: v } }))),
250
261
  browseOn ? Row({ title: "每天" },
251
262
  Num({ min: 0, max: 12, "aria-label": "轮数", ...bind("perDay") }), Muted("轮 ×"),
252
263
  Num({ min: 1, max: 6, "aria-label": "每轮条数", ...bind("videosPerSession") }), Muted("条")) : null,
253
- browseOn ? Row({ title: "走接口刷(不开浏览器)", desc: "直接调抖音网页端接口拉推荐流和评论,不用开专用浏览器;关掉就回到浏览器里滑推荐页(老路)" },
254
- sw("走接口刷(不开浏览器)", br.mode !== "browser", (v) => save({ browse: { mode: v ? "http" : "browser" } }))) : null,
255
- browseOn ? Row({ title: "喜欢就点赞", desc: "模型自己说「特别喜欢」才点;走接口这条路要点上面那个接口点赞开关才生效" }, sw("喜欢就点赞", br.like === true, (v) => save({ browse: { like: v } }))) : null,
256
- browseOn ? Row({ title: "喜欢就收藏", desc: "模型说「想留着以后再看」就收藏(少数几条);写操作要真机验过,默认关" }, sw("喜欢就收藏", br.collect === true, (v) => save({ browse: { collect: v } }))) : null,
257
- browseOn ? Row({ title: "抽帧看画面", desc: "把视频开头均匀抽 9 张拼成九宫格,再让模型读成一句话——这样她「看过」而不只是读过文案。每条多一次识图调用" }, sw("抽帧看画面", br.frames === true, (v) => save({ browse: { frames: v } }))) : null,
258
- browseOn && br.frames === true ? Row({ title: "一天最多看几条", desc: "自己刷的时候,一天最多抽几次帧(每次多一次识图调用)" },
259
- Num({ min: 0, max: 20, value: framesPerDay, onChange: (e) => setFramesPerDay(e.target.value), onBlur: () => { const n = Number(framesPerDay); if (n !== br.framesPerDay) save({ browse: { framesPerDay: n } }); } }), Muted("条")) : null,
260
- browseOn ? Row({ title: "刷到有意思的发给你", desc: br.shareInDm !== false ? "带链接和感受,发到你的抖音私信(抖音没连上就发 QQ);一天最多 2 条" : "带链接和感受,发到你的 QQ 私聊;一天最多 2 条" }, sw("刷到有意思的发给你", br.share !== false, (v) => save({ browse: { share: v } }))) : null,
264
+ browseOn ? Row({ title: "走接口刷", desc: "直接调抖音网页端接口拉推荐流和评论,不用开专用浏览器;关掉就回到浏览器里滑推荐页" },
265
+ sw("走接口刷", br.mode !== "browser", (v) => save({ browse: { mode: v ? "http" : "browser" } }))) : null,
266
+ browseOn ? Row({ title: "喜欢就点赞", desc: "模型判断特别喜欢时才点赞" }, sw("喜欢就点赞", br.like === true, (v) => save({ browse: { like: v } }))) : null,
267
+ browseOn ? Row({ title: "喜欢就收藏", desc: "模型说想留着以后再看时收藏,默认关" }, sw("喜欢就收藏", br.collect === true, (v) => save({ browse: { collect: v } }))) : null,
268
+ browseOn ? Row({ title: "抽帧看画面", desc: "把视频开头均匀抽 9 张拼成九宫格让模型识图;每条多一次识图调用" }, sw("抽帧看画面", br.frames === true, (v) => save({ browse: { frames: v } }))) : null,
269
+ browseOn && br.frames === true ? Row({ title: "一天最多看几条", desc: "自己刷的时候,一天最多抽几次帧" },
270
+ Num({ min: 0, max: 20, value: framesPerDay, "aria-label": "一天最多看几条", onChange: (e) => setFramesPerDay(e.target.value), onBlur: () => { if (framesPerDay === "") return; const n = Number(framesPerDay); if (Number.isFinite(n) && n !== br.framesPerDay) save({ browse: { framesPerDay: n } }); } }), Muted("条")) : null,
271
+ browseOn ? Row({ title: "刷到有意思的发给你", desc: br.shareInDm !== false ? "带链接和感受发到你的抖音私信,没连上就发 QQ;一天最多 2 条" : "带链接和感受发到你的 QQ 私聊;一天最多 2 条" }, sw("刷到有意思的发给你", br.share !== false, (v) => save({ browse: { share: v } }))) : null,
261
272
  browseOn && br.share !== false ? Row({ title: "在抖音私信里分享", desc: "要填「主人的名字」、开自动回复" }, sw("在抖音私信里分享", br.shareInDm !== false, (v) => save({ browse: { shareInDm: v } }))) : null,
262
- browseOn && br.share !== false && br.shareInDm !== false ? Row({ title: "发原生视频卡片", desc: "在抖音私信里发那条点开就播的原生卡片(不发链接)。要在专用浏览器里打开「分享给朋友」面板,收件人按身份锁定、发完回读确认才算数;抖音改版可能失效。专用浏览器没开着就发不出去" }, sw("发原生视频卡片", d.shareCard === true, (v) => save({ top: { shareCard: v } }))) : null),
273
+ browseOn && br.share !== false && br.shareInDm !== false ? Row({ title: "发原生视频卡片", desc: "在抖音私信里发点开就播的原生卡片;需专用浏览器开着,且按收件人身份锁定" }, sw("发原生视频卡片", d.shareCard === true, (v) => save({ top: { shareCard: v } }))) : null),
263
274
  Group({ title: "作品和评论", aside: (post.enabled || video.enabled) ? h("span", { className: "fs-group-aside" },
264
275
  post.enabled ? Tag(`今天发了 ${so.post?.todayCount ?? 0} / ${post.perDay ?? 1}`, "outline") : null,
265
276
  video.enabled ? Tag(`今天视频 ${so.video?.todayCount ?? 0} / ${video.perDay ?? 1}`, "outline") : null) : null },
266
277
  Row({ title: "自己发图文", desc: "把想说的话做成文字卡片,在创作者中心发图文;创作者中心可能要单独登录一次" },
267
- post.enabled ? Button({ variant: "ghost", disabled: busy || so.post?.running === true || so.video?.running === true || Boolean(so.postPending) || d.enabled !== true || !running, onClick: () => act("/douyin/post-now", {}, "发出去了", "没发成") }, so.post?.running ? "正在发…" : "现在发一条") : null,
278
+ post.enabled ? Button({ disabled: busy || so.post?.running === true || so.video?.running === true || Boolean(so.postPending) || d.enabled !== true || !running, onClick: async () => {
279
+ if (await confirm({ title: "现在发一条图文?", description: "将在抖音创作者中心公开发布一条图文动态。", confirmLabel: "发布" })) await act("/douyin/post-now", {}, "发出去了", "没发成");
280
+ } }, so.post?.running ? "正在发…" : "现在发一条") : null,
268
281
  sw("自己发图文", post.enabled === true, (v) => save({ post: { enabled: v } }))),
269
282
  post.enabled ? Row({ title: "每天最多" }, Num({ min: 0, max: 5, "aria-label": "每天最多几条", ...bind("postPerDay") }), Muted("条")) : null,
270
283
  // 视频:生成要调付费接口(按条计费)—— 开关旁边必须写清楚这是花钱的操作,点击前也要二次确认。
@@ -289,16 +302,16 @@ window.__ModuleLoader__.load({
289
302
  Select({ value: form.videoResolution, "aria-label": "分辨率", onChange: (e) => { const v = e.target.value; patch({ videoResolution: v }); save({ video: { resolution: v } }); } },
290
303
  ...VIDEO_RESOLUTIONS.map((o) => h("option", { key: o.value, value: o.value }, o.label)))) : null,
291
304
  video.enabled ? Row({ title: "每天最多" }, Num({ min: 0, max: 5, "aria-label": "每天最多几条视频", ...bind("videoPerDay") }), Muted("条")) : null,
292
- so.postPending ? Row({ title: so.postPending.kind === "video" ? "视频结果待核实" : "图文结果待核实", desc: `先到创作者中心核实,不会自动重发:${so.postPending.text || ""}` },
293
- Button({ variant: "ghost", disabled: busy || so.postPending.status !== "unknown", onClick: () => act("/douyin/post-resolve", { jobId: so.postPending.id, outcome: "not_published" }, "已记录为未发布", "记录失败") }, "已核实未发布"),
294
- Button({ variant: "ghost", disabled: busy || so.postPending.status !== "unknown", onClick: () => act("/douyin/post-resolve", { jobId: so.postPending.id, outcome: "published" }, "已记录为已发布", "记录失败") }, "已核实已发布")) : null,
305
+ so.postPending ? Row({ title: so.postPending.kind === "video" ? "视频结果待核实" : "图文结果待核实", meta: so.postPending.text || "先到创作者中心核实,不会自动重发" },
306
+ Button({ disabled: busy || so.postPending.status !== "unknown", onClick: () => act("/douyin/post-resolve", { jobId: so.postPending.id, outcome: "not_published" }, "已记录为未发布", "记录失败") }, "已核实未发布"),
307
+ Button({ disabled: busy || so.postPending.status !== "unknown", onClick: () => act("/douyin/post-resolve", { jobId: so.postPending.id, outcome: "published" }, "已记录为已发布", "记录失败") }, "已核实已发布")) : null,
295
308
  Row({ title: "回评论", desc: "每 20 分钟看看最近 3 个作品的评论区;抖音可能要短信验证,碰到会停下来提醒你" },
296
- cm.enabled ? Button({ variant: "ghost", disabled: busy || d.enabled !== true || !running, onClick: () => act("/douyin/comments-now", {}, "看完了", "没看成") }, "现在看一眼") : null,
309
+ cm.enabled ? Button({ disabled: busy || d.enabled !== true || !running, onClick: () => act("/douyin/comments-now", {}, "看完了", "没看成") }, "现在看一眼") : null,
297
310
  sw("回评论", cm.enabled === true, (v) => save({ comments: { enabled: v } }))),
298
311
  cm.enabled ? Row({ title: "每小时最多" }, Num({ min: 0, max: 30, "aria-label": "每小时最多回几条", ...bind("commentsPerHour") }), Muted("条")) : null,
299
312
  cm.enabled ? Row({ title: "允许发表情", desc: "把抖音的表情码([微笑] 这种)写进提示词,平台会自动渲染成表情图" },
300
313
  sw("允许发表情", cm.emoji === true, (v) => save({ comments: { emoji: v } }))) : null,
301
- so.blockedUntil ? Row({ title: "等验证" }, State("error", `抖音要验证,${Math.max(1, Math.ceil((so.blockedUntil - Date.now()) / 3600000))} 小时内先不试;去浏览器里验证一下`)) : null,
314
+ so.blockedUntil ? Row({ title: "等验证" }, State("error", `抖音要验证,${Math.max(1, Math.ceil((so.blockedUntil - Date.now()) / 3600000))} 小时内先不试;去浏览器里验证一下`, undefined, true)) : null,
302
315
  so.lastError ? Row({ title: "上次出错" }, State("error", so.lastError)) : null,
303
316
  socialLog.length === 0 ? null : h("div", { className: "fs-list" }, socialLog.map((x) => Item({ key: x.key, lead: x.tag, text: x.text, title: x.text, meta: [h("span", { key: "t" }, relTime(x.at, Date.now()))] })))),
304
317
  recent.length === 0 ? null : Group({ title: "最近看过" },
package/lib/client.js CHANGED
@@ -124,11 +124,24 @@ window.__ModuleLoader__.load({
124
124
 
125
125
  function Seg({ options, value, onChange, label }) {
126
126
  const index = Math.max(0, options.findIndex((o) => o.value === value));
127
+ const onKeyDown = (event, i) => {
128
+ const n = options.length;
129
+ if (n === 0) return;
130
+ const next = event.key === "ArrowLeft" || event.key === "ArrowUp" ? (i + n - 1) % n
131
+ : event.key === "ArrowRight" || event.key === "ArrowDown" ? (i + 1) % n
132
+ : event.key === "Home" ? 0 : event.key === "End" ? n - 1 : -1;
133
+ if (next < 0) return;
134
+ event.preventDefault();
135
+ event.currentTarget.parentElement?.querySelectorAll('[role="radio"]').item(next)?.focus();
136
+ if (options[next].value !== value) onChange(options[next].value);
137
+ };
127
138
  return h("div", { className: "fs-seg", role: "radiogroup", "aria-label": label, style: { "--n": options.length, "--i": index } },
128
139
  h("span", { className: "fs-seg-ind", "aria-hidden": true }),
129
- options.map((o) => h(primitives?.Pill ?? "button", {
140
+ options.map((o, i) => h(primitives?.Pill ?? "button", {
130
141
  type: "button", key: o.value, role: "radio", "aria-checked": o.value === value,
131
- className: "fs-seg-btn", onClick: () => { if (o.value !== value) onChange(o.value); }
142
+ tabIndex: o.value === value ? 0 : -1,
143
+ className: "fs-seg-btn", onClick: () => { if (o.value !== value) onChange(o.value); },
144
+ onKeyDown: (e) => onKeyDown(e, i)
132
145
  }, o.label)));
133
146
  }
134
147
 
@@ -162,15 +175,16 @@ window.__ModuleLoader__.load({
162
175
  // 大项是页面,不再让每个大项重复一个同名子页签。
163
176
  function GroupedTabs({ value, onChange, hasUpdate }) {
164
177
  const active = NAV_GROUPS.find((group) => group.id === value) ?? NAV_GROUPS[0];
165
- return h("div", { className: "fs-group-row" },
166
- h("span", { className: "fs-brand" }, "鱼"),
167
- h("nav", { className: "fs-group-nav", "aria-label": "设置分类" }, NAV_GROUPS.map((group) => {
178
+ return [
179
+ h("span", { className: "fs-brand", key: "brand" }, "鱼"),
180
+ h("nav", { className: "fs-group-nav", key: "nav", "aria-label": "设置分类" }, NAV_GROUPS.map((group) => {
168
181
  const selected = group.id === active.id;
169
182
  const showUpdate = hasUpdate && group.id === "system";
170
183
  return h("button", { type: "button", key: group.id, className: "fs-group-tab", "aria-pressed": selected,
171
184
  "aria-label": showUpdate ? `${group.label}(有新版本)` : group.label, onClick: () => onChange(group.id) },
172
185
  group.label, showUpdate ? h("span", { className: "fs-update-dot", "aria-hidden": true }) : null);
173
- })));
186
+ }))
187
+ ];
174
188
  }
175
189
 
176
190
  /** StateDot:done / warning / error / idle 是圆点,ongoing 是转圈。 */
@@ -178,7 +192,7 @@ window.__ModuleLoader__.load({
178
192
  ? h("svg", { className: "fs-spin", width: 14, height: 14, viewBox: "0 0 24 24", "aria-hidden": true },
179
193
  h("g", null, h("circle", { cx: 12, cy: 12, r: 9.5 }), h("circle", { cx: 12, cy: 12, r: 9.5 })))
180
194
  : h("span", { className: "fs-dot", "data-state": state, "aria-hidden": true });
181
- const State = (state, text, title) => h("span", { className: "fs-state", "data-state": state, title: title ?? text, role: "status" }, Dot(state), h("span", null, text));
195
+ const State = (state, text, title, wrap) => h("span", { className: cx("fs-state", wrap && "wrap"), "data-state": state, title: title ?? text, role: "status" }, Dot(state), h("span", null, text));
182
196
  const Tag = (text, tone, extra, ...kids) => {
183
197
  if (!primitives?.Tag) return h("span", { className: "fs-tag", "data-tone": tone, ...extra }, text, ...kids);
184
198
  const tag = h(primitives.Tag, { tone: tone ?? "neutral", className: "fs-native-tag" }, text, ...kids);
@@ -194,10 +208,10 @@ window.__ModuleLoader__.load({
194
208
  const Muted = (text, extra) => h("span", { className: "fs-unit", ...extra }, text);
195
209
 
196
210
  // 行:标题左 / 控件右。desc(解释性文字)不占版面,只作悬停提示;meta(实时状态)以等宽小字跟在标题下
197
- /** @param {{ title: any, desc?: any, meta?: any, stack?: boolean }} props @param {...any} kids */
198
- function Row({ title, desc, meta, stack }, ...kids) {
211
+ /** @param {{ key?: any, title: any, desc?: any, meta?: any, stack?: boolean }} props @param {...any} kids */
212
+ function Row({ key, title, desc, meta, stack }, ...kids) {
199
213
  const tip = typeof desc === "string" ? desc : undefined;
200
- return h("div", { className: cx("fs-row", stack && "stack") },
214
+ return h("div", { key, className: cx("fs-row", stack && "stack") },
201
215
  h("div", { className: "fs-row-title" },
202
216
  h("span", { className: cx("fs-row-label", tip && "has-tip"), title: tip }, title),
203
217
  meta ? h("span", { className: "fs-row-meta" }, meta) : null),
@@ -376,7 +390,7 @@ window.__ModuleLoader__.load({
376
390
  Row({ title: "Token 预算" }, Num({ min: 300, max: 4000, step: 100, value: form.tokenBudget, onChange: (e) => patch({ tokenBudget: Number(e.target.value) || 1200 }), onBlur: () => save() }))),
377
391
  form.enabled ? Group({ title: "向量", aside: conn },
378
392
  Row({ title: "接口地址" }, Input({ value: form.baseURL, placeholder: "https://…/v1", onChange: (e) => patch({ baseURL: e.target.value }), onBlur: () => save() })),
379
- Row({ title: "密钥" }, h(Secret, { label: "密钥", value: form.apiKey, placeholder: cfg.hasApiKey ? (cfg.apiKeyMasked ?? "已保存") : "sk-…", onChange: (e) => patch({ apiKey: e.target.value }), onBlur: () => { if (form.apiKey !== "") save(); } })),
393
+ Row({ title: "API Key" }, h(Secret, { label: "API Key", value: form.apiKey, placeholder: cfg.hasApiKey ? (cfg.apiKeyMasked ?? "已保存") : "sk-…", onChange: (e) => patch({ apiKey: e.target.value }), onBlur: () => { if (form.apiKey !== "") save(); } })),
380
394
  Row({ title: "模型" }, vecMeta.dim ? Tag(`${vecMeta.dim} 维`) : null,
381
395
  Input({ value: form.model, onChange: (e) => patch({ model: e.target.value }), onBlur: () => save() }),
382
396
  Button({ disabled: probing || form.baseURL === "" || form.model === "", onClick: probe }, probing ? "测试中…" : "测试")),
@@ -395,10 +409,15 @@ window.__ModuleLoader__.load({
395
409
  const [busy, setBusy] = react.useState(false);
396
410
  const [idle, setIdle] = react.useState("");
397
411
  const [tMax, setTMax] = react.useState(""); // 「整理时对照聊天原文」最多看几句
412
+ const synced = react.useRef(false);
398
413
  const load = react.useCallback(async () => { const r = await api("GET", "/memory/state"); if (r?.ok) setD(r); }, []);
399
414
  react.useEffect(() => { load(); const t = setInterval(load, 5000); return () => clearInterval(t); }, [load]);
400
- react.useEffect(() => { if (d && idle === "") setIdle(String(d.idleMinutes)); }, [d]);
401
- react.useEffect(() => { if (d && tMax === "") setTMax(String(d.transcriptMaxLines ?? 40)); }, [d]);
415
+ react.useEffect(() => {
416
+ if (!d || synced.current) return;
417
+ synced.current = true;
418
+ setIdle(String(d.idleMinutes));
419
+ setTMax(String(d.transcriptMaxLines ?? 40));
420
+ }, [d]);
402
421
  if (!d) return null;
403
422
  async function save(p) {
404
423
  const r = await api("POST", "/memory/config", p);
@@ -878,14 +897,14 @@ window.__ModuleLoader__.load({
878
897
  x.href ? h("a", { key: "a", href: x.href, target: "_blank", rel: "noreferrer" }, "打开") : null,
879
898
  h("span", { key: "t" }, relTime(x.at, Date.now()))
880
899
  ].filter(Boolean) }))),
881
- logNext !== null ? h("div", { style: { padding: "4px 12px 8px" } }, Button({ variant: "ghost", disabled: olderLog.busy, onClick: loadMoreLog }, olderLog.busy ? "加载中…" : "加载更多")) : null)),
900
+ logNext !== null ? h("div", { className: "fs-pag-bar" }, Button({ variant: "ghost", disabled: olderLog.busy, onClick: loadMoreLog }, olderLog.busy ? "加载中…" : "加载更多")) : null)),
882
901
  recentAll.length === 0 ? null : Group({ title: "最近看过" },
883
902
  h("div", { className: "fs-list" }, recentAll.map((v) => Item({
884
903
  key: v.bvid, lead: Tag(v.favorited ? "藏" : v.liked ? "赞" : v.skipped ? "划走" : v.source === "following" ? "关注" : v.source === "search" ? "搜索" : "推荐", v.liked ? "danger" : undefined),
885
904
  text: `${v.title}${v.impression ? ` — ${v.impression}` : ""}`, title: `${v.title}${v.owner ? ` · ${v.owner}` : ""}${v.impression ? `\n${v.impression}` : ""}`,
886
905
  meta: [h("a", { key: "a", href: `https://www.bilibili.com/video/${v.bvid}`, target: "_blank", rel: "noreferrer" }, v.owner || v.bvid), h("span", { key: "t" }, relTime(v.seenAt, Date.now()))]
887
906
  }))),
888
- seenNext !== null ? h("div", { style: { padding: "4px 12px 8px" } }, Button({ variant: "ghost", disabled: olderSeen.busy, onClick: loadMoreSeen }, olderSeen.busy ? "加载中…" : "加载更多")) : null))
907
+ seenNext !== null ? h("div", { className: "fs-pag-bar" }, Button({ variant: "ghost", disabled: olderSeen.busy, onClick: loadMoreSeen }, olderSeen.busy ? "加载中…" : "加载更多")) : null))
889
908
  }
890
909
 
891
910
  // ── 按需加载的分块:抖音页(client.douyin.js)、记忆检视 / 动态(client.soul.js)、模型(client.models.js)、人格(client.persona.js);控件通过 props.ui 传过去 ──
@@ -913,7 +932,7 @@ window.__ModuleLoader__.load({
913
932
  const TABS = [
914
933
  ["memory", "记忆", [["retrieval", "检索设置"], ["people", "人物与关系"], ["memories", "记忆内容"], ["recall-test", "检索测试"], ["weekly", "周记"], ["archives", "记忆存档"], ["backups", "导入与备份"]]],
915
934
  ["character", "角色", [["persona", "人格卡"], ["templates", "人格模板"], ["growth", "成长"], ["worldinfo", "世界书"], ["habits", "说话习惯"], ["groups", "群设定"], ["chat-models", "聊天模型"]]],
916
- ["daily", "日常", [["life", "主动开口"], ["relay", "熟人传话"], ["activity", "最近动态"], ["diary", "日记"], ["stickers", "表情包"], ["slang", "学到的说法"]]],
935
+ ["daily", "日常", [["life", "主动开口"], ["scheduled-tasks", "定时任务"], ["relay", "熟人传话"], ["activity", "最近动态"], ["diary", "日记"], ["stickers", "表情包"], ["slang", "学到的说法"]]],
917
936
  ["channels", "平台", [["qq", "QQ"], ["bili", "B站"], ["douyin", "抖音"]]],
918
937
  ["models", "模型", [["models", "功能模型"], ["usage", "用量与价格"], ["web", "联网搜索"], ["voice", "语音"]]],
919
938
  ["system", "系统", [["interface", "界面"], ["version", "版本更新"], ["diag", "运行日志"]]]
@@ -930,7 +949,7 @@ window.__ModuleLoader__.load({
930
949
  const [error, setError] = react.useState(null);
931
950
  const load = react.useCallback(async () => { const r = await api("GET", "/onboarding/state"); if (r?.ok) { setData(r); setError(null); } else setError(r?.error ?? "引导状态暂不可用"); }, []);
932
951
  react.useEffect(() => { load(); const t = setInterval(load, 10000); return () => clearInterval(t); }, [load]);
933
- if (!data) return error ? h("div", { className: "fs-notice", role: "alert" }, h("b", null, "引导加载失败"), h("span", null, error), Button({ variant: "secondary", onClick: load }, "重试")) : h("div", { className: "fs-empty" }, Dot("ongoing"));
952
+ if (!data) return error ? h("div", { className: "fs-notice", role: "alert" }, h("b", null, "引导加载失败"), h("span", null, error), Button({ onClick: load }, "重试")) : h("div", { className: "fs-empty" }, Dot("ongoing"));
934
953
  async function dismiss() {
935
954
  const r = await api("POST", "/onboarding/dismiss", { dismissed: true });
936
955
  if (r?.ok) { setData({ ...data, dismissed: true }); onDismiss(); } else notify(r?.error ?? "操作失败");
@@ -1061,7 +1080,7 @@ window.__ModuleLoader__.load({
1061
1080
  window.dispatchEvent(new Event("fish-soul:guide-visibility"));
1062
1081
  };
1063
1082
  react.useEffect(() => {
1064
- const sync = () => { const visible = readGuideVisible(); setGuideVisible(visible); if (!visible) setTab((current) => current === "guide" ? "retrieval" : current); };
1083
+ const sync = () => { const visible = readGuideVisible(); setGuideVisible(visible); if (!visible) setTab((current) => current === "guide" ? "memory" : current); };
1065
1084
  window.addEventListener("fish-soul:guide-visibility", sync); window.addEventListener("storage", sync);
1066
1085
  return () => { window.removeEventListener("fish-soul:guide-visibility", sync); window.removeEventListener("storage", sync); };
1067
1086
  }, []);
@@ -1116,7 +1135,7 @@ window.__ModuleLoader__.load({
1116
1135
  loadUpdate();
1117
1136
  const timer = setInterval(loadUpdate, 60000);
1118
1137
  return () => { active = false; clearInterval(timer); };
1119
- }, [tab]);
1138
+ }, [subtab]);
1120
1139
 
1121
1140
  if (css === null) return null;
1122
1141
  const pane = tab === "guide" ? h(Onboarding, { onGo: goSetting, onDismiss: () => goTab("memory"), onHide: () => setGuideVisibility(false), notify })
@@ -1130,6 +1149,7 @@ window.__ModuleLoader__.load({
1130
1149
  : ["habits", "groups", "chat-models", "diary"].includes(subtab) ? h(ChunkTab, { file: "client.behavior.js", pick: (m) => m.BehaviorPane, failText: "习惯页加载失败", section: subtab === "chat-models" ? "models" : subtab, notify })
1131
1150
  : ["models", "usage", "web", "voice"].includes(subtab) ? h(ChunkTab, { file: "client.models.js", pick: (m) => m.ModelsPane, failText: "模型页加载失败", section: subtab, notify })
1132
1151
  : ["persona", "templates", "growth", "worldinfo"].includes(subtab) ? h(ChunkTab, { file: "client.persona.js", pick: (m) => m.PersonaPane, failText: "人格页加载失败", section: subtab === "persona" ? "current" : subtab, notify })
1152
+ : subtab === "scheduled-tasks" ? h(ChunkTab, { file: "client.scheduled-tasks.js", pick: (m) => m.ScheduledTasksPane, failText: "定时任务页加载失败", notify })
1133
1153
  : subtab === "diag" ? h(ChunkTab, { file: "client.diag.js", pick: (m) => m.DiagPane, failText: "运行日志加载失败", notify })
1134
1154
  : subtab === "qq" ? h(ChannelPane, { data: channels, refresh: loadChannels, notify })
1135
1155
  : subtab === "bili" ? h(BiliPane, { data: channels, refresh: loadChannels, notify })
@@ -1140,12 +1160,13 @@ window.__ModuleLoader__.load({
1140
1160
  return h("div", { className: "fs-host" }, h("div", { className: cx("fs", standalone ? "fs-standalone" : "fs-settings"), onPointerDown: () => { hasInteracted.current = true; }, onKeyDown: () => { hasInteracted.current = true; } },
1141
1161
  css === "" ? null : h("style", { "data-plugin-css": `${PLUGIN_ID}/panel.css` }, css),
1142
1162
  h("div", { className: "fs-side" }, h("div", { className: "fs-side-inner" },
1143
- h(GroupedTabs, { value: tab, onChange: goTab, hasUpdate: updateAvailable }),
1144
- guideVisible && tab !== "guide" ? h("div", { className: "fs-subnav-row" }, Button({ variant: "ghost", onClick: () => goTab("guide") }, "使用引导")) : null,
1163
+ h("div", { className: "fs-group-row" },
1164
+ h(GroupedTabs, { value: tab, onChange: goTab, hasUpdate: updateAvailable }),
1165
+ guideVisible && tab !== "guide" ? h("span", { className: "fs-group-aside" }, Button({ variant: "ghost", onClick: () => goTab("guide") }, "使用引导")) : null),
1145
1166
  tabs.length > 0 ? h("div", { className: "fs-subnav-row" }, h(Tabs, { items: tabs, value: subtab, onChange: goSubtab, horizontal: true })) : null)),
1146
1167
  h("main", { className: "fs-main" },
1147
- h("header", { className: "fs-main-head" }, h("h2", { className: "fs-main-title" }, label), storageWarning ? h("span", { role: "status", style: { marginLeft: "auto" } }, Button({ variant: "ghost", onClick: () => goSetting("archives") }, storageWarning)) : null),
1148
- h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": `fs-tab-${subtab}`, key: `${tab}:${subtab}` }, h(Boundary, { name: "这一页" }, pane))),
1168
+ h("header", { className: "fs-main-head" }, h("h2", { className: "fs-main-title", id: "fs-main-title" }, label), storageWarning ? h("span", { role: "status", style: { marginLeft: "auto" } }, Button({ variant: "ghost", onClick: () => goSetting("archives") }, storageWarning)) : null),
1169
+ h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": tabs.length > 0 ? `fs-tab-${subtab}` : "fs-main-title", key: `${tab}:${subtab}` }, h(Boundary, { name: "这一页" }, pane))),
1149
1170
  toast === null ? null : h("div", { className: "fs-toast", role: "status", key: toast.key }, toast.text)));
1150
1171
  }
1151
1172