dsh-chat-comprehension 0.4.0 → 0.5.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.
Files changed (30) hide show
  1. package/NOTICE.md +4 -3
  2. package/README.md +62 -15
  3. package/client.js +400 -52
  4. package/lib/engines.mjs +36 -5
  5. package/lib/index.js +210 -20
  6. package/lib/qqbot-0.5.3-patches.json +31 -1
  7. package/lib/qqbot-patch.mjs +1 -1
  8. package/lib/video.mjs +45 -2
  9. package/package.json +6 -6
  10. package/vendor/dsh-agent-md/lib/chat-persona.js +9 -3
  11. package/vendor/dsh-agent-md/lib/index.js +72 -18
  12. package/vendor/dsh-agent-md/lib/qq.js +64 -0
  13. package/vendor/dsh-agent-md/package.json +1 -1
  14. package/vendor/dsh-bili-scroll/index.js +39 -10
  15. package/vendor/dsh-meme/index.js +3 -1
  16. package/vendor/dsh-video-storyboard/LICENSE-workbuddy.txt +21 -0
  17. package/vendor/dsh-video-storyboard/NOTICE +7 -0
  18. package/vendor/dsh-video-storyboard/NOTICE-workbuddy.md +18 -0
  19. package/vendor/dsh-video-storyboard/dsh.plugin.json +1 -1
  20. package/vendor/dsh-video-storyboard/package.json +1 -1
  21. package/vendor/dsh-video-storyboard/src/sniff.mjs +545 -0
  22. package/vendor/dsh-video-storyboard/src/storyboard/direct-url.js +2 -2
  23. package/vendor/dsh-video-storyboard/src/storyboard/fetch.js +3 -3
  24. package/vendor/dsh-video-storyboard/src/storyboard/pipeline.js +1 -1
  25. package/vendor/dsh-video-storyboard/src/storyboard/source.js +409 -0
  26. package/vendor/dsh-video-storyboard/src/storyboard/tool-spec.js +5 -3
  27. package/vendor/dsh-video-storyboard/src/storyboard/url.js +105 -17
  28. package/vendor/dsh-video-storyboard/src/tools/locate.js +1 -1
  29. package/vendor/dsh-video-storyboard/src/tools/probe.js +4 -6
  30. package/vendor/dsh-video-storyboard/src/tools/zoom.js +1 -1
