DSH web composer 默认仅支持图片(PNG/JPG/WebP/GIF)的粘贴和拖拽。在需要处理表格或文档(如 .xlsx, .csv, .pdf)时,通常需要先上传到外部存储,再复制链接。dsh-table-attach 插件填补了这一空白,允许开发者直接在编辑器中操作非图片文件。
这是一个客户端插件,由维护者 yybukn 开发。它拦截浏览器的粘贴和拖拽事件,将文件保存到当前会话的工作区,并自动生成引用链接。
Core Features¶
- Input Methods: Supports drag and drop and pasting.
- File Types: Supports any non-image file (xlsx, csv, pdf, zip, etc.).
- Workspace Storage: Files are saved to the
<workspace>/attachments/directory, and same-name files automatically receive-1,-2, etc. as suffixes. - Reference Generation: On success, an
@referenceis automatically inserted (for example,@"attachments/report.xlsx"), which the agent can read directly. - Security Mechanisms: By default, file size is limited to 50 MiB, executable file extensions (.exe, .dll, .sh, .js, etc.) are blocked, and path traversal attacks are prevented.
- Compatibility: Existing image handling logic remains unchanged, and Chinese/English internationalization is supported.
Install and Enable¶
Run the following command in the terminal to install the plugin:
dsh plugin add github:yybukn/dsh-table-attach
Typical Usage¶
- Open any session (which provides a workspace).
- Drag .xlsx / .csv / .pdf / .zip files into the editor, or copy a file and paste it using the keyboard shortcut.
- After the file is saved successfully, an
@referenceappears in the editor. - Send the message, and the agent can read the referenced file content.
Use Cases and Notes¶
- Use Cases: Scenarios where you need to pass data files, spreadsheets, or documents to an agent.
- Notes:
- File size is limited to 50 MiB.
- Executable file extensions are blocked.
- File names are sanitized to prevent path traversal.
- Copied Excel cell text is treated as plain text and is not converted into a file.
With this plugin, you can pass files to an agent without leaving the editor, simplifying your workflow. Related links: GitHub | Plugin Directory