dsh-chat-comprehension 0.3.0 → 0.3.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
@@ -4,7 +4,7 @@
4
4
  给 DeepSeek Harness 一个「一个入口」的陪伴层:**局部人格 + QQ 联动 + 专属记忆 + B站 值班**。
5
5
  左侧栏只有一个图标「陪伴」;设置弹层里不再出现三个插件各自那一页。
6
6
 
7
- > 当前是 **0.3.0**:五个引擎的宿主核心全部内置在本包 `vendor/`;**只装这一个包**就有效果,不会再装/依赖别的引擎插件。QQ 网关仍单独安装(本包只自动打 companion 补丁)。
7
+ > 当前是 **0.3.1**:五个引擎的宿主核心全部内置在本包 `vendor/`;**只装这一个包**就有效果,不会再装/依赖别的引擎插件。B站 venv 会在挂载后自动配置;QQ 网关仍单独安装(本包只自动打 companion 补丁)。
8
8
  > 发布到 npm 后,安装只需要一条:`dsh plugin --profile web add dsh-chat-comprehension`。
9
9
 
10
10
  ## 页面里有什么
package/client.js CHANGED
@@ -688,6 +688,16 @@ window.__ModuleLoader__.load({
688
688
  await checkDoctor()
689
689
  }), [runBusy, checkDoctor, say])
690
690
 
691
+ const setupBili = useCallback(() => runBusy('bili-setup', async () => {
692
+ try {
693
+ const r = await post(CC + '/bili/setup', {})
694
+ if (r && r.ok) say(r.busy ? 'B站 环境正在装(后台),看 B站 页日志' : 'B站 环境开始配置(后台)', 'ok')
695
+ else say('配置失败:' + String((r && (r.error || r.hint)) || '看 B站 日志').slice(-400), 'err')
696
+ } catch (error) { say('配置失败:' + errText(error), 'err') }
697
+ await checkDoctor()
698
+ await load()
699
+ }), [runBusy, checkDoctor, load, say])
700
+
691
701
  const repairEngines = useCallback(() => runBusy('engines-repair', async () => {
692
702
  try {
693
703
  const r = await post(CC + '/engines/repair', {})
@@ -1666,6 +1676,7 @@ window.__ModuleLoader__.load({
1666
1676
  (doctor.checks || []).some((c) => c.id === 'yt-dlp' && !c.ok) ? h(Btn, { icon: 'save', disabled: busy.ytdlp, onClick: installYtdlp }, busy.ytdlp ? '安装 yt-dlp 中…' : '安装 yt-dlp') : null,
1667
1677
  h(Btn, { icon: 'link', disabled: busy['doctor-patch'] || busy['doctor-check'], onClick: patchQqbot }, busy['doctor-patch'] ? '打补丁中…' : '打 QQ 网关补丁'),
1668
1678
  h(Btn, { icon: 'refresh', disabled: busy['engines-repair'] || busy['doctor-check'], onClick: repairEngines }, busy['engines-repair'] ? '重新挂载中…' : '一键修复内置引擎'),
1679
+ h(Btn, { icon: 'save', disabled: busy['bili-setup'] || busy['doctor-check'], onClick: setupBili }, busy['bili-setup'] ? '配置 B站 环境中…' : '配置 B站 环境'),
1669
1680
  h('span', { className: 'dc-note' }, '装进上面那个 Python;打补丁只改 QQ 网关,重启后生效。'))),
1670
1681
  h(Card, { title: '引擎 / 插件', sub: '引擎已内置;QQ 网关单独装;原生依赖看「环境」' },
1671
1682
  h('div', { className: 'dc-list' },
package/lib/index.js CHANGED
@@ -991,6 +991,12 @@ export async function apply(ctx) {
991
991
  engineMounts = await repairVendoredEngines(ctx)
992
992
  return sendJson(res, 200, { ok: engineMounts.every((e) => e.installed || e.mounted), engines: engineMounts })
993
993
  }
994
+ if (req.method === 'POST' && path === '/bili/setup') {
995
+ const biliSetup = ctx.get('biliVenvSetup')
996
+ if (!biliSetup || typeof biliSetup.runInstall !== 'function') throw badRequest('B站 内置引擎没有提供安装入口(可能用的是外部已装版本)')
997
+ const r = biliSetup.runInstall()
998
+ return sendJson(res, 200, { ok: true, ready: typeof biliSetup.venvReady === 'function' ? biliSetup.venvReady() : false, ...r })
999
+ }
994
1000
  if (req.method === 'POST' && path === '/doctor/install') {
995
1001
  const body = await readBody(req)
996
1002
  const what = String(body.what || '')
@@ -1189,6 +1195,17 @@ export async function apply(ctx) {
1189
1195
  ctx.logger?.warn?.('内置引擎挂载失败:' + String((error && error.message) || error))
1190
1196
  }
1191
1197
 
1198
+ // 新电脑上 B站 venv 不会自己出现:挂载后自动检测一次,缺就后台开始配(uv 建 venv + 装依赖)。
1199
+ try {
1200
+ const biliSetup = ctx.get('biliVenvSetup')
1201
+ if (biliSetup && typeof biliSetup.venvReady === 'function' && !biliSetup.venvReady()) {
1202
+ const r = typeof biliSetup.runInstall === 'function' ? biliSetup.runInstall() : null
1203
+ console.log('[companion] B站 venv 未就绪,已自动开始配置:' + String((r && r.hint) || '后台安装中'))
1204
+ }
1205
+ } catch (error) {
1206
+ ctx.logger?.warn?.('B站 venv 自动配置失败:' + String((error && error.message) || error))
1207
+ }
1208
+
1192
1209
  ctx.logger?.info?.('dsh-chat-comprehension:聚合入口已挂载(含 TTS / 斗图通道状态 / 内置引擎)')
1193
1210
  }
1194
1211
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-chat-comprehension",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "DeepSeek Harness 聊天理解/陪伴套件:局部人格 + QQ 联动 + 专属记忆 + B站值班 + 表情包 + 文字转语音,一个入口。",
@@ -2677,6 +2677,21 @@ function reportMeta() {
2677
2677
  return { ok: true, started: true, log: installLogFile, hint: '正在后台装依赖 —— 进度就显示在下面(走国内镜像,通常几十秒到一两分钟)' }
2678
2678
  }
2679
2679
 
2680
+ // ── 给聚合层(dsh-chat-comprehension)用的 venv 安装入口 ──
2681
+ // 新电脑上 B站 venv 不会自己出现;聚合层挂载本引擎后会调用这里自动建。
2682
+ if (typeof ctx.provide === 'function') {
2683
+ try {
2684
+ ctx.provide('biliVenvSetup', {
2685
+ venvReady: () => venvReadyNow(),
2686
+ installing: () => installing,
2687
+ log: installLogFile,
2688
+ runInstall,
2689
+ })
2690
+ } catch (e) {
2691
+ log('biliVenvSetup 服务注册失败:' + String((e && e.message) || e))
2692
+ }
2693
+ }
2694
+
2680
2695
  /** 「测一下」:真跑一次查询再下结论(判据落在载荷上,不看自报) */
2681
2696
  const checkUp = async () => {
2682
2697
  const out = { ok: false, steps: [] }