dsh-web-search-clinepass:用當前會話模型走網關原生搜索

前言

DeepSeek Harness(DSH)裏,Agent 通過 ctx.web 做聯網檢索時,默認會走內置供應商 @deepseek-ai/dsh-web-search-deepseek。該實現把模型固定爲 deepseek-v4-flash,且只對接 DeepSeek 官方的 Anthropic 兼容端點(https://api.deepseek.com/anthropic/v1),既不跟隨 Web UI 裏選中的模型,也只消耗 DeepSeek 官方額度。

若你已經在「模型」頁配置了 ClinePass 或其它 OpenAI 兼容網關,並希望聯網搜索與主對話共用同一路由、走網關自帶的供應商端搜索工具(例如 vercel:perplexity_search),就需要換一套 ctx.web 搜索供應商。下面介紹社區插件 dsh-web-search-clinepass(維護者 qujinting),它在 DSH 插件目錄中歸類爲「聯網工具」。

這是什麼

dsh-web-search-clinepass 是 DSH 插件:註冊 id 爲 clinepass 的 ctx.web 搜索供應商,替代內置的 DeepSeek 專用實現。搜索請求發在你配置的 OpenAI 兼容網關(如 ClinePass)上,不佔用 DeepSeek 官方 API key,也不把搜索回合塞進主對話上下文。

倉庫:https://github.com/qujinting/dsh-web-search-clinepass
目錄頁:https://www.skillhub.cn/plugins/qujinting/dsh-web-search-clinepass

當前 package 版本爲 0.3.2,許可證 MIT,運行環境要求 Node ≥ 22。

核心功能

插件安裝後會通過 bundle 裏的 cordis.patch.yml 做兩件事:把 web.searchProvider 設爲 clinepass,並插入組件 web-search-clinepass。僅「註冊新供應商」不夠——@deepseek-ai/dsh-base 默認把 searchProvider 寫死爲 deepseek-official,必須靠 patch 顯式切換。

一次搜索的大致流程如下:

  1. 從當前會話請求頭讀取這一步實際使用的 provider / model;
  2. 從 llm-pi-ai 配置解析該路由的 baseURL、apiKeyEnv(與 Web「模型」頁一致);
  3. 向 {baseURL}/chat/completions 發起 OpenAI 兼容請求,在 tools 中攜帶網關的供應商端搜索工具(默認可用 vercel:perplexity_search 等四種);
  4. 解析模型回答末尾 Sources: 段落,轉成 ctx.web 需要的來源列表。

內置 web-search-deepseek 仍會保留在系統中,只是不再是默認選中項;需要時可改回官方供應商。

安裝與啓用

按你使用的 dsh 版本選一條路徑。兩條路徑安裝的是同一個 bundle,差別在於誰改寫 profile 清單,以及裝完後配置入口在哪。安裝後需重啓 dsh 纔會生效(bundle 在啓動時組裝)。可用 dsh --profile web --dump-config 查看拼裝結果,不會啓動服務。

dsh 0.1.7 及以後(含 0.2.0,內置插件管理器)

從 npm 安裝(profile 名按你的環境替換,桌面版常用 desktop):

dsh plugin --profile web add dsh-web-search-clinepass

從本地 checkout 安裝(示例路徑來自 README,請換成你的目錄):

dsh plugin --profile web add file:D:/project/qujinting/dsh-plugin/web-search

補充說明(均來自 README):

  • 0.2.0-rc.2 起 dsh 命令隨桌面版打包;首次使用可在菜單欄點 「Manage dsh command」 加入 PATH。
  • 插件管理器會通過 pnpm 把包裝進 <DSH_HOME>/profiles/web/node_modules,並把包名追加到該 profile 的 dsh.profile.bundles(安裝前會備份 package.json)。
  • 配置入口:左側「插件」→ 已安裝 → dsh-web-search-clinepass → 組件行 web-search-clinepass 的「配置」。
  • 卸載:dsh plugin --profile web remove dsh-web-search-clinepass。

dsh 0.1.5

在插件目錄執行:

node install.mjs --profile web
dsh --profile web --dump-config
dsh web

install.mjs 會在 <DSH_HOME>/profiles/web/node_modules/dsh-web-search-clinepass 建立目錄聯接(junction)指向插件目錄,並更新 dsh.profile.bundles。開發時改倉庫代碼後刷新瀏覽器或重啓 host 即可,無需重複 add。配置在 設置 → 插件 → 插件配置,寫入 <DSH_HOME>/settings.yaml 的 web-search-clinepass: 段。卸載:node install.mjs --profile web --uninstall。

配置要點

設置命名空間:web-search-clinepass。多數場景無需改動:當會話模型走 clinepass 等 OpenAI 兼容網關時,端點與憑據從 llm-pi-ai.providers.<route> 自動解析(dsh 0.1.5 用 settings.get,0.1.7+ 用 settings.describe())。

字段 默認 說明
enabled true 關閉後供應商報告爲不可用
tool vercel:perplexity_search 網關側搜索工具 id,共四種可選
provider / model 空 非空則釘死路由,不再跟隨 UI
baseURL / api / apiKeyEnv / apiKey 空 非空則釘死端點與憑據
timeoutMs 90000 單次搜索超時
maxTokens 8192 搜索回合輸出上限;過小可能截斷末尾 Sources:
maxSources 10 返回來源上限

網關 Chat Completions 文檔列出的四種服務端搜索工具均可通過改 tool 切換;具體單價與必填參數見倉庫 README「工具選擇與花費」一節。

dsh 0.1.7+ 上曾出現的不可用錯誤

0.3.0 在 0.1.7 上若仍只用 settings.get 讀 llm-pi-ai,會導致 available() 恆爲 false,搜索報錯:configured web provider "clinepass" is registered but unavailable。0.3.1 起已改爲同時支持 describe()。若暫時無法升級插件,可在 profile 的 cordis.patch.yml 裏臨時釘死 web-search-clinepass 的 provider、model、baseURL、apiKeyEnv 等(見 README 示例);升到 0.3.1 後刪除該段即可恢復跟隨會話模型。

典型用法

  1. 在 DSH Web「模型」頁配置好 OpenAI 兼容網關(如 ClinePass)及環境變量(如 CLINEPASS_API_KEY)。
  2. 按上文命令把 dsh-web-search-clinepass 裝進對應 profile,重啓 dsh。
  3. 在 Agent 或支持 ctx.web 的流程中觸發聯網搜索;供應商應已爲 clinepass,搜索走當前會話模型與所選 tool。

無需單獨寫調用代碼:插件替換的是 Harness 內部的 web 搜索供應商,行爲與內置搜索工具鏈接一致,只是後端路由與計費賬戶換成你的網關。

適用場景與注意

適合誰: 已在 DSH 裏用 ClinePass、Vercel AI Gateway 等 OpenAI 兼容網關作爲主模型,希望聯網搜索與主對話同路由、用網關原生搜索工具,並避免固定 DeepSeek 官方 flash 模型的團隊或個人開發者。

權限與安全: 插件在 當前 dsh 進程權限 下運行,會讀取 llm-pi-ai 路由與環境變量中的 API 配置。安裝前應閱讀倉庫源碼與 MIT 許可證,確認符合你的合規要求。社區目錄 SkillHub 與 DeepSeek / 幻方無官方從屬關係;DSH 生態強調「一切皆插件」,本文介紹的是第三方維護的聯網工具類插件。

版本兼容: 同一 npm 包同時適配 dsh 0.1.5 與 0.1.7+(含 0.2.0-rc.2 行爲與 0.1.7 設置模型一致);設置落盤位置因版本不同而異(settings.yaml 與 profile 下 cordis.patch.yml),以 README 對照表爲準。

結尾

dsh-web-search-clinepass 把 ctx.web 從「DeepSeek 官方固定模型」改成「當前會話模型 + 網關供應商端搜索工具」,並通過 bundle patch 正確切換默認 searchProvider。若你正在 SkillHub 或 GitHub 上選型 DSH 聯網插件,可從這裏入手:

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

小夜