READMESource: main@a7e995a8
dsh-plugin-file-download
为 DeepSeek Harness (DSH) Web 对话中呈现的文件添加下载按钮,点击即可将生成的文件保存到本地,无需再登录服务器翻找文件路径。
A download button for files presented in DeepSeek Harness (DSH) web conversations — click to save generated files locally, instead of digging through server paths.
功能 / Features
- 在对话中的文件卡片(deliverables 卡片及 review 文件卡片)上添加「下载 / Download」按钮
- 流式传输(1 MiB 分块),支持大文件
- 文件名完整保留(支持中文,
Content-DispositionRFC 5987 编码) - 与 DSH 原生主题一致的幽灵按钮样式,自动适配亮/暗主题
- 中英文界面(跟随 DSH 语言设置:下载 / Download)
- 鉴权:复用当前会话 Cookie,仅限本人会话中呈现过的文件
工作原理 / How it works
- Host 侧 (
index.js):注册GET /plugins/file-download路由。通过会话日志 (sessionQuery.readEvent) 把sessionId + seq + index解析为工作区文件路径,鉴权后以附件形式流式返回文件内容。 - Client 侧 (
client.js):注入deliverables.file.actions与deliverables.review.file.actions插槽,在文件卡片上渲染下载按钮。
安装 / Install
在你的 DSH profile 中安装(本地路径或 GitHub 仓库均可):
# 从本地路径安装
dsh plugin install file:/path/to/dsh-plugin-file-download
# 或添加到 profile 依赖(pnpm link / git 依赖)
安装后在对话里让模型生成/呈现文件(present 工具),文件卡片上即出现下载按钮。
从源码运行 / Development
无需构建步骤,纯 JavaScript(无依赖):
git clone https://github.com/CyberHunter775/dsh-plugin-file-download.git
index.js— host 插件(服务端路由)client.js— web 客户端插件(UI 按钮)cordis.patch.yml— Cordis 插件注册locale/zh.json、locale/en.json— 界面文案
No comments yet. Be the first to write one.