wqx-txdsyl/dsh-ds-attach
chat.deepseek.com-style attachments for DeepSeek Harness: paperclip upload, DS-style file cards, drag-drop, text extraction (PDF/DOCX/XLSX/TXT), attachment cards in transcript
Listed
1
Ui
Bundle verified
What it does
**DeepSeek Chat (chat.deepseek.com) same-style attachments**: paperclip upload button, 240×64 DS-style file cards with official colored doc icons (PDF/DOCX/XLSX/PPT/IMG extracted from the DS frontend bundle), drag-and-drop, text extraction (PDF/DOCX/XLSX/TXT) injected into the message, and real attachment cards rendered in the transcript (custom user renderer) with the model reading full content.
Best for
- DSH chat users who want DeepSeek Chat-style attachment selection, drag-and-drop, file cards, and transcript rendering.
- Conversations where PDF, DOCX, XLSX, TXT, Markdown, or code contents should be extracted and supplied to the model.
- Image attachments that should continue through DSH's native vision pipeline.
- Scanned-PDF workflows that can provide the configured vision-service credential for OCR.
Not ideal for
- Workflows that need binary document fidelity rather than extracted text supplied to the model.
- Scanned-PDF OCR without DEEPEYE_API_KEY or BOOK_OCR_API_KEY; documents without a text layer will yield no extracted text.
- Documents where content beyond the configurable character budget must always reach the model without truncation.
- Users who do not want a custom renderer to take over all user-message rendering.
README
dsh-ds-attach
DeepSeek Chat(chat.deepseek.com)同款附件渲染样式 —— 上传按钮、文件卡片、图标、消息内附件展示,全部一比一复刻官方前端(图标与样式直接提取自 chat.deepseek.com 前端 bundle)。DeepSeek Harness 插件(dual-face bundle)。
功能(与 chat.deepseek.com 一致)
-
回形针上传按钮:输入框工具栏左侧,DSH 官方
IconPaperclipOutline16图标,点击选择任意文档/图片(多选),tooltip「上传文档或图片(仅文本提取)」 - 拖拽上传:非图片文件拖到页面任意位置即上传
- DS 风格文件卡片:240×64px、圆角 16px、1px 边框——左侧 28×28 官方彩色文档图标(PDF 红/表格绿/图片紫/PPT 橙/文本蓝,从 chat.deepseek.com 前端 bundle 扒出的精确 SVG)、文件名(14px/500)+ 状态副行(12px)、右上角 18px 圆形删除按钮,多文件横排
- 状态流转:上传中 → 解析中 → 完成 / 未提取到文本 / 上传失败(与官方「Uploading/Parsing/No text extracted」对应)
-
文本提取(与官方一致,服务端解析):
- PDF → pdfjs-dist 提取文本
- DOCX → mammoth 提取文本
- XLSX → xlsx 读取单元格(前 5 个 sheet)
- TXT/MD/代码 → 直接读文本
- 按 token 预算截断(默认 15 万字符,
DS_ATTACH_MAX_CHARS可调;在段落边界截断,不切断句子)
- 发送即清空:卡片随消息发送后,输入框附件区自动清空(DS chat 行为)
- 消息里显示卡片:自定义 user 节点渲染器(priority -1 接管),对话流中附件显示为真正的文件卡片(文件名 + 彩色图标 + 大小,点击展开全文),而非原始长文本;普通消息保持原样浅蓝气泡
- 图片分流:图片自动走 DSH 原生视觉附件管线
-
扫描版 PDF OCR(与官方一致):PDF 无文字层时,自动渲染每页为图片并调用视觉模型识别文字(智谱 glm-4v-flash,走
DEEPEYE_API_KEY/BOOK_OCR_API_KEY环境变量) -
模型可读:提取文本随消息结构化注入(
【附件】名\n【文件大小】N\n【文件内容】…【文件内容结束】),模型读到完整内容
安装
# 从 GitHub
dsh plugin --profile web add github:wqx-txdsyl/dsh-ds-attach
# 或本地路径
dsh plugin --profile web add <本目录绝对路径>
重启 dsh web 生效。
依赖
pdfjs-dist / mammoth / xlsx(纯 JS,无原生编译)。安装插件时若提示 allowBuilds,按提示添加即可(这些库无编译脚本,通常无需)。
说明
-
host 半:
/ds-attach/upload(base64 接收 + 落盘 + 文本提取 + 扫描 PDF OCR)、/ds-attach/file(回读)、/ds-attach/meta(元信息) - client 半:回形针按钮 + 拖拽 + 卡片 UI + user 消息渲染器
- 文件存于
$DSH_HOME/ds-attach/<sessionId>/,会话隔离,路径穿越防护 - 扫描版 PDF(无文字层):自动渲染页图 → 视觉模型 OCR,依赖
DEEPEYE_API_KEY或BOOK_OCR_API_KEY环境变量(智谱 glm-4v-flash,baseUrl 默认https://open.bigmodel.cn/api/paas/v4);未配置 key 时才显示「未提取到文本」- 文字层优先(快路径,与官方一致):PDF 只要带文字层(哪怕内嵌的劣质 OCR 层)就秒出文字层文本,不触发慢速视觉 OCR;仅纯扫描 PDF(无文字层)自动 OCR
- 想要更清晰的视觉 OCR 文本(劣质文字层的书):
DS_ATTACH_FORCE_OCR=1强制 OCR(注意:整本书逐页识别,可能需数分钟);DS_ATTACH_TEXTLAYER_ONLY=1禁用 OCR - OCR 可调环境变量:
BOOK_OCR_SCALE(渲染分辨率倍数,默认 3,越高字形越清晰)、BOOK_OCR_CONCURRENCY(并行页数,默认 2)、BOOK_OCR_CROP_TOP/BOOK_OCR_CROP_BOTTOM(OCR 前裁剪页眉页脚区域,页面高度比例,默认 0.07/0.08,设 0 关闭)、BOOK_OCR_MODEL/BOOK_OCR_BASE_URL/BOOK_OCR_MAX_TOKENS/BOOK_OCR_TIMEOUT_MS
- user 渲染器接管所有用户消息渲染(与产品样式一致),保证普通消息显示不变
License
MIT
Frequently Asked QuestionsFAQ
Use the verified command dsh plugin --profile default add github:wqx-txdsyl/dsh-ds-attach in a DSH-enabled shell. The command resolves the public package metadata and keeps the plugin attached to the catalog identity shown on this page.
Compatibility follows the bundle and profile status shown above. If a profile is not detected, keep the plugin disabled there and check the repository documentation before enabling it in production.
The GitHub link and activity metadata are the source of truth for releases and maintenance. Revisit this page after a new release to confirm the catalog has observed the latest version.