@oadank/dsh-input-tools 0.3.13 → 0.3.15

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
@@ -18,7 +18,9 @@
18
18
  | 语音气泡 | 用户/AI 语音消息可点击播放,尾部复制转写文本 |
19
19
 
20
20
  ### 图片
21
- - 输入框图片按钮上传 → **文本模型也能发图**:图片转本地路径,AI 自动调视觉 MCP 识图后回答
21
+ - 输入框图片按钮上传 → **文本模型也能发图**:图片转本地路径文本,AI 自动调视觉 MCP 识图后回答
22
+ - 附件存储自动生成**带扩展名的别名**(jpg/png/webp→png),zai-vision 等按扩展名校验的
23
+ 识图工具可直接读取(源码补丁包含,无需额外配置)
22
24
 
23
25
  ### 余额
24
26
  - 直连模型时输入框右侧实时显示余额(¥xx)
@@ -67,6 +69,7 @@ powershell -ExecutionPolicy Bypass -File scripts\setup-profile.ps1
67
69
  # Linux/macOS:
68
70
  bash scripts/setup-profile.sh
69
71
  pnpm install
72
+ pnpm run build:lib # ⚠️ 必须!全新 clone 无编译产物,跳过会报 Failed to resolve @deepseek-ai/dsh-client-web
70
73
  pnpm run build:web
71
74
  dsh --profile web
72
75
  ```
@@ -81,7 +84,9 @@ setup 脚本自动完成:装插件进 profile → 注册 → 检查 ffmpeg →
81
84
  ### 依赖
82
85
 
83
86
  - **ffmpeg**(语音转码必需):Windows `winget install ffmpeg`;Linux `sudo apt install ffmpeg`
84
- - 视觉 MCP(图片识图用):在 dsh 设置里配置 vision MCP 服务(如 visionqa / zai-vision)
87
+ - **视觉 MCP**(图片识图必需):在 dsh 设置里配置至少一个视觉 MCP 服务,AI 用它的工具识图:
88
+ - `zai-vision`(推荐,通用):`npx -y @z_ai/mcp-server`,配 `Z_AI_BASE_URL=http://localhost:11434/v1/`(本地 ollama 跑 qwen3-vl 等视觉模型),按扩展名校验(已由补丁解决)
89
+ - `visionqa`(本机自建服务)
85
90
 
86
91
  ## 配置
87
92
 
@@ -99,7 +104,7 @@ cd deepseek-harness
99
104
  git checkout 141eb6fef8 # 官方 dsh-0.1.0-rc.8 基线
100
105
  # 打补丁(脚本自动探测/输入源码位置):
101
106
  powershell -ExecutionPolicy Bypass -File <插件目录>\patches\apply-voice-patch.ps1
102
- pnpm install && pnpm run build:web && dsh --profile web
107
+ pnpm install && pnpm run build:lib && pnpm run build:web && dsh --profile web
103
108
  ```
104
109
 
105
110
  ### 方案 B:直接用整合版 fork(推荐)
@@ -108,7 +113,7 @@ pnpm install && pnpm run build:web && dsh --profile web
108
113
  git clone https://github.com/oadank/deepseek-harness.git
109
114
  cd deepseek-harness
110
115
  powershell -ExecutionPolicy Bypass -File scripts\setup-profile.ps1
111
- pnpm install && pnpm run build:web && dsh --profile web
116
+ pnpm install && pnpm run build:lib && pnpm run build:web && dsh --profile web
112
117
  ```
113
118
 
114
119
  > 补丁基线官方 rc.8(141eb6fef8),官方后续更新可能不兼容,请先 checkout 该基线再打。回滚:`git apply -R`。
