Bundle
dsh-inline-images
对话内联图片/视频:LLM 回复中输出的本地图片路径直接在消息正文内渲染为图片,视频以可点击播放链接呈现。支持图片URL自动修正与刷新持久化,兼容反向代理部署。
- Source
- Asher-2000
- License
- MIT
- Updated
- Updated 2 days ago
Readme
# dsh-inline-images 对话内联图片/视频 让 DeepSeek Harness 的对话**直接显示本地图片和视频**:LLM 回复中输出的本地图片路径(截图、生成图等)会在**消息正文里**自动渲染成图片 —— 不再只是一串看不到的路径文本。视频文件以**可点击播放链接**形式呈现(浏览器原生播放 MP4)。 > 本仓库基于 [3403473060/dsh-inline-images](https://github.com/3403473060/dsh-inline-images) 修复增强版,修复了原版在 DSH 0.1.x 上的多个兼容性问题。 ## 功能 - **消息正文内联渲染**:扫描助手回复文本中的本地图片路径(`C:\...` 盘符、UNC、POSIX、``、反引号包裹),把真实存在的图片改写成可访问 URL,产品 MarkdownText 直接在正文渲染。 - **图片+视频支持**:png / jpg / jpeg / webp / gif / svg / avif / bmp / ico 图片直接内联;mp4 / webm / mov 视频以可点击播放链接呈现。 - **URL 自动修正**:消息中已存在的内联图片/视频 URL(带过期 token)会在流式输出时自动替换为当前进程有效 token,刷新页面后仍可访问。 - **流式+持久化双通道改写**:同时改写 `text-delta`(保证保存的消息也是修正版,刷新不失效)与 `block-end`(保证流式实时显示)。 - **点击放大灯箱**:点击正文图片 → 全屏大图;点背景或按 Esc 关闭。 - **可调尺寸**:默认 480×320,可通过设置或修改默认值调整(64–2400 px)。 - **安静降级**:不存在的路径、示例/占位路径(路径、xx、... 等)静默跳过,不影响对话。 ## 与原版的修复差异 1. **inject 修复**:补全 `webServer` / `fs` / `attachments` 注入,修复「cannot get property without inject」导致的路由不注册。 2. **URL 完整协议**:改版原版硬编码 `http://127.0.0.1:<port>`(用户浏览器指向本机),改用**完整公网地址**,兼容反向代理(Nginx)部署。 3. **前端 T4 协议解析兼容**:带完整 `https://` 协议,修复 MarkdownText 拒绝无协议 URL 导致图片空白的问题。 4. **text-delta 改写**:保证保存的消息也是修正版(原版只改 block-end,刷新页面后图片消失)。 5. **视频支持**:扩展 mediaTypeFor 支持 mp4 / webm / mov,视频文件可经插件路由服务。 ## 构建与安装 ```sh pnpm install pnpm run build dsh plugin --profile web add ./dsh-inline-images ``` ## 配置 若你的 DSH Web 通过反向代理/自定义域名访问,请修改 `src/index.ts` 中的 `https://<你的地址>` 前缀为实际地址后重新构建。 ## 工作原理 1. `llm/stream` 包装器扫描文本块,`fs.stat` 确认文件存在。 2. 按原始区间把路径替换为 ``。 3. `text-delta` 通道同步改写,保证保存的消息含有效 token(刷新不失效)。 4. webServer 路由实时读取文件字节返回;token 每次激活随机生成。 ## 许可证 MIT
Install
dsh plugin --profile web add github:Asher-2000/dsh-inline-images#2da1a5120c8a3159b2b1ddb2bf75424ce01886b6
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-inline-images from the hub
- This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.