dsh-fish-soul 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  让一个 QQ 小号背后有"同一个人":固定人格、按人记记忆、有自己的生活节奏、会主动开口;同一个"她"同时出现在 QQ、B站、抖音。
4
4
 
5
- DSH 插件(单角色 `feiyu`)。版本 **0.12.0**。
5
+ DSH 插件(单角色 `feiyu`)。版本 **0.12.1**。
6
6
 
7
7
  ## 能力
8
8
 
package/lib/client.js CHANGED
@@ -603,18 +603,32 @@ window.__ModuleLoader__.load({
603
603
  const status = data.hasUpdate ? Tag(`有新版本 v${data.latest}`, "warning")
604
604
  : data.latest ? Tag("已是最新", "success")
605
605
  : data.error ? Tag("没查成", "outline", { title: data.error }) : Tag("还没检查", "outline");
606
- return h(Group, { title: "版本", aside: h("span", { className: "fs-unit" }, `v${data.current}`) },
607
- h(Row, { title: h("span", null, `当前 v${data.current} `, status), desc: when ? `上次检查 ${when}${data.source ? `(${data.source})` : ""}` : "每 12 小时自动看一次 npm / GitHub" },
606
+ // Group / Row 是普通函数(第二个参数起是子元素),不能当组件(createElement)用:
607
+ // 宿主的 React 会把 legacy context({})当第二个参数传进来,变成一个对象子元素,整个面板崩成空白
608
+ return Group({ title: "版本", aside: h("span", { className: "fs-unit" }, `v${data.current}`) },
609
+ Row({ title: h("span", null, `当前 v${data.current} `, status), desc: when ? `上次检查 ${when}${data.source ? `(${data.source})` : ""}` : "每 12 小时自动看一次 npm / GitHub" },
608
610
  Button({ onClick: check, disabled: busy || data.checking }, busy || data.checking ? "检查中…" : "检查更新"),
609
611
  data.hasUpdate ? Button({ onClick: () => window.open(data.notesUrl, "_blank", "noopener") }, "更新说明") : null,
610
612
  data.hasUpdate && data.command ? Button({ variant: "primary", onClick: copy, title: data.command }, "复制更新命令") : null),
611
613
  data.hasUpdate ? (data.notes ? h("pre", { className: "fs-row-desc", style: { whiteSpace: "pre-wrap", maxHeight: 160, overflow: "auto", margin: "0 0 8px" } }, data.notes)
612
614
  : h("p", { className: "fs-row-desc", style: { margin: "0 0 8px" } }, "这一版还没有写更新说明,",
613
615
  h("a", { href: data.notesUrl, target: "_blank", rel: "noopener noreferrer" }, "去 GitHub 看发布记录"))) : null,
614
- h(Row, { title: "自动检查更新", desc: "只提示,不会自动安装;更新后重启 DSH 生效" },
616
+ Row({ title: "自动检查更新", desc: "只提示,不会自动安装;更新后重启 DSH 生效" },
615
617
  h(Switch, { checked: data.autoCheck !== false, onChange: toggle, label: "自动检查更新" })));
616
618
  }
617
619
 
620
+ // 某一块渲染出错只换成一行提示,别让整个设置页变空白
621
+ class Boundary extends react.Component {
622
+ constructor(props) { super(props); this.state = { error: null }; }
623
+ static getDerivedStateFromError(error) { return { error }; }
624
+ componentDidCatch(error) { try { console.error(`[fish-soul] ${this.props.name}渲染出错`, error); } catch { /* 无 */ } }
625
+ render() {
626
+ if (this.state.error === null) return this.props.children ?? null;
627
+ const msg = String(this.state.error?.message ?? this.state.error).slice(0, 200);
628
+ return h("p", { className: "fs-row-desc", role: "alert", style: { margin: "8px 0" } }, `${this.props.name}显示出错了(${msg}),其它部分不受影响;可以把这句话发给开发者`);
629
+ }
630
+ }
631
+
618
632
  function FishSoulSection() {
619
633
  const css = useCss();
620
634
  const [tab, setTab] = react.useState("retrieval");
@@ -665,10 +679,10 @@ window.__ModuleLoader__.load({
665
679
 
666
680
  return h("div", { className: "fs" },
667
681
  css === "" ? null : h("style", { "data-plugin-css": `${PLUGIN_ID}/panel.css` }, css),
668
- h(Onboarding, { onGo: setTab, notify }),
669
- h(UpdateBar, { notify }),
682
+ h(Boundary, { name: "引导" }, h(Onboarding, { onGo: setTab, notify })),
683
+ h(Boundary, { name: "版本" }, h(UpdateBar, { notify })),
670
684
  h(Tabs, { items: TABS, value: tab, onChange: setTab }),
671
- h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": `fs-tab-${tab}`, key: tab }, pane),
685
+ h("div", { className: "fs-pane", role: "tabpanel", id: "fs-tabpanel", "aria-labelledby": `fs-tab-${tab}`, key: tab }, h(Boundary, { name: "这一页" }, pane)),
672
686
  toast === null ? null : h("div", { className: "fs-toast", role: "status", key: toast.key }, toast.text));
673
687
  }
674
688
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-fish-soul",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "鱼 · 人格、按人记忆(可纠正、有印象、能导入旧聊天记录)、日程自走与主动开口,直连 SnowLuma 收发 QQ(群里会自己插话),B站 / 抖音小号私信与自己刷视频;按功能选模型并统计用量花费,能听会说 QQ 语音、收藏表情包、学群里的梗,可选上网查;心情影响说话、去 AI 味、每个群的设定、按聊天选模型、每晚写日记(DSH 插件,单角色 feiyu)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -62,7 +62,7 @@
62
62
  }
63
63
  },
64
64
  "scripts": {
65
- "test": "node test/smoke.mjs && node test/douyin-browser.mjs && node test/startup-gate.mjs && node test/outbox.mjs && node test/import-coverage.mjs && node test/update-check.mjs && node test/issue-fixes.mjs && node test/import-resume.mjs && node test/maibot-extras.mjs && node test/worldinfo.mjs && node test/memory-bulk.mjs && node test/backup-restore.mjs && node test/douyin-group.mjs && node test/review-fixes.mjs",
65
+ "test": "node test/smoke.mjs && node test/douyin-browser.mjs && node test/startup-gate.mjs && node test/outbox.mjs && node test/import-coverage.mjs && node test/update-check.mjs && node test/issue-fixes.mjs && node test/import-resume.mjs && node test/maibot-extras.mjs && node test/worldinfo.mjs && node test/memory-bulk.mjs && node test/backup-restore.mjs && node test/douyin-group.mjs && node test/review-fixes.mjs && node test/client-lint.mjs",
66
66
  "eval": "node test/eval/persona-eval.mjs"
67
67
  }
68
68
  }