- Home
- Plugins
- UI Enhancements
- dsh-long-message-fold
dsh-long-message-fold
nuscior/dsh-long-message-fold
Folds long user messages in chat to a fixed height and adds a small chevron in the bubble's bottom-right corner to expand or collapse them. Display only, the model still receives the full text.
Install
dsh plugin --profile web add github:nuscior/dsh-long-message-foldREADME
dsh-long-message-fold · 长消息折叠
DeepSeek Harness 插件:对话里过长的用户消息自动折叠成固定高度,气泡右下角出现一个小箭头,点一下展开全文,再点收起。
只改显示。模型收到的仍然是完整原文,上下文、token 数、导出记录都不受影响。
行为
- 可见字符数达到 600 才开始折叠,短消息完全不受影响(阈值写死在
client.js的MIN_CHARS)。 - 折叠后高度限制为 320px,约十到十二行正文(
CLAMP_PX)。 - 箭头绘制在气泡右下角,跟随气泡流式增长重新定位;有
aria-label和aria-expanded,键盘可操作。 - 中英文文案跟随宿主语言;拿不到 locale 时回退中文。
安装
DSH 0.2.2-rc.1 及以上。
-
插件市场:在 插件 → 插件市场 里搜索
dsh-long-message-fold。 -
发现(索引源):添加本项目所在的索引源,再点安装。
-
手动:在 profile 目录执行
dsh plugin --profile <profile> add github:nuscior/dsh-long-message-fold
装完在 插件 → 已安装 里确认出现「长消息折叠」,然后开新会话生效。
兼容性
- 在 DSH 0.2.2-rc.5(Desktop,profile
desktop)上验证。 - 包内声明
engines.dsh: ">=0.2.2-rc.1";更早的版本未测试,安装时会被拦下。 - 纯 Client 模块,无 Node 依赖、无构建脚本、无网络请求。
实现方式
Host 半部分是空的(index.js 只有 export function apply() {}),渲染全在 Client 模块:
- 通过
ctx.slots.inject('conversation.chat.user.before')注册到每条用户消息前的插槽,只对owner.kind === 'user'的行渲染。 - 用
MutationObserver+ResizeObserver找到同一行里的[data-message-bubble],给它加data-ltf-collapsed属性,CSS 靠这个属性做max-height截断,不替换、不改写宿主渲染出来的 DOM 结构。 - 卸载时移除属性、移除注入的
<style>、恢复被临时设成position: relative的行。
已知限制
- 依赖宿主把消息气泡标记为
[data-message-bubble]。DSH 大版本改动这层结构后可能失效,届时需要跟着更新。 - 同时修改消息气泡的其它插件理论上可能互相干扰(都在这层 DOM 上做标记)。
- 折叠高度和字符阈值目前不可配置,改的话在
client.js顶部两个常量。
License
MIT,见 LICENSE。
English
A DeepSeek Harness plugin that collapses long user messages in chat to a fixed height and adds a small chevron in the bubble's bottom-right corner to expand or collapse them.
Display only — the model still receives the whole message, and nothing about the stored transcript changes.
- Folds only when the visible text reaches 600 characters; collapsed height is 320px.
- Renders through the
conversation.chat.user.beforeslot and tags the shipped[data-message-bubble]element withdata-ltf-collapsed; the host's DOM structure is not replaced. - Client-only: no Node dependencies, no build step, no network access.
- Verified on DSH
0.2.2-rc.5;engines.dshis>=0.2.2-rc.1.
Install from the plugin market, from an index source, or with dsh plugin --profile <profile> add github:nuscior/dsh-long-message-fold.
Related plugins
dsh-web (dsh-task-board)
zhu1090093659/dsh-web
dsh-web (dsh-web-all)
zhu1090093659/dsh-web
dsh-TUI
ccch1mneyyy/dsh-tui
dsh-web-ui (dsh-task-board)
zhu1090093659/dsh-web-ui