package/client.js CHANGED
@@ -185,6 +185,14 @@ window.__ModuleLoader__.load({
185
185
  .dc-switch-state { min-width: 14px; text-align: right; font-family: var(--cy-mono); font-size: 11px; font-weight: 700; color: var(--cy-faint); }
186
186
  .dc-switch-state[data-on] { color: var(--cy-cyan); text-shadow: 0 0 8px rgba(0, 240, 255, .7); }
187
187
 
188
+ .dc-meme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
189
+ .dc-meme-card { background: var(--cy-sunken); border: 1px solid var(--cy-line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
190
+ .dc-meme-thumb { width: 100%; height: 120px; object-fit: contain; border-radius: 8px; background: rgba(0, 0, 0, .25); }
191
+ .dc-meme-meta { min-width: 0; }
192
+ .dc-meme-meta .dc-item-title { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
193
+ .dc-meme-card .dc-row { gap: 6px; }
194
+ .dc-meme-upload { margin-top: 12px; padding: 10px; border: 1px dashed var(--cy-line-strong); border-radius: 12px; }
195
+
188
196
  .dc-block { background: var(--cy-sunken); border: 1px solid var(--cy-line); border-radius: 16px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
189
197
  .dc-block[data-on] { border-color: var(--cy-cyan); box-shadow: 0 0 18px -8px rgba(0, 240, 255, .9); background: rgba(0, 240, 255, .04); }
190
198
  .dc-block-head { display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; border-radius: 16px; }
@@ -269,6 +277,8 @@ window.__ModuleLoader__.load({
269
277
  if (name === 'link') return h('svg', common, h('path', { d: 'M10 13a4 4 0 0 0 5.7 0l2.3-2.3a4 4 0 0 0-5.7-5.7L11 6.3M14 11a4 4 0 0 0-5.7 0L6 13.3a4 4 0 0 0 5.7 5.7l1.3-1.3' }))
270
278
  if (name === 'copy') return h('svg', common, h('path', { d: 'M9 9h11v11H9z' }), h('path', { d: 'M5 15V4h11' }))
271
279
  if (name === 'open') return h('svg', common, h('path', { d: 'M14 4h6v6M20 4l-9 9M18 13v6H5V6h6' }))
280
+ if (name === 'search') return h('svg', common, h('circle', { cx: 11, cy: 11, r: 6 }), h('path', { d: 'M15.5 15.5L20 20' }))
281
+ if (name === 'trash') return h('svg', common, h('path', { d: 'M4.5 6.5h15M9 6.5V4.5h6v2M7 6.5l1 13h8l1-13M10 10v6M14 10v6' }))
272
282
  return h('svg', common, h('circle', { cx: 12, cy: 12, r: 8 }))
273
283
  }
274
284
 
@@ -357,6 +367,30 @@ window.__ModuleLoader__.load({
357
367
  return parts.length <= 2 ? p : '…/' + parts.slice(-2).join('/')
358
368
  }
359
369
 
370
+ /** 生成给 AI 的分类 / 描述提示词;批量导入时把图片路径也写进去(用户可以自己改)。 */
371
+ function buildMemePrompt({ paths = [], tags = [] } = {}) {
372
+ const list = Array.isArray(paths) ? paths.filter((x) => typeof x === 'string' && x !== '') : []
373
+ const tagList = Array.isArray(tags) && tags.length ? tags.join('、') : '(目前还没有分类)'
374
+ const shown = list.slice(0, 60)
375
+ const lines = [
376
+ '请帮我整理表情包图库。用 meme_list 查看图库,用 meme_update 给每张图补上分类 tag、描述 caption 和关键词 keywords;不要删除图片、不要改文件名。',
377
+ '',
378
+ '规则:',
379
+ '1. 分类优先用图库里已有的:' + tagList + ';都不合适再用一个小写英文/拼音新分类(只能字母、数字、-、_,不要中文和空格)。',
380
+ '2. 描述 caption 写一句很短的中文,具体说画面和情绪(例:得意闭眼握拳,好耶),方便模型判断什么时候发这张图;不要写文件名或路径。',
381
+ '3. 关键词 keywords 用空格分隔 3–6 个中文词(画面元素、情绪、用法),方便以后搜。',
382
+ '4. 用 meme_update 逐张改,一张改完再下一张;path 用 meme_list 返回的原样。',
383
+ '5. 看不清或不确定的图片跳过,最后说明跳过了哪几张。',
384
+ '',
385
+ list.length
386
+ ? '请处理下面这些新导入的图片(' + list.length + ' 张' + (list.length > shown.length ? ',先做前 ' + shown.length + ' 张' : '') + '):\n' + shown.map((x) => '- ' + x).join('\n') + (list.length > shown.length ? '\n…(其余 ' + (list.length - shown.length) + ' 张按 meme_list 顺序继续)' : '')
387
+ : '请先用 meme_list 找出「描述还是文件名」或明显缺描述的图片,按上面的规则补好。',
388
+ '',
389
+ '处理完告诉我一共改了几张、用了哪些分类。',
390
+ ]
391
+ return lines.join('\n')
392
+ }
393
+
360
394
  // 百炼 Sambert 里的英文音色:拿来读中文只会回一个空 WAV
361
395
  const ENGLISH_SAMBERT = /^sambert-(betty|beth|cally|cindy|eva|donna|brian)-v\d/i
362
396
 
@@ -514,8 +548,8 @@ window.__ModuleLoader__.load({
514
548
  const providerModels = (modelsInfo && modelsInfo.models) ? modelsInfo.models : {}
515
549
  const options = pick.provider ? (providerModels[pick.provider] || []) : []
516
550
  return h(Card, {
517
- title: '默认模型(全局)',
518
- sub: '在这里选一次:QQ 消息、B站 值班都用它;下面某个会话单独指定时以那个为准',
551
+ title: 'QQ 默认模型',
552
+ sub: '只影响接入 QQ 的对话和 B站 值班;网页里其他对话的默认模型不会变。下面某个 QQ 会话单独指定时以那个为准',
519
553
  },
520
554
  h('div', { className: 'dc-row' },
521
555
  h('div', { style: { flex: 1 } },
@@ -587,7 +621,8 @@ window.__ModuleLoader__.load({
587
621
  chats.map((c) => {
588
622
  const peerKey = c.peerKey
589
623
  const draftText = draft[peerKey]
590
- const shown = draftText === undefined ? '' : draftText
624
+ // 已保存的人格正文由 /chats 一起带回来:第二次打开页面要把内容填回输入框
625
+ const shown = draftText === undefined ? String(c.content || '') : draftText
591
626
  const saved = modelOf(peerKey)
592
627
  const sel = modelSel[peerKey] || { provider: saved.provider || '', model: saved.model || '', reasoningEffort: saved.reasoningEffort || '' }
593
628
  const providerOptions = providers.length ? providers : Object.keys(providerModels).map((id) => ({ id, label: id }))
@@ -647,16 +682,16 @@ window.__ModuleLoader__.load({
647
682
  saved.provider ? h(Btn, { icon: 'refresh', disabled: busy['chatm-del-' + peerKey], onClick: () => onDeleteModel(peerKey) }, '恢复默认模型') : null,
648
683
  h('span', { className: 'dc-note' }, '只影响这个会话,不动全局默认')),
649
684
  h('div', { className: 'dc-note', style: { marginTop: '6px' } },
650
- '工作区决定它读哪个人格、能操作哪些文件;改完需要重建这个 QQ 会话才生效 —— 重启一次 DSH,或在 QQ 里让它开新会话。')))
685
+ '工作区决定它读哪个人格、能操作哪些文件。保存后会自动把当前 QQ 会话切到新目录(历史保留);如果提示没切成功,下一条消息也会按新目录重建。')))
651
686
  })))
652
687
  }
653
688
 
654
- function VideoCard({ info, busy, onLogin, onInstallYtdlp, onRefresh, biliLoggedIn }) {
689
+ function VideoCard({ info, busy, onLogin, onSniff, onInstallYtdlp, onRefresh, biliLoggedIn }) {
655
690
  const sb = (info && info.storyboard) || { installed: false }
656
691
  const yt = (info && info.ytdlp) || { found: false }
657
692
  const card = info && info.lastCard
658
693
  const results = card && Array.isArray(card.results) ? card.results : []
659
- return h(Card, { title: 'QQ 分享的视频', sub: '对方在 QQ 里分享 B站 视频,机器人用视频分镜插件去看' },
694
+ return h(Card, { title: '看视频', sub: 'QQ 里的视频链接、本地视频、yt-dlp 支持的站点,以及需要嗅探的网页播放器' },
660
695
  !info ? h('div', { className: 'dc-empty' }, '读取中…') : h('div', null,
661
696
  !sb.installed ? h('div', { className: 'dc-banner' }, '视频分镜插件(dsh-video-storyboard)没装:机器人能拿到链接,但看不了画面。装法见「环境」页。') : null,
662
697
  sb.installed && !yt.found ? h('div', { className: 'dc-banner' }, '还差 yt-dlp:分镜插件靠它拉 B站 视频。') : null,
@@ -664,7 +699,18 @@ window.__ModuleLoader__.load({
664
699
  h(Badge, { tone: sb.installed ? 'ok' : 'warn' }, sb.installed ? '分镜 v' + sb.version : '分镜未装'),
665
700
  h(Badge, { tone: yt.found ? 'ok' : 'warn' }, yt.found ? 'yt-dlp ' + yt.version : 'yt-dlp 未装'),
666
701
  h(Badge, { tone: info.ffmpeg ? 'ok' : 'warn' }, info.ffmpeg ? 'ffmpeg 已就绪' : 'ffmpeg 未装'),
702
+ h(Badge, { tone: info.sniff ? (info.browser ? 'ok' : 'warn') : undefined },
703
+ info.sniff ? (info.browser ? '网页嗅探已开' : '网页嗅探缺浏览器') : '网页嗅探关'),
667
704
  !yt.found ? h(Btn, { icon: 'save', disabled: busy.ytdlp, onClick: onInstallYtdlp }, busy.ytdlp ? '安装中…' : '一键装 yt-dlp') : null),
705
+ h(ToggleRow, {
706
+ label: '网页嗅探(yt-dlp 不认识的页面)',
707
+ note: info.browser
708
+ ? '用无头 Edge/Chrome 打开页面,监听播放器真正请求的视频地址;用全新临时配置,不带你的登录态。静态页面一两秒就能找到。'
709
+ : '没找到 Edge/Chrome;先装一个,或在 ~/.dsh/video.json 里写 browserPath。',
710
+ on: info.sniff !== false,
711
+ disabled: busy['video-sniff'] || (!info.sniff && !info.browser),
712
+ onChange: onSniff,
713
+ }),
668
714
  h(ToggleRow, {
669
715
  label: '用 B站 专用号的登录看高清',
670
716
  note: info.cookiesConfigured && !info.cookiesOurs ? '你在 video.json 里自己配了 cookies,这里不改动它' : (biliLoggedIn ? '默认关:匿名最高 480P,看分镜够用。打开后会把专用号登录信息写成一份只给分镜插件用的 cookies 文件;关掉就删掉' : '要先在上面「账号」里扫码登录专用号'),
@@ -681,9 +727,10 @@ window.__ModuleLoader__.load({
681
727
  : h('div', { className: 'dc-note' }, card ? '收到过卡片,但里面没有能识别的内容' : '还没收到过。QQ 网关重启后,对方分享一个 B站 视频就会显示在这里。'),
682
728
  h('div', { className: 'dc-row', style: { marginTop: '10px' } }, h(Btn, { icon: 'refresh', onClick: onRefresh }, '刷新')),
683
729
  h('div', { className: 'dc-note', style: { marginTop: '8px' } },
684
- '· 卡片里的 b23.tv 短链会在本机解开成视频地址,只访问 B站 自己的域名。', h('br'),
730
+ '· 支持本机视频、直链,以及 yt-dlp 的 1700+ 站点(B站/YouTube/抖音等);yt-dlp 认不出的网页用嗅探兜底。', h('br'),
731
+ '· 卡片里的 b23.tv 短链会在本机解开成视频地址,只访问公开 http(s) 地址;内网/回环会被拒绝。', h('br'),
685
732
  '· 群里 QQ 只把 @机器人 的消息交给它;直接转发卡片到群里通常收不到,私聊最稳。', h('br'),
686
- '· 每看一个视频会花模型 token(一张分镜图约 384 token)。')))
733
+ '· 每看一个视频会花模型 token(一张分镜图约 384 token);长视频第一次分析要下载整条视频。')))
687
734
  }
688
735
 
689
736
  function CompanionPage() {
@@ -704,6 +751,8 @@ window.__ModuleLoader__.load({
704
751
  const [selectedChat, setSelectedChat] = useState('')
705
752
  const [expandedChats, setExpandedChats] = useState({})
706
753
  const [showAllChats, setShowAllChats] = useState(false)
754
+ // 「要把选中的对话接到哪个 QQ 聊天」:私聊 / 每个群分别选,不再默认只接私聊
755
+ const [bindPeer, setBindPeer] = useState('')
707
756
  const [chatProfiles, setChatProfiles] = useState(null)
708
757
  const [setupPlan, setSetupPlan] = useState(null)
709
758
  const [setupState, setSetupState] = useState(null)
@@ -739,6 +788,15 @@ window.__ModuleLoader__.load({
739
788
  const [meme, setMeme] = useState(null)
740
789
  const [memeStatus, setMemeStatus] = useState('idle')
741
790
  const [memeBusy, setMemeBusy] = useState('')
791
+ // 图库管理:当前查看的图库、分类 / 搜索词、正在编辑的那张、上传表单
792
+ const [memeView, setMemeView] = useState(null)
793
+ const [memeQs, setMemeQs] = useState({ packId: '', tag: '', q: '' })
794
+ const [memeEdit, setMemeEdit] = useState(null)
795
+ const [memeUpload, setMemeUpload] = useState({ fileName: '', dataBase64: '', tag: '', caption: '', keywords: '' })
796
+ const [memeFolders, setMemeFolders] = useState(null)
797
+ const [memeFolderOpened, setMemeFolderOpened] = useState(false)
798
+ const [memeBatch, setMemeBatch] = useState(null)
799
+ const [memePrompt, setMemePrompt] = useState('')
742
800
  const [doctor, setDoctor] = useState(null)
743
801
  const sessionsSnap = useServiceList('sessions')
744
802
  const workspacesSnap = useServiceList('workspaces')
@@ -874,9 +932,9 @@ window.__ModuleLoader__.load({
874
932
  if (!alive.current || !d) return
875
933
  setGlobalModel(d)
876
934
  const saved = d.saved || {}
877
- const live = d.live || {}
878
- const provider = saved.provider || live.provider || ''
879
- const model = saved.model || live.model || ''
935
+ // 没保存过就空着(= 跟随 DSH 默认);不要拿 DSH 全局默认回填,否则看起来像被插件改过
936
+ const provider = saved.provider || ''
937
+ const model = saved.model || ''
880
938
  setGlobalPick((prev) => (prev.provider === provider && prev.model === model ? prev : { provider, model }))
881
939
  } catch { /* 旧宿主没有这个接口 */ }
882
940
  }, [])
@@ -894,7 +952,8 @@ window.__ModuleLoader__.load({
894
952
  try {
895
953
  const r = await post(CC + '/model', { provider: globalPick.provider, model: globalPick.model })
896
954
  if (r && r.ok) {
897
- say('默认模型已保存' + (r.applied ? ',已作为全局默认' : '') + (r.applyError ? '(但写入 DSH 默认失败:' + r.applyError + ')' : ''), 'ok')
955
+ const live = r && r.applied && Number(r.applied.changed) > 0 ? ',正在用的 ' + r.applied.changed + ' 个 QQ 会话已立刻切换' : ''
956
+ say('QQ 默认模型已保存' + live + '(只影响接入 QQ 的对话和 B站 值班)', 'ok')
898
957
  } else say('保存失败:' + String((r && r.error) || '未知'), 'err')
899
958
  await loadGlobalModel()
900
959
  } catch (error) { say('保存失败:' + errText(error), 'err') }
@@ -903,7 +962,7 @@ window.__ModuleLoader__.load({
903
962
  const clearGlobalModel = useCallback(() => runBusy('global-model-clear', async () => {
904
963
  try {
905
964
  await post(CC + '/model/clear', {})
906
- say('已清除默认模型,回到 DSH 自己的默认', 'ok')
965
+ say('已清除。QQ 新会话改为跟随 DSH 自己的默认模型', 'ok')
907
966
  await loadGlobalModel()
908
967
  } catch (error) { say('清除失败:' + errText(error), 'err') }
909
968
  }), [runBusy, loadGlobalModel, say])
@@ -943,6 +1002,27 @@ window.__ModuleLoader__.load({
943
1002
  }
944
1003
  }, [])
945
1004
 
1005
+ const loadMemeView = useCallback(async (query) => {
1006
+ const q = query || {}
1007
+ try {
1008
+ const qs = new URLSearchParams()
1009
+ if (q.packId) qs.set('packId', q.packId)
1010
+ if (q.tag) qs.set('tag', q.tag)
1011
+ if (q.q) qs.set('q', q.q)
1012
+ const url = '/dsh-memes-api' + (qs.toString() ? '?' + qs.toString() : '')
1013
+ const d = await get(url)
1014
+ if (alive.current && d && d.ok) setMemeView(d)
1015
+ return d && d.ok ? d : null
1016
+ } catch (error) { say('读图库失败:' + errText(error), 'err'); return null }
1017
+ }, [say])
1018
+
1019
+ const loadMemeFolders = useCallback(async () => {
1020
+ try {
1021
+ const d = await get(CC + '/meme/folders')
1022
+ if (alive.current && d) setMemeFolders(d)
1023
+ } catch { /* 老宿主没有这个接口就只显示路径提示 */ }
1024
+ }, [])
1025
+
946
1026
  const checkDoctor = useCallback(() => runBusy('doctor-check', async () => {
947
1027
  try {
948
1028
  const d = await get(CC + '/doctor')
@@ -965,6 +1045,8 @@ window.__ModuleLoader__.load({
965
1045
  const r = await post(AG + '/chats/persona', { peerKey, text })
966
1046
  if (r && r.ok) say('这个 QQ 会话的人格已保存', 'ok')
967
1047
  else say('保存失败:' + String((r && r.error) || '未知'), 'err')
1048
+ // 保存成功后清掉本地草稿,重新用服务端正文(否则重开页面/刷新时会显示旧草稿)
1049
+ setChatDraft((prev) => { const next = { ...prev }; delete next[peerKey]; return next })
968
1050
  await loadChats()
969
1051
  } catch (error) { say('保存失败:' + errText(error), 'err') }
970
1052
  }), [runBusy, chatDraft, loadChats, say])
@@ -981,8 +1063,12 @@ window.__ModuleLoader__.load({
981
1063
  const saveChatWorkspace = useCallback((peerKey, cwd) => runBusy('chatw-' + peerKey, async () => {
982
1064
  try {
983
1065
  const r = await post(AG + '/chats/workspace', { peerKey, cwd: String(cwd || '') })
984
- if (r && r.ok) say(r.cwd ? '这个 QQ 会话已指定工作区;重启 DSH 后生效' : '已恢复成 QQ 网关默认目录', 'ok')
985
- else say('保存失败:' + String((r && r.error) || '未知'), 'err')
1066
+ if (r && r.ok) {
1067
+ const applied = r.applied || {}
1068
+ say(r.cwd
1069
+ ? (applied.unchanged ? '工作区没变' : '这个 QQ 会话的工作区已保存' + (applied.rebuilt ? ',当前会话已切到新目录(历史保留)' : ',下一条消息会按新目录重建会话'))
1070
+ : '已恢复成 QQ 网关默认目录', 'ok')
1071
+ } else say('保存失败:' + String((r && r.error) || '未知'), 'err')
986
1072
  await loadChats()
987
1073
  } catch (error) { say('保存失败:' + errText(error), 'err') }
988
1074
  }), [runBusy, loadChats, say])
@@ -1058,12 +1144,12 @@ window.__ModuleLoader__.load({
1058
1144
  if (tab === 'voice') { loadTts(); loadLocalTts(); loadVoices() }
1059
1145
  if (tab === 'bili' || tab === 'home') loadVideo()
1060
1146
  if (tab === 'chat') loadChats()
1061
- if (tab === 'meme') loadMeme()
1147
+ if (tab === 'meme') { loadMeme(); loadMemeView({}); loadMemeFolders() }
1062
1148
  if (tab === 'doctor') { checkDoctor(); loadVideo(); loadSetup(); loadModels() }
1063
1149
  if (tab === 'bili' || tab === 'chat') { loadModels() }
1064
1150
  if (tab === 'chat') loadModelCaps()
1065
1151
  if (tab === 'chat') loadGlobalModel()
1066
- }, [tab, loadTts, loadLocalTts, loadVoices, loadVideo, loadMeme, loadChats, checkDoctor, loadSetup, loadModels, loadModelCaps, loadGlobalModel])
1152
+ }, [tab, loadTts, loadLocalTts, loadVoices, loadVideo, loadMeme, loadMemeView, loadMemeFolders, loadChats, checkDoctor, loadSetup, loadModels, loadModelCaps, loadGlobalModel])
1067
1153
 
1068
1154
  // 一键安装在跑:每 2 秒拉一次进度(只在「环境」页开着时)。
1069
1155
  const setupRunning = Boolean(setupState && setupState.running)
@@ -1257,18 +1343,19 @@ window.__ModuleLoader__.load({
1257
1343
  }, [say])
1258
1344
 
1259
1345
  // 绑定 / 解绑共用一个忙碌标记:两者不会同时在路上。
1260
- const bindQqChat = useCallback((id) => {
1346
+ const bindQqChat = useCallback((id, peerKey) => {
1261
1347
  if (!id) { say('先选一个对话', 'err'); return undefined }
1348
+ if (!peerKey) { say('先选要接的 QQ 聊天(私聊 / 群聊)', 'err'); return undefined }
1262
1349
  return runBusy('qq', async () => {
1263
1350
  try {
1264
- const r = await post(AG + '/qq/bind', { sessionId: id, cwd })
1351
+ const r = await post(AG + '/qq/bind', { sessionId: id, peerKey, cwd })
1265
1352
  say(r && r.ok ? '已把这个对话接到 QQ' : ('已写入绑定;' + ((r && r.reload && r.reload.message) || '网关重载后生效')), r && r.ok ? 'ok' : 'err')
1266
1353
  await load()
1267
1354
  } catch (error) { say('绑定失败:' + errText(error), 'err') }
1268
1355
  })
1269
1356
  }, [runBusy, cwd, load, say])
1270
1357
 
1271
- const bindQq = useCallback(() => bindQqChat(selectedChat), [bindQqChat, selectedChat])
1358
+ const bindQq = useCallback(() => bindQqChat(selectedChat, bindPeer), [bindQqChat, selectedChat, bindPeer])
1272
1359
 
1273
1360
  const toggleChat = useCallback((id) => {
1274
1361
  setSelectedChat(id)
@@ -1276,8 +1363,12 @@ window.__ModuleLoader__.load({
1276
1363
  }, [])
1277
1364
 
1278
1365
  const unbindQq = useCallback(() => runBusy('qq', async () => {
1279
- try { await post(AG + '/qq/unbind', {}); say('已解除 QQ 绑定', 'ok'); await load() } catch (error) { say('解绑失败:' + errText(error), 'err') }
1280
- }), [runBusy, load, say])
1366
+ try {
1367
+ await post(AG + '/qq/unbind', bindPeer ? { peerKey: bindPeer } : {})
1368
+ say('已解除 QQ 绑定', 'ok')
1369
+ await load()
1370
+ } catch (error) { say('解绑失败:' + errText(error), 'err') }
1371
+ }), [runBusy, load, say, bindPeer])
1281
1372
 
1282
1373
  const biliPatch = useCallback(async (patch) => {
1283
1374
  try { await post(BILI + '/config', patch); await load() } catch (error) { say('保存失败:' + errText(error), 'err') }
@@ -1410,6 +1501,128 @@ window.__ModuleLoader__.load({
1410
1501
  } catch (error) { say('表情包设置失败:' + errText(error), 'err') } finally { if (alive.current) setMemeBusy('') }
1411
1502
  }, [say])
1412
1503
 
1504
+ /** 图库管理的写操作(上传 / 编辑 / 删除 / 扫描 / 切换图库)。 */
1505
+ const memeManage = useCallback((op, extra, reload) => runBusy('meme-' + op, async () => {
1506
+ try {
1507
+ const r = await post('/dsh-memes-api', { op, ...(extra || {}) })
1508
+ if (r && r.ok) {
1509
+ say((r && r.message) || (op === 'delete' ? '已删除' : op === 'update' ? '已保存' : '已完成'), 'ok')
1510
+ if (r.packId !== undefined || r.packs) setMeme(r)
1511
+ await loadMeme()
1512
+ await loadMemeView(reload || memeQs)
1513
+ } else {
1514
+ say('操作失败:' + String((r && (r.error || r.message)) || '未知'), 'err')
1515
+ }
1516
+ return r
1517
+ } catch (error) { say('操作失败:' + errText(error), 'err'); return null }
1518
+ }), [runBusy, say, memeQs, loadMeme, loadMemeView])
1519
+
1520
+ const pickMemeFile = useCallback((file) => {
1521
+ if (!file) return
1522
+ if (file.size > 8 * 1024 * 1024) { say('图片太大(最多 8MB)', 'err'); return }
1523
+ const reader = new FileReader()
1524
+ reader.onload = () => {
1525
+ const raw = String(reader.result || '')
1526
+ setMemeUpload((u) => ({ ...u, fileName: file.name, dataBase64: raw.slice(raw.indexOf(',') + 1) }))
1527
+ }
1528
+ reader.onerror = () => say('读不到这个文件', 'err')
1529
+ reader.readAsDataURL(file)
1530
+ }, [say])
1531
+
1532
+ const uploadMeme = useCallback(() => {
1533
+ const fileName = String(memeUpload.fileName || '')
1534
+ const tag = String(memeUpload.tag || '').trim().toLowerCase()
1535
+ if (!memeUpload.dataBase64) { say('先选一张图片', 'err'); return }
1536
+ if (!/^[a-z0-9_-]{1,40}$/.test(tag)) { say('分类只能用小写字母 / 数字 / - / _', 'err'); return }
1537
+ const pending = memeManage('upload', {
1538
+ fileName,
1539
+ tag,
1540
+ caption: memeUpload.caption,
1541
+ keywords: memeUpload.keywords,
1542
+ dataBase64: memeUpload.dataBase64,
1543
+ }, memeQs)
1544
+ const done = (r) => {
1545
+ if (alive.current) setMemeUpload({ fileName: '', dataBase64: '', tag: '', caption: '', keywords: '' })
1546
+ // 内置图库上传会自动落到「我的收藏」:跟过去,不然刚传的图在当前图库里看不到
1547
+ if (r && r.message && String(r.message).includes('我的收藏')) {
1548
+ void memeManage('setPack', { packId: 'dsh-meme-user' }, {})
1549
+ }
1550
+ }
1551
+ return pending && typeof pending.then === 'function' ? pending.then(done) : pending
1552
+ }, [memeUpload, memeManage, memeQs, say])
1553
+
1554
+ const saveMemeEdit = useCallback(() => {
1555
+ if (!memeEdit) return
1556
+ const pending = memeManage('update', {
1557
+ path: memeEdit.path,
1558
+ tag: memeEdit.tag,
1559
+ caption: memeEdit.caption,
1560
+ keywords: memeEdit.keywords,
1561
+ }, memeQs)
1562
+ const done = () => { if (alive.current) setMemeEdit(null) }
1563
+ return pending && typeof pending.then === 'function' ? pending.then(done) : pending
1564
+ }, [memeEdit, memeManage, memeQs])
1565
+
1566
+ /** 打开图库文件夹(批量导入用);打开失败也把路径带回来。 */
1567
+ const openMemeFolder = useCallback((which) => runBusy('meme-folder', async () => {
1568
+ try {
1569
+ if (which === 'user') {
1570
+ // 先把「我的收藏」准备好并设为当前图库,否则拷进去的图扫的不是它
1571
+ const hasUserPack = Boolean(meme && Array.isArray(meme.packs) && meme.packs.some((p) => p.id === 'dsh-meme-user'))
1572
+ if (!hasUserPack) {
1573
+ try {
1574
+ const created = await post('/dsh-memes-api', { op: 'createMemePack', id: 'dsh-meme-user', name: '我的收藏' })
1575
+ if (created && created.ok) setMeme(created)
1576
+ } catch { /* 已经存在也没关系 */ }
1577
+ }
1578
+ try {
1579
+ const switched = await post('/dsh-memes-api', { op: 'setPack', packId: 'dsh-meme-user' })
1580
+ if (switched && switched.ok) {
1581
+ setMeme(switched)
1582
+ setMemeQs((q) => ({ ...q, packId: '', tag: '', q: '' }))
1583
+ await loadMemeView({})
1584
+ }
1585
+ } catch { /* 老版本 dsh-meme 没有这个图库就只开文件夹 */ }
1586
+ }
1587
+ const r = await post(CC + '/meme/open-folder', { which })
1588
+ if (r && r.path) setMemeFolders(r)
1589
+ if (r && r.ok) {
1590
+ setMemeFolderOpened(true)
1591
+ say('已打开文件夹:' + r.path, 'ok')
1592
+ } else {
1593
+ say('没打开文件管理器(' + String((r && r.error) || '未知') + ')。路径:' + String((r && r.path) || '') + ',可以点「复制路径」自己打开', 'err')
1594
+ }
1595
+ } catch (error) { say('打开文件夹失败:' + errText(error), 'err') }
1596
+ }), [runBusy, say, meme, loadMemeView])
1597
+
1598
+ /** 扫描图库目录:发现一次导入很多张时,自动生成让 AI 分类/写描述的提示词。 */
1599
+ const scanMemeGallery = useCallback(() => runBusy('meme-scan', async () => {
1600
+ const activeId = (meme && meme.packId) || ''
1601
+ const before = new Set(((memeView && memeView.memes) || []).map((m) => m.path))
1602
+ try {
1603
+ const r = await post('/dsh-memes-api', { op: 'scanPack', packId: activeId })
1604
+ if (!r || !r.ok) {
1605
+ say('扫描失败:' + String((r && (r.error || r.message)) || '未知'), 'err')
1606
+ return
1607
+ }
1608
+ await loadMeme()
1609
+ const d = await loadMemeView({})
1610
+ const after = ((d && d.memes) || [])
1611
+ const addedPaths = after.map((m) => m.path).filter((path) => !before.has(path))
1612
+ const count = Number(r.added) || addedPaths.length
1613
+ if (count <= 0) {
1614
+ say(r.message || '没有发现新图片(目录里的图都已入索引)', 'ok')
1615
+ return
1616
+ }
1617
+ say('扫描完成:新增 ' + count + ' 张' + (r.pruned ? ',清理 ' + r.pruned + ' 条失效记录' : ''), 'ok')
1618
+ const tags = (d && d.tags) || (memeView && memeView.tags) || []
1619
+ setMemePrompt(buildMemePrompt({ paths: addedPaths, tags }))
1620
+ const batch = count >= 5 || (memeFolderOpened && count >= 2)
1621
+ if (batch) setMemeBatch({ count, paths: addedPaths, at: Date.now() })
1622
+ setMemeFolderOpened(false)
1623
+ } catch (error) { say('扫描失败:' + errText(error), 'err') }
1624
+ }), [meme, memeView, memeFolderOpened, loadMeme, loadMemeView, say])
1625
+
1413
1626
  const pickTtsProvider = useCallback((id) => {
1414
1627
  const preset = (tts && Array.isArray(tts.presets) ? tts.presets : []).find((x) => x.id === id)
1415
1628
  setTtsForm((form) => ({
@@ -1493,6 +1706,15 @@ window.__ModuleLoader__.load({
1493
1706
  await loadVideo()
1494
1707
  }), [runBusy, say, loadVideo])
1495
1708
 
1709
+ const setVideoSniff = useCallback((on) => runBusy('video-sniff', async () => {
1710
+ try {
1711
+ const r = await post(CC + '/video/sniff', { on })
1712
+ setVideoInfo((v) => ({ ...(v || {}), ...r }))
1713
+ say(on ? '已开启网页嗅探:yt-dlp 不认识的页面会用无头 Edge/Chrome 找视频地址' : '已关闭网页嗅探:只走 yt-dlp 支持的站点', 'ok')
1714
+ } catch (error) { say(errText(error), 'err') }
1715
+ await loadVideo()
1716
+ }), [runBusy, say, loadVideo])
1717
+
1496
1718
  const installYtdlp = useCallback(() => runBusy('ytdlp', async () => {
1497
1719
  try {
1498
1720
  const r = await post(CC + '/doctor/install', { what: 'yt-dlp' })
@@ -1504,9 +1726,15 @@ window.__ModuleLoader__.load({
1504
1726
  }), [runBusy, say, loadVideo, checkDoctor, tab])
1505
1727
 
1506
1728
  const qq = (agent && agent.qq) ? agent.qq : null
1507
- const qqPeer = qq && Array.isArray(qq.peers) ? (qq.peers.find((p) => p.boundSessionId) || qq.peers[0]) : null
1508
- const boundSession = qqPeer && qqPeer.boundSessionId ? qqPeer.boundSessionId : ''
1729
+ const qqPeers = qq && Array.isArray(qq.peers) ? qq.peers : []
1730
+ const boundPeers = qqPeers.filter((p) => p.boundSessionId)
1731
+ // 当前选中的「要接哪个 QQ 聊天」:优先用户选的,否则已绑定的那个 / 第一个
1732
+ const bindPeerKey = qqPeers.some((p) => p.key === bindPeer) ? bindPeer : (((boundPeers[0] || qqPeers[0] || {}).key) || '')
1733
+ const bindPeerInfo = qqPeers.find((p) => p.key === bindPeerKey) || null
1734
+ const boundSession = bindPeerInfo && bindPeerInfo.boundSessionId ? bindPeerInfo.boundSessionId : ''
1509
1735
  const boundTitle = boundSession ? (((conversations.find((c) => c.id === boundSession) || {}).title) || boundSession) : ''
1736
+ const peerOfSession = (sid) => qqPeers.find((p) => p.boundSessionId === sid) || null
1737
+ const peerLabel = (p) => (p && p.scope === 'group' ? '群聊' : '私聊') + ' · ' + String((p && p.peerId) || '').slice(-8)
1510
1738
  const selectedTitle = selectedChat ? (((conversations.find((c) => c.id === selectedChat) || {}).title) || selectedChat) : ''
1511
1739
  const memInfo = mem && mem.memory ? mem.memory : null
1512
1740
  const biliCfg = bili && bili.config ? bili.config : {}
@@ -1528,6 +1756,8 @@ window.__ModuleLoader__.load({
1528
1756
  const ttsPresets = tts && Array.isArray(tts.presets) ? tts.presets : []
1529
1757
  const memSessions = memInfo && Array.isArray(memInfo.sessions) ? memInfo.sessions.length : 0
1530
1758
  const memPeers = memInfo && Array.isArray(memInfo.peers) ? memInfo.peers : []
1759
+ const memePromptDefault = buildMemePrompt({ tags: memeView ? memeView.tags : [], paths: memeBatch ? memeBatch.paths : [] })
1760
+ const memePromptShown = memePrompt || memePromptDefault
1531
1761
  const qqServiceOk = Boolean(mem && mem.qqService && mem.qqService.available)
1532
1762
  const engineMountState = (id) => (mem && Array.isArray(mem.engines) ? mem.engines.find((e) => e && e.id === id) : null)
1533
1763
  const engineRow = (id, label, loaded, loadedDetail, command) => {
@@ -1682,11 +1912,26 @@ window.__ModuleLoader__.load({
1682
1912
  },
1683
1913
  h('div', { className: 'dc-row' },
1684
1914
  h(Badge, { tone: qq && qq.running ? 'ok' : 'warn' }, qq && qq.installed ? (qq.running ? '网关运行中' : '网关未运行') : '网关未加载'),
1685
- h('div', { style: { flex: 1 } }),
1686
- h(Btn, { icon: 'link', kind: 'primary', disabled: busy.qq || selectedChat === '', onClick: bindQq }, boundSession === selectedChat && selectedChat !== '' ? '已接到这个对话' : '把选中的对话接到 QQ'),
1687
- boundSession ? h(Btn, { icon: 'link', onClick: unbindQq, disabled: busy.qq }, '解除绑定') : null),
1688
- h('div', { className: 'dc-note', style: { marginTop: '8px' } }, '当前接在:' + (boundTitle || '还没接任何对话') + ';选中:' + (selectedTitle || '没选')),
1689
- qqPeer ? h('div', { className: 'dc-note', style: { marginTop: '4px' } }, '账号:' + (qqPeer.scope === 'group' ? '群聊' : '私聊') + ' · ' + String(qqPeer.peerId || '').slice(-6)) : null,
1915
+ h('div', { style: { flex: 1 } })),
1916
+ qqPeers.length ? h('div', { style: { marginTop: '10px' } },
1917
+ h('label', { className: 'dc-label', htmlFor: 'dc-bind-peer' }, '要接哪个 QQ 聊天(私聊 / 群聊分开选)'),
1918
+ h('select', { id: 'dc-bind-peer', className: 'dc-select', value: bindPeerKey, onChange: (e) => setBindPeer(e.target.value) },
1919
+ qqPeers.map((p) => h('option', { key: p.key, value: p.key },
1920
+ peerLabel(p) + (p.boundSessionId ? '(已接到对话)' : '')))),
1921
+ h('div', { className: 'dc-note', style: { marginTop: '6px' } },
1922
+ '选中的对话:' + (selectedTitle || '还没选') + ' · 要接到:' + (bindPeerInfo ? peerLabel(bindPeerInfo) : '—')),
1923
+ h('div', { className: 'dc-row', style: { marginTop: '8px' } },
1924
+ h(Btn, { icon: 'link', kind: 'primary', disabled: busy.qq || selectedChat === '' || !bindPeerKey, onClick: bindQq }, bindPeerInfo && bindPeerInfo.boundSessionId === selectedChat && selectedChat !== '' ? '这个对话就接在这里' : '把选中的对话接到这个 QQ 聊天'),
1925
+ bindPeerInfo && bindPeerInfo.boundSessionId ? h(Btn, { icon: 'link', onClick: unbindQq, disabled: busy.qq }, '解除这个聊天的绑定') : null))
1926
+ : h('div', { className: 'dc-note', style: { marginTop: '8px' } }, '还没有记录到任何 QQ 聊天:先在 QQ 里给机器人发一条消息(私聊或群里 @ 它),再回来。'),
1927
+ boundPeers.length ? h('div', { style: { marginTop: '12px' } },
1928
+ h('div', { className: 'dc-label' }, '当前绑定(私聊 / 群聊分开显示)'),
1929
+ h('div', { className: 'dc-list' }, boundPeers.map((p) => h('div', { key: p.key, className: 'dc-item' },
1930
+ h('div', { className: 'dc-item-main' },
1931
+ h('div', { className: 'dc-item-title' }, peerLabel(p) + ' → ' + (((conversations.find((c) => c.id === p.boundSessionId) || {}).title) || p.boundSessionId)),
1932
+ h('div', { className: 'dc-item-sub' }, p.scope === 'group' ? '群聊' : '私聊')),
1933
+ h(Badge, { tone: p.scope === 'group' ? 'warn' : 'ok' }, p.scope === 'group' ? '群聊' : '私聊')))))
1934
+ : h('div', { className: 'dc-note', style: { marginTop: '10px' } }, '当前没有绑定任何 QQ 聊天。'),
1690
1935
  mem && mem.qqbotPatch ? h('div', { className: 'dc-note', style: { marginTop: '4px' } }, '网关补丁:' + (mem.qqbotPatch.patched ? '已打(' + (mem.qqbotPatch.version || '0.5.3') + ')' : (mem.qqbotPatch.found ? '未打,到「环境」页点「打 QQ 网关补丁」' : '没装 QQ 网关'))) : null,
1691
1936
  qqBindPanel),
1692
1937
  h(Card, {
@@ -1699,7 +1944,8 @@ window.__ModuleLoader__.load({
1699
1944
  conversations.length ? h('div', { className: 'dc-list' },
1700
1945
  (showAllChats ? conversations : conversations.slice(0, 3)).map((c) => {
1701
1946
  const expanded = Boolean(expandedChats[c.id])
1702
- const isBound = c.id === boundSession
1947
+ const boundPeerOfChat = peerOfSession(c.id)
1948
+ const isBound = Boolean(boundPeerOfChat)
1703
1949
  const stop = (e) => { if (e && e.stopPropagation) e.stopPropagation() }
1704
1950
  return h('div', { key: c.id, className: 'dc-block', 'data-on': selectedChat === c.id ? '' : undefined },
1705
1951
  h('div', {
@@ -1711,14 +1957,14 @@ window.__ModuleLoader__.load({
1711
1957
  h('span', { className: 'dc-caret', 'data-open': expanded ? '' : undefined, 'aria-hidden': true }, '▸'),
1712
1958
  h('div', { className: 'dc-item-main' },
1713
1959
  h('div', { className: 'dc-item-title', title: c.title }, c.title),
1714
- h('div', { className: 'dc-item-sub' }, fmtTime(c.updatedAt) + (c.running ? ' · 运行中' : '') + (isBound ? ' · QQ 正在用' : ''))),
1715
- isBound ? h(Badge, { tone: 'ok' }, 'QQ') : null),
1960
+ h('div', { className: 'dc-item-sub' }, fmtTime(c.updatedAt) + (c.running ? ' · 运行中' : '') + (isBound ? ' · QQ ' + (boundPeerOfChat.scope === 'group' ? '群聊' : '私聊') + '正在用' : ''))),
1961
+ isBound ? h(Badge, { tone: boundPeerOfChat.scope === 'group' ? 'warn' : 'ok' }, 'QQ ' + (boundPeerOfChat.scope === 'group' ? '群聊' : '私聊')) : null),
1716
1962
  expanded ? h('div', { className: 'dc-block-body', id: 'dc-chat-' + c.id },
1717
1963
  h('div', { className: 'dc-note', style: { wordBreak: 'break-all' } }, 'ID:' + c.id),
1718
1964
  h('div', { className: 'dc-note', style: { wordBreak: 'break-all' } }, '目录:' + (c.cwd || '—')),
1719
1965
  h('div', { className: 'dc-row', style: { marginTop: '4px' } },
1720
1966
  h(Btn, { icon: 'open', onClick: (e) => { stop(e); openChat(c.id) } }, '打开'),
1721
- h(Btn, { icon: 'link', kind: 'primary', disabled: busy.qq || isBound, onClick: (e) => { stop(e); bindQqChat(c.id) } }, isBound ? '已接到 QQ' : '接到 QQ'),
1967
+ h(Btn, { icon: 'link', kind: 'primary', disabled: busy.qq || isBound, onClick: (e) => { stop(e); bindQqChat(c.id, bindPeerKey) } }, isBound ? '已接到 QQ' : '接到选中的 QQ 聊天'),
1722
1968
  h(Btn, { icon: 'copy', onClick: (e) => { stop(e); copy(c.id, '对话 ID') } }, '复制 ID'))) : null)
1723
1969
  }))
1724
1970
  : h('div', { className: 'dc-empty' }, !sessionsSnap ? '读取对话列表中…' : (cwd === '' ? '先在「人格」页选一个项目' : '还没有对话;点右上角「新建」')),
@@ -1899,20 +2145,22 @@ window.__ModuleLoader__.load({
1899
2145
  biliCfg.transcribe ? h(Btn, { icon: 'save', disabled: busy.asr, onClick: () => runBusy('asr', () => post(BILI + '/install-asr', {}).then(() => say('开始装转写依赖,日志里看进度', 'ok')).catch((e) => say(errText(e), 'err'))) }, '装转写依赖') : null,
1900
2146
  )),
1901
2147
  h('div', { className: 'dc-list', style: { gap: '16px' } },
1902
- h(VideoCard, { info: videoInfo, busy, onLogin: setVideoLogin, onInstallYtdlp: installYtdlp, onRefresh: loadVideo, biliLoggedIn: loggedIn }),
2148
+ h(VideoCard, { info: videoInfo, busy, onLogin: setVideoLogin, onSniff: setVideoSniff, onInstallYtdlp: installYtdlp, onRefresh: loadVideo, biliLoggedIn: loggedIn }),
1903
2149
  h(Card, { title: '今天', sub: '日志与报告' },
1904
2150
  h('pre', { className: 'dc-pre' }, logLines.length ? logLines.join('\n') : (!bili ? (loading ? '读取中…' : 'B站 值班插件没响应') : '还没有日志')),
1905
2151
  h('div', { className: 'dc-note', style: { marginTop: '10px', wordBreak: 'break-all' } }, (bili && bili.reportPath) || '报告还没生成'),
1906
2152
  h('div', { className: 'dc-row', style: { marginTop: '8px' } },
1907
2153
  h(Btn, { icon: 'refresh', onClick: () => load() }, '刷新'))))) : null,
1908
2154
 
1909
- tab === 'meme' ? h('div', { className: 'dc-split' },
2155
+ tab === 'meme' ? h('div', null,
2156
+ h('div', { className: 'dc-split' },
2157
+ h('div', { className: 'dc-list', style: { gap: '16px' } },
1910
2158
  h(Card, { title: '表情包(dsh-meme)', sub: meme ? '已装 v' + (meme.pluginVersion || '?') : (memeStatus === 'missing' ? '还没装上' : memeStatus === 'error' ? '读取失败' : '读取中…') },
1911
2159
  meme ? h('div', null,
1912
- meme.promptEnabled === false ? h('div', { className: 'dc-banner' }, 'AI 斗图已关闭:模型不会主动发图,手动选图还在') : null,
2160
+ meme.promptEnabled === false ? h('div', { className: 'dc-banner' }, 'AI 斗图已关闭:模型不会主动发图;图库和手动发送工具还在') : null,
1913
2161
  h(ToggleRow, {
1914
2162
  label: 'AI 主动斗图',
1915
- note: '关掉后模型不再主动配图/发图;手动选择器还在',
2163
+ note: '关掉后模型不再主动配图/发图;send_meme 工具和图库不受影响',
1916
2164
  on: meme.promptEnabled !== false,
1917
2165
  onChange: (v) => memeOp('setPromptEnabled', { enabled: v }),
1918
2166
  disabled: Boolean(memeBusy),
@@ -1933,7 +2181,7 @@ window.__ModuleLoader__.load({
1933
2181
  h('div', { className: 'dc-row', style: { marginTop: '12px' } },
1934
2182
  h(Btn, { icon: 'open', onClick: () => window.open('/memes-panel', '_blank', 'noopener') }, '打开图库管理'),
1935
2183
  h(Btn, { icon: 'refresh', disabled: memeStatus === 'loading', onClick: loadMeme }, '刷新')),
1936
- h('div', { className: 'dc-note', style: { marginTop: '10px' } }, '完整图库管理(上传 / 学图 / 导入导出 / 市场)在 /memes-panel;这里只放开关。'))
2184
+ h('div', { className: 'dc-note', style: { marginTop: '10px' } }, '图库管理就在下面(添加 / 改描述 / 删除 / 扫描目录);导入导出和图库市场仍在 /memes-panel。'))
1937
2185
  : memeStatus === 'missing' ? h('div', null,
1938
2186
  h('div', { className: 'dc-empty' }, 'dsh-meme 还没装;在插件页装上后这里会出现开关。'),
1939
2187
  h(Btn, { icon: 'open', onClick: () => window.open('/plugins', '_blank', 'noopener') }, '打开插件页'))
@@ -1941,20 +2189,118 @@ window.__ModuleLoader__.load({
1941
2189
  h('div', { className: 'dc-banner', 'data-tone': 'err' }, 'dsh-meme 没答上来;稍后点「刷新」再试。'),
1942
2190
  h(Btn, { icon: 'refresh', onClick: loadMeme }, '刷新'))
1943
2191
  : h('div', { className: 'dc-empty' }, '读取中…')),
2192
+ h(Card, { title: '图库管理', sub: '添加 / 改描述 / 删除表情包(不用另外开面板)' },
2193
+ !memeView ? h('div', { className: 'dc-empty' }, memeStatus === 'missing' ? 'dsh-meme 没装,图库管理用不了。' : '读取图库…')
2194
+ : (() => {
2195
+ const packs = memeView.packs || []
2196
+ const activeId = (meme && meme.packId) || memeView.packId || ''
2197
+ const activeName = ((packs.find((p) => p.id === activeId) || {}).name) || activeId
2198
+ const viewingId = memeQs.packId || ''
2199
+ const isActiveView = viewingId === '' || viewingId === activeId
2200
+ const rows = memeView.memes || []
2201
+ return h('div', null,
2202
+ h('div', { className: 'dc-row', style: { gap: '10px', alignItems: 'flex-end', flexWrap: 'wrap' } },
2203
+ h('div', { style: { flex: '1 1 180px' } },
2204
+ h('label', { className: 'dc-label' }, '图库'),
2205
+ h('select', { className: 'dc-select', value: viewingId, onChange: (e) => { const v = e.target.value; setMemeQs((q) => ({ ...q, packId: v, tag: '', q: '' })); loadMemeView(v ? { packId: v } : {}) } },
2206
+ h('option', { value: '' }, '当前图库' + (activeName ? '(' + activeName + ')' : '')),
2207
+ packs.map((p) => h('option', { key: p.id, value: p.id }, (p.name || p.id) + '(' + (p.count || 0) + ' 张)')))),
2208
+ h('div', { style: { flex: '1 1 150px' } },
2209
+ h('label', { className: 'dc-label' }, '分类'),
2210
+ h('select', { className: 'dc-select', value: memeQs.tag, onChange: (e) => { const v = e.target.value; setMemeQs((q) => ({ ...q, tag: v })); loadMemeView({ ...(memeQs.packId ? { packId: memeQs.packId } : {}), tag: v, q: memeQs.q }) } },
2211
+ h('option', { value: '' }, '全部分类'),
2212
+ (memeView.tags || []).map((t) => h('option', { key: t, value: t }, t)))),
2213
+ h('div', { style: { flex: '2 1 200px' } },
2214
+ h('label', { className: 'dc-label' }, '搜描述 / 关键词'),
2215
+ h('div', { className: 'dc-row' },
2216
+ h('input', { className: 'dc-input', value: memeQs.q, placeholder: '例:猫 / 无语 / 笑', onChange: (e) => { const v = e.target.value; setMemeQs((q) => ({ ...q, q: v })) } }),
2217
+ h(Btn, { icon: 'search', onClick: () => loadMemeView(memeQs) }, '搜')))),
2218
+ !isActiveView ? h('div', { className: 'dc-banner', style: { marginTop: '10px' } },
2219
+ '正在查看别的图库:可以浏览,但要编辑 / 删除 / 上传,先把它设为当前图库。',
2220
+ h('div', { className: 'dc-row', style: { marginTop: '6px' } },
2221
+ h(Btn, { icon: 'check', kind: 'primary', disabled: Boolean(memeBusy), onClick: () => memeManage('setPack', { packId: viewingId }, {}) }, '设为当前图库'))) : null,
2222
+ rows.length ? h('div', { className: 'dc-meme-grid' }, rows.map((m) => {
2223
+ const editing = memeEdit && memeEdit.path === m.path
2224
+ return h('div', { key: m.path, className: 'dc-meme-card' },
2225
+ h('img', { className: 'dc-meme-thumb', src: m.url || '', alt: m.caption || '表情包', loading: 'lazy' }),
2226
+ h('div', { className: 'dc-meme-meta' },
2227
+ h('div', { className: 'dc-item-title', title: m.caption || m.path }, m.caption || m.file_name || m.path),
2228
+ h('div', { className: 'dc-item-sub' }, '#' + (m.tag || '未分类') + (m.keywords ? ' · ' + m.keywords : ''))),
2229
+ editing
2230
+ ? h('div', null,
2231
+ h('input', { className: 'dc-input', value: memeEdit.tag, placeholder: '分类(小写字母/数字/-/_)', onChange: (e) => setMemeEdit((x) => ({ ...x, tag: e.target.value })) }),
2232
+ h('input', { className: 'dc-input', style: { marginTop: '4px' }, value: memeEdit.caption, placeholder: '描述(模型看这个)', onChange: (e) => setMemeEdit((x) => ({ ...x, caption: e.target.value })) }),
2233
+ h('input', { className: 'dc-input', style: { marginTop: '4px' }, value: memeEdit.keywords, placeholder: '关键词(空格分隔)', onChange: (e) => setMemeEdit((x) => ({ ...x, keywords: e.target.value })) }),
2234
+ h('div', { className: 'dc-row', style: { marginTop: '4px' } },
2235
+ h(Btn, { icon: 'save', kind: 'primary', disabled: Boolean(memeBusy), onClick: saveMemeEdit }, '保存'),
2236
+ h(Btn, { onClick: () => setMemeEdit(null) }, '取消')))
2237
+ : h('div', { className: 'dc-row' },
2238
+ h(Btn, { icon: 'save', disabled: !isActiveView, onClick: () => setMemeEdit({ path: m.path, tag: m.tag || '', caption: m.caption || '', keywords: m.keywords || '' }) }, '编辑'),
2239
+ h(Btn, { icon: 'trash', kind: 'danger', disabled: !isActiveView, onClick: () => memeManage('delete', { path: m.path }, memeQs) }, '删除')))
2240
+ }))
2241
+ : h('div', { className: 'dc-empty', style: { marginTop: '10px' } }, '这个图库里还没有表情包:下面上传,或点「扫描图库目录」把手动拷进去的图片收进来。'),
2242
+ h('div', { className: 'dc-row', style: { marginTop: '10px', flexWrap: 'wrap' } },
2243
+ h(Btn, { icon: 'refresh', disabled: Boolean(memeBusy) || !isActiveView, onClick: scanMemeGallery }, '扫描当前图库目录'),
2244
+ h(Btn, { icon: 'refresh', disabled: Boolean(memeBusy), onClick: () => loadMemeView(memeQs) }, '刷新列表')),
2245
+ h('div', { className: 'dc-meme-upload' },
2246
+ h('div', { className: 'dc-label', style: { marginTop: 0 } }, '批量导入:直接打开文件夹拷图片'),
2247
+ h('div', { className: 'dc-row', style: { flexWrap: 'wrap' } },
2248
+ h(Btn, { icon: 'folder', disabled: Boolean(memeBusy), onClick: () => openMemeFolder('user') }, '打开「我的收藏」文件夹'),
2249
+ h(Btn, { icon: 'folder', disabled: Boolean(memeBusy), onClick: () => openMemeFolder('packs') }, '打开图库根目录'),
2250
+ h(Btn, { icon: 'copy', disabled: !memeFolders, onClick: () => copy((memeFolders && memeFolders.userPack) || '', '文件夹路径') }, '复制路径')),
2251
+ h('div', { className: 'dc-note', style: { marginTop: '6px' } },
2252
+ '把图片拷进去后回到这里点「扫描当前图库目录」。拷到哪个图库,就先在左边把那个图库设为当前。自己拷进去的图默认只有文件名,需要补分类和描述 —— 这一步可以交给 AI(下方有现成提示词,可改)。'),
2253
+ memeFolders ? h('div', { className: 'dc-note', style: { marginTop: '4px', wordBreak: 'break-all' } },
2254
+ '我的收藏:' + memeFolders.userPack + (memeFolders.userPackExists ? '' : '(还没建,点「打开」会自动建)')) : null),
2255
+ isActiveView ? h('div', { className: 'dc-meme-upload' },
2256
+ h('div', { className: 'dc-label', style: { marginTop: 0 } }, '添加表情包(自动存进「我的收藏」,升级不丢)'),
2257
+ h('input', { type: 'file', className: 'dc-input', accept: 'image/png,image/jpeg,image/gif,image/webp', onChange: (e) => { pickMemeFile(e.target.files && e.target.files[0]); e.target.value = '' } }),
2258
+ h('div', { className: 'dc-row', style: { marginTop: '6px', gap: '8px' } },
2259
+ h('input', { className: 'dc-input', value: memeUpload.tag, placeholder: '分类(必填)', onChange: (e) => setMemeUpload((u) => ({ ...u, tag: e.target.value })) }),
2260
+ h('input', { className: 'dc-input', value: memeUpload.caption, placeholder: '描述(模型看这个)', onChange: (e) => setMemeUpload((u) => ({ ...u, caption: e.target.value })) })),
2261
+ h('input', { className: 'dc-input', style: { marginTop: '6px' }, value: memeUpload.keywords, placeholder: '关键词(空格分隔,方便以后搜)', onChange: (e) => setMemeUpload((u) => ({ ...u, keywords: e.target.value })) }),
2262
+ h('div', { className: 'dc-row', style: { marginTop: '8px' } },
2263
+ h(Btn, { icon: 'save', kind: 'primary', disabled: Boolean(memeBusy) || !memeUpload.dataBase64 || !memeUpload.tag, onClick: uploadMeme }, memeUpload.dataBase64 ? '上传这张' : '先选一张图'),
2264
+ h('span', { className: 'dc-note' }, memeUpload.fileName || '支持 png / jpg / gif / webp,最大 8MB')),
2265
+ h('div', { className: 'dc-note', style: { marginTop: '6px' } }, '「大肥鱼」这类内置图库会随插件升级重置:要长期收藏请用「我的收藏」;动图 GIF 会保留动画。')) : null)
2266
+ })())),
1944
2267
  h(Card, { title: '怎么用', sub: '装好之后' },
1945
2268
  h('div', { className: 'dc-note', style: { lineHeight: '1.9' } },
1946
- '· 输入框旁边会多一个表情入口,手动挑图;', h('br'),
1947
- '· 聊天里模型会按气氛主动配图;', h('br'),
1948
- '· 关掉上面的开关,模型就不再主动斗图,图库和手动入口都还在;', h('br'),
2269
+ '· 聊天里模型会按气氛主动配图(send_meme 工具,不是聊天输入框里的按钮);', h('br'),
2270
+ '· 这里有 AI 主动斗图的开关,关掉后模型就不再主动发图;', h('br'),
2271
+ '· 图库管理(添加 / 改描述 / 删除 / 扫描目录)就在上面;导入导出 / 图库市场在 /memes-panel;', h('br'),
1949
2272
  '· QQ 发图需要 companionQq 通道(这里显示「已接」就说明服务在了);', h('br'),
1950
- '· 如果表情包是刚刚热装的,重启一次 DSH 后 send_meme 才会切到 QQ 原生图片;', h('br'),
1951
- '· 热重载后先在 QQ 里发一句话,机器人有「最近聊天目标」才能发图。'))) : null,
2273
+ '· 刚热装表情包后,重启一次 DSH,send_meme 才会切到 QQ 原生图片;', h('br'),
2274
+ '· 重载后先在 QQ 里发一句话,机器人有「最近聊天目标」才能发图。'))),
2275
+ h(Card, { title: '让 AI 分类 / 写描述', sub: '导入新图后:复制提示词发给 AI(建议先打开「多智能体协作 / Agent Teams」)' },
2276
+ memeBatch ? h('div', { className: 'dc-banner', style: { marginBottom: '10px' } },
2277
+ '检测到刚导入了 ' + memeBatch.count + ' 张:' + (memeBatch.paths && memeBatch.paths.length ? '下面已经把图片路径写进提示词了。' : '') + '打开「多智能体协作 / Agent Teams」后再发给 AI,分类和写描述会快很多。') : null,
2278
+ h('div', { className: 'dc-note', style: { lineHeight: '1.8' } },
2279
+ 'AI 会用 meme_list 看图库、meme_update 改分类 / 描述 / 关键词。提示词可以直接改;改完点「复制提示词」,到聊天里发给 AI 就行,不用再补充说明。'),
2280
+ h('textarea', {
2281
+ className: 'dc-textarea',
2282
+ style: { minHeight: '170px', marginTop: '10px', fontFamily: 'var(--cy-mono)' },
2283
+ value: memePromptShown,
2284
+ spellCheck: false,
2285
+ 'aria-label': 'AI 分类描述提示词',
2286
+ onChange: (e) => setMemePrompt(e.target.value),
2287
+ }),
2288
+ h('div', { className: 'dc-row', style: { marginTop: '8px', flexWrap: 'wrap' } },
2289
+ h(Btn, { icon: 'copy', onClick: () => copy(memePromptShown, '提示词') }, '复制提示词'),
2290
+ h(Btn, { icon: 'spark', onClick: () => setMemePrompt(buildMemePrompt({ tags: memeView ? memeView.tags : [], paths: memeBatch ? memeBatch.paths : [] })) }, '按当前图库重新生成'),
2291
+ memePrompt ? h(Btn, { icon: 'refresh', onClick: () => setMemePrompt('') }, '恢复默认') : null),
2292
+ h('div', { className: 'dc-note', style: { marginTop: '8px' } },
2293
+ '少量几张直接发给 AI 也行;一次导入很多张时,建议先打开 DSH 的多智能体协作(Agent Teams),让它分头处理。不想交给 AI 的话,也可以在上面逐张点「编辑」自己写分类和描述。'))) : null,
1952
2294
 
1953
2295
  tab === 'voice' ? h('div', { className: 'dc-split' },
1954
2296
  h('div', { className: 'dc-list', style: { gap: '16px' } },
1955
- h(Card, { title: '文字转语音', sub: !tts ? (ttsError ? '读取失败' : '读取中…') : (tts.provider === 'off' ? '已停用:QQ 只发文字' : (tts.enabled ? (tts.local ? '本地服务:' + ((ttsPresets.find((p) => p.id === tts.provider) || {}).name || tts.provider) : 'Key 已保存 ' + tts.keyHint) : (tts.needsKey ? (tts.hasKey ? '模型没填:QQ 只发文字' : '还没填 API Key') : '还没填服务地址'))) },
2297
+ h(Card, { title: '文字转语音', sub: !tts ? (ttsError ? '读取失败' : '读取中…') : (tts.provider === 'off' ? '已停用:QQ 只发文字' : (tts.enabled ? (tts.local ? '本地服务:' + ((ttsPresets.find((p) => p.id === tts.provider) || {}).name || tts.provider) : (tts.sharedKey ? '用 DSH 里的 DeepSeek Key' : 'Key 已保存 ' + tts.keyHint)) : (tts.sharedKey ? (tts.sharedKeyReady ? '模型没填:QQ 只发文字' : 'DSH 里还没有 DeepSeek Key') : (tts.needsKey ? (tts.hasKey ? '模型没填:QQ 只发文字' : '还没填 API Key') : '还没填服务地址')))) },
1956
2298
  ttsError && !tts ? h('div', { className: 'dc-banner', 'data-tone': 'err' }, '读不到语音设置:' + ttsError) : null,
1957
- tts && !tts.enabled ? h('div', { className: 'dc-banner' }, '语音已关闭:QQ 回复只发文字' + (tts.provider === 'off' ? '(选的是「不启用」)' : tts.needsKey ? '(Key 或模型没填全)' : '(服务地址没填)')) : null,
2299
+ tts && !tts.enabled ? h('div', { className: 'dc-banner' }, '语音已关闭:QQ 回复只发文字' + (tts.provider === 'off' ? '(选的是「不启用」)' : tts.sharedKey && !tts.sharedKeyReady ? '(DSH 里还没有 DeepSeek API Key)' : tts.needsKey ? '(Key 或模型没填全)' : '(服务地址没填)')) : null,
2300
+ ttsForm && ttsForm.provider === 'deepseek' ? h('div', { className: 'dc-note', style: { marginTop: '6px' } },
2301
+ tts && tts.deepseekKeyReady
2302
+ ? 'Key 不用填:直接用 DSH「设置 → 模型」里已经配好的 DeepSeek API Key。'
2303
+ : '还没读到 DeepSeek Key:先到 DSH「设置 → 模型」里把 DeepSeek 的 API Key 填一次,这里会自动共用。') : null,
1958
2304
  ttsForm ? h('div', null,
1959
2305
  h('label', { className: 'dc-label', htmlFor: 'dc-tts-provider' }, '服务预设'),
1960
2306
  h('select', { id: 'dc-tts-provider', className: 'dc-select', value: ttsForm.provider, onChange: (e) => { setTtsProbe(null); pickTtsProvider(e.target.value) } },
@@ -1962,7 +2308,7 @@ window.__ModuleLoader__.load({
1962
2308
  h('optgroup', { label: '本地 / 自建(不用 Key)' }, ttsPresets.filter((p) => p.group === 'local').map((p) => h('option', { key: p.id, value: p.id }, p.name)))),
1963
2309
  h('div', { className: 'dc-note', style: { marginTop: '6px' } }, (ttsPreset && ttsPreset.note) || ''),
1964
2310
  h('div', { className: 'dc-note', style: { marginTop: '4px' } }, '选「不启用」、模型或地址没填:QQ 回复只发文字;合成失败(没额度 / 鉴权 / 网络 / 本地服务没开)也会自动退回文字。'),
1965
- !ttsLocal && !ttsOff ? h('div', null,
2311
+ !ttsLocal && !ttsOff && ttsForm.provider !== 'deepseek' ? h('div', null,
1966
2312
  h('label', { className: 'dc-label', htmlFor: 'dc-tts-key' }, 'API Key(只存本机,不回显)'),
1967
2313
  h('div', { className: 'dc-row' },
1968
2314
  h('input', { id: 'dc-tts-key', className: 'dc-input', type: 'password', value: ttsKey, placeholder: tts && tts.hasKey ? '已保存 ' + tts.keyHint + '(留空不改)' : 'sk-…', onChange: (e) => setTtsKey(e.target.value), autoComplete: 'off' }),
@@ -1982,7 +2328,7 @@ window.__ModuleLoader__.load({
1982
2328
  h('label', { className: 'dc-label', htmlFor: 'dc-tts-qmodel' }, '模型'),
1983
2329
  h('select', { id: 'dc-tts-qmodel', className: 'dc-select', value: ttsForm.qwenModel || '', onChange: (e) => editTts('qwenModel', e.target.value) },
1984
2330
  (tts && Array.isArray(tts.qwen3Models) ? tts.qwen3Models : []).map((m) => h('option', { key: m.id, value: m.id }, m.name + ' · ' + m.size))))
1985
- : ['gpt-sovits', 'cosyvoice', 'fish-speech', 'custom-http'].includes(ttsForm.provider) ? null : h('div', { style: { flex: '1 1 160px' } },
2331
+ : ['gpt-sovits', 'cosyvoice', 'fish-speech', 'custom-http', 'deepseek'].includes(ttsForm.provider) ? null : h('div', { style: { flex: '1 1 160px' } },
1986
2332
  h('label', { className: 'dc-label', htmlFor: 'dc-tts-model' }, '模型'),
1987
2333
  h('input', { id: 'dc-tts-model', className: 'dc-input', list: ttsForm.provider === 'qwen3-vllm' ? 'dc-qwen-models' : undefined, value: ttsForm.model || '', placeholder: ttsLocal ? '按服务的说明填(可留空)' : '留空 = 只发文字', onChange: (e) => editTts('model', e.target.value) })),
1988
2334
  ttsForm.provider === 'gpt-sovits' ? null : h('div', { style: { flex: '1 1 160px' } },
@@ -1991,14 +2337,15 @@ window.__ModuleLoader__.load({
1991
2337
  ? h('div', { className: 'dc-row' },
1992
2338
  h(Badge, { tone: 'ok' }, '角色声音:' + ((((voiceList && voiceList.voices) || []).find((v) => 'clone:' + v.id === ttsForm.voice) || {}).name || '(已删除)')),
1993
2339
  h(Btn, { icon: 'refresh', kind: 'ghost', onClick: () => editTts('voice', 'Vivian') }, '换回内置音色'))
1994
- : h('input', { id: 'dc-tts-voice', className: 'dc-input', list: String(ttsForm.provider).startsWith('qwen3') ? 'dc-qwen-speakers' : undefined, value: ttsForm.voice || '', onChange: (e) => editTts('voice', e.target.value) }))),
2340
+ : h('input', { id: 'dc-tts-voice', className: 'dc-input', list: String(ttsForm.provider).startsWith('qwen3') ? 'dc-qwen-speakers' : (ttsForm.provider === 'deepseek' ? 'dc-deepseek-voices' : undefined), value: ttsForm.voice || '', placeholder: ttsForm.provider === 'deepseek' ? 'stella(女声)或 tide(男声)' : '', onChange: (e) => editTts('voice', e.target.value) }))),
1995
2341
  h('datalist', { id: 'dc-qwen-speakers' }, (tts && Array.isArray(tts.qwen3Speakers) ? tts.qwen3Speakers : []).map((x) => h('option', { key: x, value: x }))),
2342
+ h('datalist', { id: 'dc-deepseek-voices' }, ['stella', 'tide'].map((x) => h('option', { key: x, value: x }))),
1996
2343
  h('datalist', { id: 'dc-qwen-models' }, (tts && Array.isArray(tts.qwen3Models) ? tts.qwen3Models : []).map((m) => h('option', { key: m.id, value: m.id }))),
1997
- !ttsLocal && !ttsOff ? h('div', { className: 'dc-note', style: { marginTop: '4px' } }, '声音栏只对 Qwen-TTS / OpenAI 有效;Sambert 的模型名就是音色,留空即可。') : null,
2344
+ !ttsLocal && !ttsOff ? h('div', { className: 'dc-note', style: { marginTop: '4px' } }, ttsForm.provider === 'deepseek' ? 'DeepSeek 官方语音只有 stella(女声)和 tide(男声);语种按文本自动识别,不用选。' : '声音栏只对 Qwen-TTS / OpenAI 有效;Sambert 的模型名就是音色,留空即可。') : null,
1998
2345
  ENGLISH_SAMBERT.test(String(ttsForm.model || '').trim())
1999
2346
  ? h('div', { className: 'dc-banner', style: { marginTop: '8px' } }, '「' + String(ttsForm.model).trim() + '」是英文音色,读中文几乎没声音(QQ 里会变成 1 秒的空语音)。中文请用 sambert-zhida-v1 这类中文音色;现在这种情况会自动改发文字。')
2000
2347
  : null,
2001
- ttsOff ? null : h('div', null,
2348
+ ttsOff || ttsForm.provider === 'deepseek' ? null : h('div', null,
2002
2349
  h('label', { className: 'dc-label', htmlFor: 'dc-tts-lang' }, '语言'),
2003
2350
  h('select', { id: 'dc-tts-lang', className: 'dc-select', value: ttsForm.language || 'Auto', onChange: (e) => editTts('language', e.target.value) },
2004
2351
  ['Auto', 'Chinese', 'English', 'Japanese', 'Korean', 'Cantonese', 'French', 'German', 'Spanish', 'Italian', 'Portuguese', 'Russian'].map((x) => h('option', { key: x, value: x }, x)))),
@@ -2035,7 +2382,7 @@ window.__ModuleLoader__.load({
2035
2382
  ttsForm && (ttsForm.provider === 'qwen3-local' || ttsForm.provider === 'qwen3-vllm') ? h(VoiceCloneCard, { list: voiceList && voiceList.voices, current: voiceList && voiceList.current, busy, onCreate: createVoice, onUse: useVoice, onDelete: deleteVoice, provider: ttsForm.provider }) : null),
2036
2383
  h(Card, { title: '试听', sub: '先在网页里听,确认声音再往下接' },
2037
2384
  !ttsReady && tts ? h('div', { className: 'dc-banner' }, ttsLocal ? '试听和「发到 QQ」要先填好服务地址并「保存设置」;自带 Qwen3-TTS 要先在左边启动。' : '试听和「发到 QQ」要先选一个预设、填好 Key 和模型并保存。') : null,
2038
- h('textarea', { className: 'dc-textarea', style: { minHeight: '120px' }, value: voiceText, 'aria-label': '要朗读的文字', placeholder: '写一段要读的文字(Qwen-TTS 最多 600 字;Sambert 最多 1 万字;本地模型最多 2000 字)', onChange: (e) => setVoiceText(e.target.value) }),
2385
+ h('textarea', { className: 'dc-textarea', style: { minHeight: '120px' }, value: voiceText, 'aria-label': '要朗读的文字', placeholder: '写一段要读的文字(Qwen-TTS 最多 600 字;Sambert / DeepSeek 最多 1 万字;本地模型最多 2000 字)', onChange: (e) => setVoiceText(e.target.value) }),
2039
2386
  h('div', { className: 'dc-note', style: { marginTop: '4px', textAlign: 'right' } }, String(voiceText.trim().length) + ' 字'),
2040
2387
  h('div', { className: 'dc-row', style: { marginTop: '6px' } },
2041
2388
  playing
@@ -2045,6 +2392,7 @@ window.__ModuleLoader__.load({
2045
2392
  h(Btn, { icon: 'refresh', disabled: voiceText === '', onClick: () => setVoiceText('') }, '清空')),
2046
2393
  voiceNote ? h('div', { className: 'dc-note', style: { marginTop: '8px' }, role: 'status' }, voiceNote) : null,
2047
2394
  h('div', { className: 'dc-note', style: { marginTop: '10px' } },
2395
+ '· DeepSeek 官方语音:不用单独填 Key,直接共用 DSH 里那份 DeepSeek API Key(设置 → 模型);音色 stella / tide,语种自动识别。', h('br'),
2048
2396
  '· 阿里云百炼有两个预设:Qwen-TTS(qwen3-tts-flash / Cherry)和 Sambert(如 sambert-zhida-v1,模型名就是音色);Key 在百炼控制台创建。', h('br'),
2049
2397
  '· Sambert 需要先在百炼控制台把模型「开启」;工作空间报错时再填 Workspace ID。', h('br'),
2050
2398
  '· 生成后返回音频地址,宿主下载再交给浏览器播放(地址 24 小时过期,不存进对话)。', h('br'),
@@ -2138,7 +2486,7 @@ window.__ModuleLoader__.load({
2138
2486
  h('div', { className: 'dc-note', style: { lineHeight: '1.9' } },
2139
2487
  '局部人格来自 dsh-agent-md;B站 值班来自 dsh-bili-scroll;记忆来自 dsh-world;表情包来自 dsh-meme;视频分镜来自 dsh-video-storyboard(SAOS-3624);QQ 网关来自 @tencent-connect/dsh-qqbot;本地语音用通义 Qwen3-TTS(qwen-tts);QQ 语音编码用 silk-wasm。',
2140
2488
  h('br'), '本插件只做聚合与界面,各引擎的许可与版权归各自作者所有;本插件以 MIT 发布。'),
2141
- h('div', { className: 'dc-row', style: { marginTop: '12px' } }, h(Badge, null, 'v0.2.0'), h(Badge, null, 'MIT'))),
2489
+ h('div', { className: 'dc-row', style: { marginTop: '12px' } }, h(Badge, null, mem && mem.version ? 'v' + mem.version : 'v0.5.0'), h(Badge, null, 'MIT'))),
2142
2490
  h(Card, { title: '发布方式', sub: '装一次就好' },
2143
2491
  h('div', { className: 'dc-note', style: { lineHeight: '1.9' } },
2144
2492
  '发布到 npm 后:', h('br'), h('code', null, 'dsh plugin --profile web add dsh-chat-comprehension'), h('br'),