dsh-im
xmanrui
通过扫码或机器人凭据把IM机器人接入DeepSeek Harness(支持飞书、微信、钉钉、企业微信、QQ、Slack、Telegram、Discord和WhatsApp)。 Connect IM bots to DeepSeek Harness via QR code or credentials (9 channels).
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:2275803244-cpu/dsh-model-switcher
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness Web GUI 的一键服务商/模型切换客户端插件。
会话标题栏加一个滑块按钮:弹出所有已配置的服务商和它们的模型,点一下即切换,不用再进设置一个个配。
llm.providers + settings.describe + credentials.describe 检查每个服务商的 key 状态,没有 key 的服务商不显示(补 key 后自动出现)/model 命令、composer 模型席位共享同一份状态,任一入口切换其它入口同步)conversation.session.header.actions(order=25)modelDirectories(ctx.modelDirectories.directoryFor(sessionId))react.useSyncExternalStore 订阅 directory.store(uSES 兼容 SnapshotStore)directory.select({ provider, model })——与 /model 弹窗和 composer 模型席位同一个控制器,Host 是唯一事实源本插件同时支持 CLI / Web 版(web profile)与 桌面版(desktop profile)。
推荐用 DSH 自带 CLI 安装:dsh plugin add 会把依赖和 dsh.profile.bundles 一起写进该 profile 的 package.json,不需要再手工改 cordis.patch.yml。
# CLI / Web 版
dsh plugin --profile web add github:2275803244-cpu/dsh-model-switcher
# 桌面版(桌面应用自带 CLI,位于 <安装目录>\resources\runtime\cli\bin\dsh.cmd)
& "<桌面版安装目录>\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add github:2275803244-cpu/dsh-model-switcher
装完重启对应程序,会话标题栏出现滑块按钮。
pnpm --dir "$HOME\.dsh\profiles\web" add github:2275803244-cpu/dsh-model-switcher
cordis.patch.yml 追加:
- insert:
- id: ui-model-switcher
name: 'dsh-client-ui-model-switcher'
重启 dsh web。
服务商目录来自 设置 → 模型 里已配置的适配器;要增加新服务商(如本地 Ollama),先在模型设置中配置好,一键切换里就会出现。
DSH 桌面版(@deepseek-ai/dsh-desktop-runtime 0.2.0-rc.2)启用了独立的 desktop profile,插件默认不在其中。本版本确认插件在桌面版下无需改动代码即可工作(纯浏览器侧 bundle,只依赖 react / react/jsx-runtime,不耦合 DSH 内部包):
| 核对项 | 桌面版 0.2.0-rc.2 实测结果 |
|---|---|
槽位 conversation.session.header.actions |
✅ 仍由 dsh-client-ui-conversation 渲染 |
槽位 conversation.input.right |
✅ 仍存在 |
服务 modelDirectories / slots / sessions / remote / connection |
✅ 均在 |
modelDirectories.select({ provider, model }) |
✅ 签名一致(async select(selection)) |
| 组合树 | ✅ 装入 desktop profile 后可见 ui-model-switcher 行,无报错 |
校验方式:桌面版核心代码打包在
app.asar内,直接解包比对运行时实际代码;desktopprofile 只能由桌面应用启动,组合树校验用一份副本 profile 跑--dump-config。
针对 DSH 0.1.2-rc.1 的 Remote 契约与原生选择器行为修正了以下问题(test/client.test.cjs 覆盖):
| # | 问题 | 修复 |
|---|---|---|
| 1 | usableProviders 调用不存在的 API(llm.providers({})、settings.describe({})、credentials.describe({refs})),异常被吞掉后返回 null,"只显示配好 key 的服务商" 实际从未生效 |
改用 llm.listProviders() + llm.listConfigurableProviders() + settings.describe() + credentials.describe(refs: string[]),并用注册表判定路由是否 active |
| 2 | 取 API 面用 connection.api,该属性在 ConnectionHandle 上不存在(当前实现是 ctx.remote),导致上面第 1 条必然失败 |
改用 ctx.remote(inject 增加 remote),保留 connection.api 兜底 |
| 3 | usableMap 跨开关持久,补 key 后重开面板仍被旧的过滤结果挡住 |
每次打开重置并重新拉取,异步结果用 live 标记防竞态 |
| 4 | 过滤后若一个服务商都不剩,面板空白无法切换 | 过滤结果为空时回退到完整列表 |
| 5 | 切换模型只提交 {provider, model},丢掉推理强度:与 /model 弹窗/composer 席位行为不一致,原生席位会带 reasoning.defaultEffort,重选当前模型时保留用户已选强度 |
新增 selectionFor(),与原生 selectionOf() 同语义 |
| 6 | 两个触发器都显示原始模型 id(deepseek-v4.1-flash-expires-on-0910),且不显示推理强度 |
新增 modelName()/effortLabel(),显示模型名 + · 强度 |
| 7 | 面板打开时点触发器不会关闭 | 触发器改为切换语义 |
| 8 | rootRef.current 可能为 null 时的 contains() 抛错 |
加空值保护 |
测试:
node test/client.test.cjs # 10 项断言,无需安装依赖
pnpm --dir "$HOME\.dsh\profiles\web" remove dsh-client-ui-model-switcher
# 删掉 cordis.patch.yml 的 ui-model-switcher 行,重启
欢迎提交 PR!请先阅读 CONTRIBUTING.md。
node test/client.test.cjs(提交前必须全绿)ModelDirectory / ModelDirectoryResolver:dsh-client-ui-model-selection/lib/types/client/service.d.ts、directory.d.tsdsh-client-ui-model-selection/lib/types/client/directory.d.tsdsh-host-apiproxy/lib/types/api/sessions.d.ts(ModelSelection / ModelProviderGroup / SessionModels)CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: chat。