package/lib/client.js CHANGED
@@ -586,6 +586,12 @@ window.__ModuleLoader__.load({
586
586
  const [vdSamples, setVdSamples] = useState([]); // VoiceDesign 官方示例音频(预生成)
587
587
  // [2026-08-21] 试听失败的错误提示(之前失败静默无反馈)
588
588
  const [previewErr, setPreviewErr] = useState(null);
589
+ // [2026-08-22] 试听失败浮动 Toast(fixed 顶部居中,醒目弹窗式,6 秒自动消失)
590
+ useEffect(() => {
591
+ if (previewErr === null) return;
592
+ const t = window.setTimeout(() => setPreviewErr(null), 6000);
593
+ return () => window.clearTimeout(t);
594
+ }, [previewErr]);
589
595
  // [2026-08-21] API Key 明文/密文切换(眼睛图标)
590
596
  const [showKeys, setShowKeys] = useState({});
591
597
  // [2026-08-21] 本地 TTS 一键安装命令
@@ -727,8 +733,18 @@ window.__ModuleLoader__.load({
727
733
  const audio = new Audio("data:" + d.mediaType + ";base64," + d.data);
728
734
  previewRef.current = audio;
729
735
  audio.onended = () => { if (previewTagRef.current === curTag) setPreviewing(null); };
730
- audio.onerror = () => { if (previewTagRef.current === curTag) setPreviewing(null); };
731
- audio.play().catch(() => { if (previewTagRef.current === curTag) setPreviewing(null); });
736
+ audio.onerror = () => {
737
+ if (previewTagRef.current === curTag) {
738
+ setPreviewing(null);
739
+ setPreviewErr("音频加载/播放失败(服务可能返回了无效音频)");
740
+ }
741
+ };
742
+ audio.play().catch(() => {
743
+ if (previewTagRef.current === curTag) {
744
+ setPreviewing(null);
745
+ setPreviewErr("音频加载/播放失败(服务可能返回了无效音频)");
746
+ }
747
+ });
732
748
  })
733
749
  .catch((e) => { if (previewTagRef.current === curTag) setPreviewing(null); setPreviewErr(String(e?.message ?? e)); });
734
750
  };
@@ -893,9 +909,16 @@ window.__ModuleLoader__.load({
893
909
  // 分区标题(语音图标已移到各服务商卡片前)
894
910
  h("div", { style: { display: "flex", alignItems: "center", gap: "8px", fontSize: "15px", fontWeight: 700, color: "var(--dsw-alias-label-primary,#e6e9ef)" } },
895
911
  "语音服务"),
896
- // [2026-08-21] 试听失败错误横幅(原来静默无提示)
897
- previewErr !== null ? h("div", { style: { fontSize: "12.5px", lineHeight: "1.6", color: "#e5484d", border: "1px solid rgba(229,72,77,.4)", borderRadius: "8px", padding: "8px 10px", background: "rgba(229,72,77,.08)", whiteSpace: "pre-wrap" } },
898
- "试听失败:" + previewErr) : null,
912
+ // [2026-08-21] 试听失败错误提示;[2026-08-22] 改为 fixed 顶部弹窗 Toast(醒目,6s 自动消失)
913
+ previewErr !== null ? h("div", {
914
+ style: {
915
+ position: "fixed", top: "24px", left: "50%", transform: "translateX(-50%)", zIndex: 9999,
916
+ background: "rgba(229,72,77,.95)", color: "#fff", borderRadius: "10px",
917
+ padding: "10px 18px", fontSize: "13px", lineHeight: "1.5",
918
+ boxShadow: "0 6px 24px rgba(0,0,0,.45)", maxWidth: "440px", whiteSpace: "pre-wrap",
919
+ pointerEvents: "none",
920
+ },
921
+ }, "试听失败:" + previewErr) : null,
899
922
  // [2026-08-21] 语音能力状态面板(安装即用 vs dsh 原生契约支持)
900
923
  caps !== null ? h("div", { style: { border: "1px solid var(--dsw-alias-border-l1,#333a45)", borderRadius: "10px", padding: "10px 12px", display: "flex", flexDirection: "column", gap: "6px", background: "rgba(128,128,128,.05)", fontSize: "12.5px", lineHeight: "1.5" } },
901
924
  h("div", { style: { fontSize: "12px", fontWeight: 600, opacity: .8 } }, "语音能力"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oadank/dsh-input-tools",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "lib/index.js",