LessXi/dsh-fluid-width

插件Plugin 原生Native ⭐ 3 MIT cat_label.deepseek-harnesscat_label.deepseek-harness

让DSH Web GUI聊天显示区自适应屏幕宽度(将硬编码的748px覆盖为min(100%,2000px))

项目介绍Project Overview

dsh-fluid-width 是一个 DSH Web 端的 UI 插件,把聊天显示区根节点的 CSS 变量 --dsh-chat-content-width 从硬编码 748px 覆盖为 min(100%, 2000px),让聊天列、输入框和提问卡片随窗口宽度自适应,仅在 4K 及以上超宽屏保留 2000px 封顶。注入采用静态 !important 与 MutationObserver 监听 <style> 字面量两条路径,互为备份以应对 DSH 升级。适用于宽屏或超宽屏下中间留白过多、显示区过窄的日常浏览;旁路面板宽度不受影响。提醒:若 DSH 升级后根 class 变化且官方改用非 px 字面量,需手动更新 ROOT_CLASS 与字面量匹配规则。

dsh-fluid-width is a DSH Web UI plugin that overrides the chat content width CSS variable --dsh-chat-content-width from a hard-coded 748px to min(100%, 2000px), letting the chat column, input box, and question cards reflow with the window while capping only on ultra-wide 4K displays. It injects via a static !important override and a MutationObserver that rewrites the literal in any later <style>, so DSH upgrades do not break it. Use it on wide or ultra-wide screens where the center column looks too narrow with empty space on each side. Caveat: if a future DSH release renames the root class and uses non-px literals, update ROOT_CLASS and the literal pattern in lib/client.js.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add github:LessXi/dsh-fluid-width

LessXi/dsh-fluid-width 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-fluid-width

让 DeepSeek Harness(DSH)Web GUI 的聊天显示区自适应屏幕宽度

问题

DSH Web GUI 的聊天显示区宽度由 conversation 根节点的 CSS 变量 --dsh-chat-content-width 决定,出厂值硬编码为 748px——聊天列、输入框、 提问卡片全都消费这个变量。宽屏(如 2560×1600)下中间留大片空白,显示区 看起来非常窄。

本插件做什么

把该变量覆盖为 min(100%, 2000px):显示区随窗口流动,仅在超宽屏 (中心列 > 2000px,约 4K 显示器)保留封顶。

  • 聊天列 / 输入框 / 提问卡片自动跟随(它们都用同一个变量);
  • 侧边栏和右侧面板的宽度不受影响,可继续用分隔条拖拽。

两条注入路径互为保险:

  1. 静态覆盖:以当前版本的根 class 加 !important 声明,与官方样式的 加载顺序无关,立即生效;
  2. 版本无关重写:用 MutationObserver 监听 <head> 里注入的 <style>,凡出现 --dsh-chat-content-width:<px> 的字面量定义就原地 替换。DSH 升级后 class hash 变化时,路径 1 会失效,路径 2 仍能兜底。

安装

dsh plugin --profile web add github:LessXi/dsh-fluid-width
  • 本插件零依赖、无 prepare 构建脚本,Git 安装后无需任何构建步骤;
  • 安装完成后重启 dsh web(bundle 列表是启动时快照),再刷新页面。

验证:打开任意会话,缩小/拉宽浏览器窗口,聊天内容应随窗口伸缩。

自定义封顶

编辑 lib/client.js 顶部的常量:

const MAX_WIDTH_PX = 2000;
  • 改成 100%(连同上面的拼接)可完全流式,无任何封顶;
  • 改小(如 1200)可让内容重新收敛。

卸载

dsh plugin --profile web remove dsh-fluid-width

然后重启 dsh web

兼容性说明

  • 目标运行面:DSH Web GUI(dsh web,client 半区)。插件没有 host 职责。
  • 静态覆盖依赖当前版本 conversation 根节点的 CSS class (.hlCKXq_root);若某次 DSH 升级后该 class 变化且官方样式改用 非 px 字面量定义,两条路径都失效时,把 ROOT_CLASS 更新为新的 class 即可。
  • 本仓库按 DSH bundle 契约分发(dsh.bundle.patchcordis.patch.yml), 无需手动编辑 profile 的 cordis.patch.yml

开发

npm run check   # node --check 语法检查 + client 半区 vm smoke test

test/smoke.mjs 用最小 DOM shim 验证:模块注册、<style> 注入、 官方样式到达后的原地重写、dispose 清理。

License

MIT

上一个 Prev dsh-ultra-ui 下一个 Next DSH-mobile-sync