Skip to main content
F

dsh-model-reorder

foru-hue/dsh-model-reorder

Drag-to-reorder the provider cards on the Models settings page with live drag preview; the order persists and the model pickers regroup after a restart.

Install

dsh plugin --profile web add github:foru-hue/dsh-model-reorder

README

dsh-model-reorder

English | 中文

一个 DeepSeek Harness 插件:在设置页「模型」中自由调整供应商卡片的顺序,并让模型选择器跟上你的排列。

icon

功能

  • 每张已配置的供应商卡片在名称同一行的左侧出现 ☰ 拖拽手柄;
  • 按住 ☰ 拖动,整卡变成拖影、其他卡片实时让位;松手即保存,拖出列表(或按 Esc)自动回滚;
  • 键盘党:聚焦 ☰ 后按 ↑/↓ 方向键同样可以移动;
  • 顺序保存在插件自身配置(volatile 字段),刷新、重启都不会丢;
  • 拖完之后,插件会把 llm-pi-ai 的路由键序同步写入用户配置层——选择模型的菜单与 /model 弹窗在下次重启后按你的顺序分组(pi-ai 适配器的既有设计:键序变化不触发运行时重建,详见下方「已知限制」);
  • 有自定义顺序时,列表底部出现「恢复默认排序」;
  • 每次同步成功后,模型页底部会提示「选择模型的分组顺序将在下次重启后变为当前顺序」,10 秒后自动消失。

安装

方式一:本地目录安装(推荐)

git clone https://github.com/Foru-hue/dsh-model-reorder.git

然后打开 DSH → 设置 → 内置插件 → 插件列表 → 添加插件(Add plugin),选择克隆出的 dsh-model-reorder 目录,重启 DSH 即可。

方式二:git 依赖(进阶)

在 profile 的 package.json 中加入依赖:

"dsh-model-reorder": "github:Foru-hue/dsh-model-reorder"

再在 profile 的 cordis.patch.yml 中插入一行:

- insert:
    - id: model-reorder
      name: dsh-model-reorder

重启 DSH。

使用

  1. 打开 设置 → 模型;
  2. 按住卡片名称左侧的 ☰ 拖动到想要的位置(悬停到某张卡片的上半 = 插到它前面,下半 = 插到它后面);
  3. 松手保存;想回到默认顺序,点列表底部的「恢复默认排序」。

已知限制

  • 设置页是即时生效的视觉重排;模型选择器的分组要等下次重启 DSH 才跟上(pi-ai 适配器把键序变化设计为「无关事实」,运行中不重建路由);
  • 选择器里 DeepSeek 账号 / DeepSeek 永远置顶(客户端内置规则),CodeArts 等自带适配器的家族分组位置由其适配器注册顺序决定,插件无法移动;
  • 设置文档不可写时(只读部署)控件自动禁用;
  • 新添加的供应商会出现在列表末尾,拖一次即纳入排序。

配置

插件只有 volatile 字段 order(供应商路由 id 数组)。行 id 固定为 model-reorder,可通过 cordis.patch.yml 中该行的 config.order 手工调整:

- id: model-reorder
  name: dsh-model-reorder
  config:
    order:
      - chat-anywhere
      - qwen-token-plan-cn

不写或留空 = 默认目录顺序。

实现说明(给维护者)

  • 客户端注册进模型页的两个官方插槽:settings.models.provider-card(按供应商命名空间 keyed,运行时从 llm/listConfigurableProviders 动态发现并逐家族注册)与 settings.models.footer;
  • 行重排 = 给每行 <li> 写 CSS style.order(行容器本就是 flex column),不触碰宿主 DOM 结构与 React 树;
  • 交互为原生 HTML5 DnD,dragover/drop 委托到行容器,上下半区决定 before/after;
  • 逻辑测试见仓库外开发目录的 tools/test-model-reorder.js(window.__ModuleLoader__ 桩 + 假 ctx,覆盖移动/拖拽/边界/取消/键序同步)。

致谢

vendor/ 内含 @deepseek-ai/schemastery 与 @deepseek-ai/cosmokit 的构建副本(MIT,见 vendor/*-LICENSE):本地链接安装的包从自身目录解析依赖,因此随包分发。

License

MIT


English

A DeepSeek Harness plugin that reorders the provider cards on the Models settings page with drag-and-drop, and keeps the model pickers in the same order.

  • Drag the ☰ handle beside each provider name; rows preview the landing position live; release saves, dropping outside reverts.
  • Arrow keys work when the handle is focused; a Restore default order control appears while a custom order is stored.
  • The order persists in the plugin's volatile config; after every change the llm-pi-ai route keys are re-sorted in the user settings layer, so the composer model menu and /model popup regroup accordingly at the next DSH start (the pi-ai adapter deliberately ignores key-order-only changes at runtime).
  • Known limits: DeepSeek Account/DeepSeek stay first in the pickers; adapter families with their own route registration (e.g. CodeArts plugins) keep their adapter's position.

Install: clone this repository, then DSH → Settings → Plugins → Add plugin → pick the cloned dsh-model-reorder directory, restart DSH. See the Chinese section above for details.

Related plugins