Merge pull request #8707 from deepseek-harness/feat/web-search-deepseek-model-default
feat(web): default DeepSeek model conversations to Messages search
This commit is contained in:
1 parent
6368d91027
commit
f47a0a2b52
53 files changed
+537
-214
No files matched your search
+12
-12
@@ -9,8 +9,8 @@
|
||||
en: 3f5dacf86015cebb
|
||||
zh: cf0d5bceb9941554
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/decision:
|
||||
en: 0682ebef17f6a5e7
|
||||
zh: 6ea399459262eb0c
|
||||
en: e243a7d535022011
|
||||
zh: fd1dd8634b9603cf
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/decision/registered-providers-are-observable-availability-is-not:
|
||||
en: 38ce796dea91fa35
|
||||
zh: d312a9cd29fd5cc9
|
||||
@@ -21,17 +21,17 @@
|
||||
en: 15f6fb26c8605260
|
||||
zh: 93467641a8ff0aad
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/decision/defaults-and-stored-selections:
|
||||
en: 5fcd3319fbceed1d
|
||||
zh: 20771646b9c36fa6
|
||||
en: eba9b7ca32681406
|
||||
zh: 7ab74b8054bea720
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/decision/legacy-messages-search:
|
||||
en: 2c7c84f8fa1e8745
|
||||
zh: 5d0244e4f17ba12a
|
||||
en: 8f3180e3dd327bfc
|
||||
zh: 012b2ebe8d2f5aac
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/alternatives-considered:
|
||||
en: 2ec7f019ec3ce309
|
||||
zh: a6a5a8db1f1dd682
|
||||
en: d72b359bb9ff9666
|
||||
zh: 33c9a12488a81826
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/consequences:
|
||||
en: ea4d3f05e8be197a
|
||||
zh: 81faeb3edf122869
|
||||
en: fe529b10fcbb2d0a
|
||||
zh: ed3eabbce90ddb92
|
||||
/agent-note-web-provider-selection-independent-menus-over-registered-providers/verification:
|
||||
en: 0db673b16e4aeda3
|
||||
zh: 3b086edecebdc5b5
|
||||
en: a8f08dc7ec5845fd
|
||||
zh: a491c4a93db41c3f
|
||||
@@ -10,7 +10,7 @@ The web service selects search and fetch providers through two independent field
|
||||
|
||||
## Decision
|
||||
|
||||
Users choose search and fetch providers independently from the Host's registered provider lists. The shipped composition selects the Search API for search and local HTTP fetch for fetch, and the DeepSeek Search and Fetch APIs follow the conversation's DeepSeek credential.
|
||||
Users choose search and fetch providers independently from the Host's registered provider lists. The shipped composition fixes no search provider, so search follows the conversation's model route, and selects local HTTP fetch for fetch; the DeepSeek Search and Fetch APIs follow the conversation's DeepSeek credential.
|
||||
|
||||
### Registered providers are observable; availability is not
|
||||
|
||||
@@ -38,18 +38,24 @@ The [credential helpers](../../../../packages/llm/llm-deepseek/src/credential.ts
|
||||
|
||||
### Defaults and stored selections
|
||||
|
||||
The [base composition](../../../../packages/bundle/base/cordis.patch.yml) sets `searchProvider: deepseek-search-api` and `fetchProvider: http`. Search defaults to the Search API because it returns sources without Harness starting an auxiliary model request. Fetch defaults to local HTTP fetch because it has no per-request API charge, applies Harness's own URL validation and resource limits, and reaches intranet and local addresses. The Fetch API remains one menu choice away.
|
||||
The [base composition](../../../../packages/bundle/base/cordis.patch.yml) sets `fetchProvider: http` and no `searchProvider`. With no search provider configured, `dsh-web` prefers one registered, usable provider per provider route of the model request a search serves: Messages search (`deepseek-official`) on the `deepseek-official` and `deepseek-account` model routes, because DeepSeek makes no per-search charge for the server-side search tool a DeepSeek model request declares, and the Search API (`deepseek-search-api`) on every other route and outside a model request, because it returns sources without an auxiliary model request to a provider the conversation does not use. `dsh-tool-web` puts the route of the calling Session's latest model request into each search request, and `searchReady()` selects with the route of the step being prepared, so readiness and execution name the same provider. The two routes and two provider ids are constants of `dsh-web`: a deployment changes the outcome only by configuring `searchProvider`, and the settings page shows the unconfigured state as **Automatic**. Fetch defaults to local HTTP fetch because it has no per-request API charge, applies Harness's own URL validation and resource limits, and reaches intranet and local addresses. The Fetch API remains one menu choice away.
|
||||
|
||||
A stored selection, whether in the settings document or in a deployment's own composition, wins over the shipped default, and an upgrade does not rewrite it. A selection is never replaced at execution: when the selected provider is missing, unavailable, or fails, the operation fails with its structured error and does not fall back to another search or fetch provider. A fallback would send the query and credential to an endpoint the user did not choose and change billing without notice.
|
||||
|
||||
### Legacy Messages search
|
||||
|
||||
The DeepSeek Messages search provider remains available as **DeepSeek (legacy)**. A stored `web.searchProvider: deepseek-official` (or `DSH_WEB_SEARCH_PROVIDER=deepseek-official`) selects it, so users whose gateways serve Messages search but not `/v1/tools` can retain their working provider.
|
||||
The DeepSeek Messages search provider remains available as **DeepSeek server-side search** and serves unconfigured searches on the DeepSeek model routes. A stored `web.searchProvider: deepseek-official` (or `DSH_WEB_SEARCH_PROVIDER=deepseek-official`) selects it for every route, so users whose gateways serve Messages search but not `/v1/tools` can retain their working provider.
|
||||
|
||||
The Messages provider owns and writes `web/deepseek-search-llm-request`. The declaration and payload retain compatibility with released Sessions; the Search and Fetch API package neither declares nor writes this auxiliary event.
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
**Let each provider declare the routes it is the default for.** A `defaultFor(llmProvider)` member on `WebSearchProvider` keeps `dsh-web` free of DeepSeek ids, but it changes both DeepSeek provider packages for a rule that has one instance.
|
||||
|
||||
**Put the route-to-provider table in `dsh-web` configuration.** A profile patch replaces a row's whole `config`, so a stored provider selection would also store a copy of the table and stop following the shipped one, and the table is not a choice users need: fixing a provider already overrides it.
|
||||
|
||||
**Have the Search API provider delegate to Messages search on DeepSeek routes.** The menu would keep two entries, but the entry named DeepSeek Search API would run another provider, a user could not fix the Search API for a DeepSeek model, and one provider package would depend on the other.
|
||||
|
||||
**Keep one switch for both APIs.** It lets Fetch API adoption need no configuration edit, but it ties fetch billing and target access policy to the search choice, and it cannot express a provider that another plugin registers.
|
||||
|
||||
**Filter the lists by availability, or add availability to each entry.** A filtered list hides a provider while its credential is missing, right when the user needs to choose and configure it. Availability also depends on the request's model route and credential state, so a listed boolean could disagree with execution. The archived [observation-surface decision](../../archived/simplification/2026-07-04-drop-unconsumed-web-observation-surface.md) allows only the smallest signal a consumer reads; the menus read registration only.
|
||||
@@ -76,10 +82,10 @@ The Messages provider owns and writes `web/deepseek-search-llm-request`. The dec
|
||||
|
||||
## Consequences
|
||||
|
||||
Users without a stored search selection search through the Search API: their queries go to the Search endpoint the conversation's DeepSeek credential selects, cost a Search API request each, and send up to 128 characters of the latest human prompt as `ori_question` unless `sendOriginalQuestion` is off. Deployments whose gateway has no `/v1/tools` routes get search failures until they select Messages search or set `searchBaseURL` to a base that serves them. A stored `deepseek-official` selection uses Messages search. Users without a stored fetch selection fetch through local HTTP fetch. A signed-in user without an API key has DeepSeek web search with `auto` billing in every conversation except those on the DeepSeek API-key route; the [upgrade guide](../../../../docs/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md) lists each affected setup.
|
||||
Users without a stored search selection search through Messages search in a conversation on a DeepSeek model route: each search is one auxiliary Messages request billed as model tokens, to Messages search's own endpoint, which does not follow the model provider's base URL, so a deployment whose DeepSeek model provider points at a gateway gets search failures until it saves that gateway as the Messages Base URL or fixes the Search API ([upgrade guide](../../../../docs/upgrade-guide/v0.2.2-rc.4/web-search-deepseek-model-default/guide.md)). On every other route they search through the Search API: their queries go to the Search endpoint the conversation's DeepSeek credential selects, cost a Search API request each, and send up to 128 characters of the latest human prompt as `ori_question` unless `sendOriginalQuestion` is off. Deployments whose gateway has no `/v1/tools` routes get search failures there until they select Messages search or set `searchBaseURL` to a base that serves them. `dsh-web` names two DeepSeek model routes and two DeepSeek search providers, which a second route-specific default would have to replace with a provider-neutral rule. A stored `deepseek-official` selection uses Messages search. Users without a stored fetch selection fetch through local HTTP fetch. A signed-in user without an API key has DeepSeek web search with `auto` billing in every conversation except those on the DeepSeek API-key route; the [upgrade guide](../../../../docs/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md) lists each affected setup.
|
||||
|
||||
A plugin provider, including one written in creator mode, appears in the matching menu as soon as it registers, under its `title`. The menus can offer a provider that cannot run for the current request; the failure appears when a search or fetch runs. Each registry change costs one forwarded event and one list read in each Client that observes it.
|
||||
|
||||
## Verification
|
||||
|
||||
[web.spec.ts](../../../../packages/web/web/tests/web.spec.ts) covers list contents and order, titles, events after registration and disposal, no event for a rejected duplicate, and contained listener failures. [deepseek.spec.ts](../../../../packages/web/web-search-deepseek/tests/deepseek.spec.ts) covers the independent Messages provider, and [credential-resolution.spec.ts](../../../../packages/web/web-deepseek-api/tests/credential-resolution.spec.ts) covers, for both capabilities, the account token on the account route and its invalidation after HTTP 401, the API-key fallback without a sign-in, the route key and endpoint in official, non-DeepSeek, and Session-less conversations, the account fallback without a key outside the DeepSeek routes, account-only and API-key-only billing on every route, own fields over billing, `DEEPSEEK_API_KEY` and the official base without that route, YAML-only own fields that never send the token, independent capabilities, readiness matching each operation, and ignored removed fields; [composition.spec.ts](../../../../packages/web/web-deepseek-api/tests/composition.spec.ts) boots the real model routes through the Loader. [remote-events.host.spec.ts](../../../../packages/api/remotes/tests/remote-events.host.spec.ts) covers event forwarding, and [base.spec.ts](../../../../packages/bundle/base/tests/base.spec.ts) pins the shipped defaults. The settings page's controller and card specs and the [plugin configuration browser scenario](../../../../apps/web/tests/plugin-config.e2e.ts) cover menu contents, independent Search and Fetch selection, the billing menus of the DeepSeek APIs, and the settings each provider keeps.
|
||||
[web.spec.ts](../../../../packages/web/web/tests/web.spec.ts) covers list contents and order, titles, events after registration and disposal, no event for a rejected duplicate, contained listener failures, and the per-route preference with its fallbacks; [tool-web.spec.ts](../../../../packages/web/tool-web/tests/tool-web.spec.ts) covers the route `web_search` sends, and the `web-search-legacy-endpoint-guidance` snapshot runs Messages search on a DeepSeek route with no provider configured. [deepseek.spec.ts](../../../../packages/web/web-search-deepseek/tests/deepseek.spec.ts) covers the independent Messages provider, and [credential-resolution.spec.ts](../../../../packages/web/web-deepseek-api/tests/credential-resolution.spec.ts) covers, for both capabilities, the account token on the account route and its invalidation after HTTP 401, the API-key fallback without a sign-in, the route key and endpoint in official, non-DeepSeek, and Session-less conversations, the account fallback without a key outside the DeepSeek routes, account-only and API-key-only billing on every route, own fields over billing, `DEEPSEEK_API_KEY` and the official base without that route, YAML-only own fields that never send the token, independent capabilities, readiness matching each operation, and ignored removed fields; [composition.spec.ts](../../../../packages/web/web-deepseek-api/tests/composition.spec.ts) boots the real model routes through the Loader. [remote-events.host.spec.ts](../../../../packages/api/remotes/tests/remote-events.host.spec.ts) covers event forwarding, and [base.spec.ts](../../../../packages/bundle/base/tests/base.spec.ts) pins the shipped defaults. The settings page's controller and card specs and the [plugin configuration browser scenario](../../../../apps/web/tests/plugin-config.e2e.ts) cover menu contents, independent Search and Fetch selection, the billing menus of the DeepSeek APIs, and the settings each provider keeps.
|
||||
@@ -10,7 +10,7 @@ Web 服务通过 `web.searchProvider` 和 `web.fetchProvider` 两个独立字段
|
||||
|
||||
## 决策
|
||||
|
||||
用户从 Host 已注册的提供方列表中分别选择搜索和抓取提供方。内置组合将搜索设为 Search API,将抓取设为本地 HTTP 抓取;DeepSeek Search 与 Fetch API 跟随会话的 DeepSeek 凭据。
|
||||
用户从 Host 已注册的提供方列表中分别选择搜索和抓取提供方。内置组合不固定搜索提供方,搜索因此跟随会话的模型路由,抓取设为本地 HTTP 抓取;DeepSeek Search 与 Fetch API 跟随会话的 DeepSeek 凭据。
|
||||
|
||||
### 已注册的提供方可观察,可用性不可观察
|
||||
|
||||
@@ -38,18 +38,24 @@ Search 与 Fetch 各有一个计费方式设置 `web-deepseek-api.searchBilling`
|
||||
|
||||
### 默认值与已保存的选择
|
||||
|
||||
[base 组合](../../../../packages/bundle/base/cordis.patch.yml)设置 `searchProvider: deepseek-search-api` 和 `fetchProvider: http`。搜索默认使用 Search API,因为它返回来源时无需 Harness 发起辅助模型请求。抓取默认使用本地 HTTP 抓取,因为它没有按次的 API 费用,执行 Harness 自身的 URL 校验和资源限制,并且可以访问内网和本地地址。Fetch API 仍可在下拉框中直接选择。
|
||||
[base 组合](../../../../packages/bundle/base/cordis.patch.yml)设置 `fetchProvider: http`,不设置 `searchProvider`。没有配置搜索提供方时,`dsh-web` 按搜索所服务的模型请求的提供方路由,优先选用一个已注册且可用的提供方:在 `deepseek-official` 与 `deepseek-account` 模型路由上是 Messages 搜索(`deepseek-official`),因为 DeepSeek 不对 DeepSeek 模型请求声明的服务端搜索工具按次收费;在其他路由上以及模型请求之外是 Search API(`deepseek-search-api`),因为它返回来源时无需向会话没有使用的提供方发起辅助模型请求。`dsh-tool-web` 把发起调用的 Session 最近一次模型请求的路由写入每个搜索请求,`searchReady()` 按正在准备的步骤的路由选择,因此就绪判断与执行指向同一个提供方。这两条路由和两个提供方 id 是 `dsh-web` 中的常量:部署只能通过配置 `searchProvider` 改变结果,设置页把未配置的状态显示为**自动选择**。抓取默认使用本地 HTTP 抓取,因为它没有按次的 API 费用,执行 Harness 自身的 URL 校验和资源限制,并且可以访问内网和本地地址。Fetch API 仍可在下拉框中直接选择。
|
||||
|
||||
已保存的选择——无论位于设置文档还是部署自身的组合中——优先于内置默认值,升级不会改写它。执行时从不替换选择:所选提供方缺失、不可用或失败时,操作以结构化错误失败,不会回退到其他搜索或抓取提供方。回退会把查询和凭据发往用户未选择的端点,并在不提示的情况下改变计费。
|
||||
|
||||
### 旧版 Messages 搜索
|
||||
|
||||
DeepSeek Messages 搜索提供方仍以 **DeepSeek(旧版)**提供。已保存的 `web.searchProvider: deepseek-official`(或 `DSH_WEB_SEARCH_PROVIDER=deepseek-official`)会选中它,因此网关支持 Messages 搜索但不提供 `/v1/tools` 的用户可以保留可用的提供方。
|
||||
DeepSeek Messages 搜索提供方仍以 **DeepSeek 服务端搜索**提供,并承担 DeepSeek 模型路由上未配置提供方的搜索。已保存的 `web.searchProvider: deepseek-official`(或 `DSH_WEB_SEARCH_PROVIDER=deepseek-official`)会在所有路由上选中它,因此网关支持 Messages 搜索但不提供 `/v1/tools` 的用户可以保留可用的提供方。
|
||||
|
||||
Messages 提供方负责声明并写入 `web/deepseek-search-llm-request`。声明和载荷保持与已发布会话兼容;Search 与 Fetch API 包既不声明也不写入这一辅助事件。
|
||||
|
||||
## 考虑过的替代方案
|
||||
|
||||
**让每个提供方声明自己是哪些路由的默认项。** 在 `WebSearchProvider` 上加一个 `defaultFor(llmProvider)` 成员可以让 `dsh-web` 不含 DeepSeek 的 id,但要为只有一个实例的规则修改两个 DeepSeek 提供方包。
|
||||
|
||||
**把路由到提供方的表放进 `dsh-web` 的配置。** profile 补丁会替换条目的整个 `config`,因此已存的提供方选择会连带存下这张表的副本,不再跟随内置的表;而这张表也不是用户需要做的选择:固定提供方已经可以覆盖它。
|
||||
|
||||
**让 Search API 提供方在 DeepSeek 路由上转交给 Messages 搜索。** 菜单可以保持两项,但名为 DeepSeek Search API 的条目会运行另一个提供方,用户无法为 DeepSeek 模型固定 Search API,而且一个提供方包要依赖另一个。
|
||||
|
||||
**保留一个同时切换两个 API 的开关。** 它让使用 Fetch API 无需修改配置,但把抓取的计费和目标访问策略绑在搜索选择上,也无法表达其他插件注册的提供方。
|
||||
|
||||
**按可用性过滤列表,或在每个条目中加入可用性。** 过滤后的列表恰好会在凭据缺失时隐藏提供方,而这正是用户需要选择并配置它的时候。可用性还取决于请求的模型路由和凭据状态,列表中的布尔值可能与实际执行结果不一致。已归档的[观察面决策](../../archived/simplification/2026-07-04-drop-unconsumed-web-observation-surface.md)只允许引入消费方实际读取的最小信号;下拉框只读取注册情况。
|
||||
@@ -76,10 +82,10 @@ Messages 提供方负责声明并写入 `web/deepseek-search-llm-request`。声
|
||||
|
||||
## 影响
|
||||
|
||||
没有已保存搜索选择的用户通过 Search API 搜索:查询发往会话的 DeepSeek 凭据所选的 Search 端点,每次计为一次 Search API 请求,并且除非关闭 `sendOriginalQuestion`,还会把最近一条用户提示的至多 128 个字符作为 `ori_question` 发送。网关没有 `/v1/tools` 路由的部署会遇到搜索失败,直到选择 Messages 搜索,或把 `searchBaseURL` 设为提供这些路由的基础地址。已保存的 `deepseek-official` 选择使用 Messages 搜索。没有已保存抓取选择的用户通过本地 HTTP 抓取。已登录但没有 API 密钥的用户在 `auto` 计费下,除 DeepSeek API 密钥路由上的会话外,都可以使用 DeepSeek 网页搜索;[升级指南](../../../../docs/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md)列出了每种受影响的配置。
|
||||
没有已保存搜索选择的用户在 DeepSeek 模型路由上的会话中通过 Messages 搜索进行搜索:每次搜索是一次按模型 token 计费的辅助 Messages 请求,发往 Messages 搜索自己的端点,该端点不跟随模型提供方的基础地址,因此 DeepSeek 模型提供方指向网关的部署会遇到搜索失败,直到把该网关保存为 Messages Base URL 或固定使用 Search API([升级指南](../../../../docs/upgrade-guide/v0.2.2-rc.4/web-search-deepseek-model-default/guide.zh.md))。在其他路由上他们通过 Search API 搜索:查询发往会话的 DeepSeek 凭据所选的 Search 端点,每次计为一次 Search API 请求,并且除非关闭 `sendOriginalQuestion`,还会把最近一条用户提示的至多 128 个字符作为 `ori_question` 发送。网关没有 `/v1/tools` 路由的部署在这些路由上会遇到搜索失败,直到选择 Messages 搜索,或把 `searchBaseURL` 设为提供这些路由的基础地址。`dsh-web` 点名了两条 DeepSeek 模型路由和两个 DeepSeek 搜索提供方,再出现一个按路由的默认值时须改为提供方无关的规则。已保存的 `deepseek-official` 选择使用 Messages 搜索。没有已保存抓取选择的用户通过本地 HTTP 抓取。已登录但没有 API 密钥的用户在 `auto` 计费下,除 DeepSeek API 密钥路由上的会话外,都可以使用 DeepSeek 网页搜索;[升级指南](../../../../docs/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md)列出了每种受影响的配置。
|
||||
|
||||
插件提供方(包括在创作模式下编写的提供方)一经注册,就会以其 `title` 出现在对应的下拉框中。下拉框可能提供在当前请求中无法运行的提供方;失败会在执行搜索或抓取时出现。每次注册表变更会在每个观察它的 Client 中产生一次转发事件和一次列表读取。
|
||||
|
||||
## 验证
|
||||
|
||||
[web.spec.ts](../../../../packages/web/web/tests/web.spec.ts) 覆盖列表内容与顺序、标题、注册与撤销后的事件、重复注册被拒绝时不触发事件,以及监听器失败的隔离。[deepseek.spec.ts](../../../../packages/web/web-search-deepseek/tests/deepseek.spec.ts) 覆盖独立的 Messages 提供方,[credential-resolution.spec.ts](../../../../packages/web/web-deepseek-api/tests/credential-resolution.spec.ts) 针对两个能力覆盖账号路由上的账号令牌及其在 HTTP 401 后被作废、未登录时回退到 API 密钥、官方、非 DeepSeek 和会话之外的操作使用路由密钥与端点、DeepSeek 路由之外没有密钥时回退到账号、在每个路由上只用账号或只用 API 密钥的计费、单独字段优先于计费方式、没有该路由时使用 `DEEPSEEK_API_KEY` 与官方基础地址、从不发送令牌的 YAML 单独字段、两个能力相互独立、就绪判断与每次操作一致,以及被忽略的已移除字段;[composition.spec.ts](../../../../packages/web/web-deepseek-api/tests/composition.spec.ts) 通过 Loader 启动真实的模型路由。[remote-events.host.spec.ts](../../../../packages/api/remotes/tests/remote-events.host.spec.ts) 覆盖事件转发,[base.spec.ts](../../../../packages/bundle/base/tests/base.spec.ts) 固定内置默认值。设置页的 controller 与 card 测试以及[插件配置浏览器场景](../../../../apps/web/tests/plugin-config.e2e.ts)覆盖下拉框内容、Search 与 Fetch 的分别选择、DeepSeek API 的计费方式下拉框,以及各提供方保留的设置。
|
||||
[web.spec.ts](../../../../packages/web/web/tests/web.spec.ts) 覆盖列表内容与顺序、标题、注册与撤销后的事件、重复注册被拒绝时不触发事件、监听器失败的隔离,以及按路由的优先规则及其回退;[tool-web.spec.ts](../../../../packages/web/tool-web/tests/tool-web.spec.ts) 覆盖 `web_search` 发送的路由,`web-search-legacy-endpoint-guidance` 快照在未配置提供方的 DeepSeek 路由上运行 Messages 搜索。[deepseek.spec.ts](../../../../packages/web/web-search-deepseek/tests/deepseek.spec.ts) 覆盖独立的 Messages 提供方,[credential-resolution.spec.ts](../../../../packages/web/web-deepseek-api/tests/credential-resolution.spec.ts) 针对两个能力覆盖账号路由上的账号令牌及其在 HTTP 401 后被作废、未登录时回退到 API 密钥、官方、非 DeepSeek 和会话之外的操作使用路由密钥与端点、DeepSeek 路由之外没有密钥时回退到账号、在每个路由上只用账号或只用 API 密钥的计费、单独字段优先于计费方式、没有该路由时使用 `DEEPSEEK_API_KEY` 与官方基础地址、从不发送令牌的 YAML 单独字段、两个能力相互独立、就绪判断与每次操作一致,以及被忽略的已移除字段;[composition.spec.ts](../../../../packages/web/web-deepseek-api/tests/composition.spec.ts) 通过 Loader 启动真实的模型路由。[remote-events.host.spec.ts](../../../../packages/api/remotes/tests/remote-events.host.spec.ts) 覆盖事件转发,[base.spec.ts](../../../../packages/bundle/base/tests/base.spec.ts) 固定内置默认值。设置页的 controller 与 card 测试以及[插件配置浏览器场景](../../../../apps/web/tests/plugin-config.e2e.ts)覆盖下拉框内容、Search 与 Fetch 的分别选择、DeepSeek API 的计费方式下拉框,以及各提供方保留的设置。
|
||||
@@ -12,8 +12,8 @@
|
||||
en: 43298ccae4f7a6d4
|
||||
zh: eb7ef46b6f290c15
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/decision/protocol-selection-and-deployment:
|
||||
en: 90e5031d0d2fa9e4
|
||||
zh: a9c0229b20555d9e
|
||||
en: b07c0667e25927aa
|
||||
zh: 45eda3e151040201
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/decision/search-results-and-model-input:
|
||||
en: ad7b3e4fbe528cf2
|
||||
zh: 8ab8779bfdaaa4fa
|
||||
@@ -21,14 +21,14 @@
|
||||
en: 7566e400f9ab3a51
|
||||
zh: 118b2e84d0030480
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/decision/default-migration:
|
||||
en: cb2f0910955b6730
|
||||
zh: 7df057048acd7858
|
||||
en: 9b1e46885451ada3
|
||||
zh: 0deab76a188294dd
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/decision/legacy-messages-search:
|
||||
en: 0dcc97d8105fab60
|
||||
zh: d80d40ae3a0c601d
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/alternatives-considered:
|
||||
en: 907e0b8424943d43
|
||||
zh: f45e583e7cb4eb63
|
||||
en: a7ca765e49cac918
|
||||
zh: 7fea65e16608baf6
|
||||
/agent-note-direct-deepseek-search-and-fetch-apis/consequences:
|
||||
en: 7ec21c5b1124e5f8
|
||||
zh: af769dbdb4face9f
|
||||
|
||||
@@ -14,7 +14,7 @@ The [DeepSeek Search and Fetch guide](https://api-docs.deepseek.com/zh-cn/guides
|
||||
|
||||
### Protocol selection and deployment
|
||||
|
||||
The APIs register as `deepseek-search-api` and `deepseek-fetch-api`. Messages search remains separately registered as `deepseek-official`. The web service selects each provider through `web.searchProvider` and `web.fetchProvider`, which the Search and Fetch menus on the Web search and fetch page set independently; the shipped composition selects the Search API and local HTTP fetch, as the [selection decision](../architecture/2026-10-29-web-provider-selection.md) records. A saved selection takes effect on the next operation because the web service reads both selections per operation. Each operation resolves one settings snapshot, including its endpoint and credential. Both APIs read the `web-deepseek-api` namespace, and each capability resolves its own endpoint and credential.
|
||||
The APIs register as `deepseek-search-api` and `deepseek-fetch-api`. Messages search remains separately registered as `deepseek-official`. The web service selects each provider through `web.searchProvider` and `web.fetchProvider`, which the Search and Fetch menus on the Web search and fetch page set independently; the shipped composition selects local HTTP fetch and no search provider, which runs the Search API outside the DeepSeek model routes, as the [selection decision](../architecture/2026-10-29-web-provider-selection.md) records. A saved selection takes effect on the next operation because the web service reads both selections per operation. Each operation resolves one settings snapshot, including its endpoint and credential. Both APIs read the `web-deepseek-api` namespace, and each capability resolves its own endpoint and credential.
|
||||
|
||||
Direct retrieval appends `/search` or `/fetch` to an API base. A capability without its own YAML endpoint fields uses the origin of the conversation's DeepSeek model route base URL with `/v1/tools`, which for the public deployment is the guide's `https://api.deepseek.com/v1/tools`; the [selection decision](../architecture/2026-10-29-web-provider-selection.md) owns that derivation and the credential each operation sends. The verified development base is `http://api-dev.deepseek.com:8031/api/v1/tools`; its prefix differs and is never inferred from the hostname, so such a deployment sets the complete base in `searchBaseURL` or `fetchBaseURL`. An unparseable base leaves that capability's provider unavailable.
|
||||
|
||||
@@ -36,7 +36,7 @@ The HTTP provider retains its own URL validation and resource limits. Selecting
|
||||
|
||||
### Default migration
|
||||
|
||||
The shipped composition selects `deepseek-search-api`; the [selection decision](../architecture/2026-10-29-web-provider-selection.md) owns that default and its no-fallback rule. API keys and account tokens both reach the public routes. Deployments behind a gateway without `/v1/tools` routes set `searchBaseURL` to a base that serves them. A stored `web.searchProvider: deepseek-official` selects Messages search, and any other stored selection keeps its provider.
|
||||
The shipped composition fixes no search provider: a search runs Messages search for a model request on a DeepSeek model route and `deepseek-search-api` on every other route; the [selection decision](../architecture/2026-10-29-web-provider-selection.md) owns that default and its no-fallback rule. API keys and account tokens both reach the public routes. Deployments behind a gateway without `/v1/tools` routes set `searchBaseURL` to a base that serves them. A stored `web.searchProvider: deepseek-official` selects Messages search, and any other stored selection keeps its provider.
|
||||
|
||||
### Legacy Messages search
|
||||
|
||||
@@ -48,7 +48,7 @@ The independent `dsh-web-search-deepseek` provider sends Messages search request
|
||||
|
||||
**Reuse the Messages address or infer a route prefix.** The protocols and deployed prefixes differ. Separate bases preserve existing configurations and avoid sending a valid request to the wrong route.
|
||||
|
||||
**Require an explicit Search API base.** The Search API is the shipped search default, and an empty default would leave it unavailable until every user enters an address that the DeepSeek model route already determines. Other deployments still set their own base.
|
||||
**Require an explicit Search API base.** The Search API is the shipped search default outside the DeepSeek model routes, and an empty default would leave it unavailable until every user enters an address that the DeepSeek model route already determines. Other deployments still set their own base.
|
||||
|
||||
**Keep the APIs inside the Messages provider behind a provider-local switch.** A switch inside the Messages provider cannot change fetch routing, so `web_fetch` would stay on HTTP unless the user also edited `web.fetchProvider`; it also ties the APIs' lifecycle to Messages search. Separate registrations let the web service's existing selection choose each provider, without coupling either API to the Messages provider.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Status: implemented
|
||||
|
||||
### 协议选择与部署
|
||||
|
||||
两个 API 注册为 `deepseek-search-api` 和 `deepseek-fetch-api`;Messages 搜索仍独立注册为 `deepseek-official`。Web 服务通过 `web.searchProvider` 和 `web.fetchProvider` 选择各个提供方,「网页搜索与获取」页上的 Search 和 Fetch 下拉框分别设置这两项;内置组合选择 Search API 与本地 HTTP 抓取,见[选择决策](../architecture/2026-10-29-web-provider-selection.zh.md)。已保存的选择从下一次操作起生效,因为 Web 服务在每次操作时读取两项选择。每次操作解析一份包含端点和凭据的设置快照。两个 API 读取 `web-deepseek-api` namespace,每个能力各自解析端点与凭据。
|
||||
两个 API 注册为 `deepseek-search-api` 和 `deepseek-fetch-api`;Messages 搜索仍独立注册为 `deepseek-official`。Web 服务通过 `web.searchProvider` 和 `web.fetchProvider` 选择各个提供方,「网页搜索与获取」页上的 Search 和 Fetch 下拉框分别设置这两项;内置组合选择本地 HTTP 抓取,不选择搜索提供方,此时 DeepSeek 模型路由之外的搜索使用 Search API,见[选择决策](../architecture/2026-10-29-web-provider-selection.zh.md)。已保存的选择从下一次操作起生效,因为 Web 服务在每次操作时读取两项选择。每次操作解析一份包含端点和凭据的设置快照。两个 API 读取 `web-deepseek-api` namespace,每个能力各自解析端点与凭据。
|
||||
|
||||
直接检索在 API 基础地址后追加 `/search` 或 `/fetch`。没有在 YAML 中单独设置端点字段的能力,使用会话的 DeepSeek 模型路由基础地址的 origin 加 `/v1/tools`,公网部署即指南中的 `https://api.deepseek.com/v1/tools`;该推导及每次操作发送的凭据由[选择决策](../architecture/2026-10-29-web-provider-selection.zh.md)负责。已验证的开发地址为 `http://api-dev.deepseek.com:8031/api/v1/tools`;其前缀不同,程序不会根据主机名推断,此类部署需在 `searchBaseURL` 或 `fetchBaseURL` 中填写完整基础地址。基础地址无法解析时,该能力的提供方不可用。
|
||||
|
||||
@@ -36,7 +36,7 @@ HTTP 提供方继续负责自身的 URL 校验和资源限制。选择 DeepSeek
|
||||
|
||||
### 默认值迁移
|
||||
|
||||
内置组合选择 `deepseek-search-api`;[选择决策](../architecture/2026-10-29-web-provider-selection.zh.md)负责这项默认值及其不回退规则。API 密钥和账号 token 都能访问公网路由。位于没有 `/v1/tools` 路由的网关之后的部署,需把 `searchBaseURL` 设为提供这些路由的基础地址。已保存的 `web.searchProvider: deepseek-official` 会选中 Messages 搜索,其他已保存的选择保持其提供方。
|
||||
内置组合不固定搜索提供方:为 DeepSeek 模型路由上的模型请求发起的搜索运行 Messages 搜索,其他路由上的搜索运行 `deepseek-search-api`;[选择决策](../architecture/2026-10-29-web-provider-selection.zh.md)负责这项默认值及其不回退规则。API 密钥和账号 token 都能访问公网路由。位于没有 `/v1/tools` 路由的网关之后的部署,需把 `searchBaseURL` 设为提供这些路由的基础地址。已保存的 `web.searchProvider: deepseek-official` 会选中 Messages 搜索,其他已保存的选择保持其提供方。
|
||||
|
||||
### 旧版 Messages 搜索
|
||||
|
||||
@@ -48,7 +48,7 @@ HTTP 提供方继续负责自身的 URL 校验和资源限制。选择 DeepSeek
|
||||
|
||||
**复用 Messages 地址或推断路由前缀。** 协议与部署前缀不同。分别保存基础地址可保留现有配置,避免把有效请求发往错误路由。
|
||||
|
||||
**要求显式填写 Search API 基础地址。** Search API 是内置的搜索默认值,空默认值会让它在每位用户填写一个 DeepSeek 模型路由已经确定的地址之前都不可用。其他部署仍可设置自己的基础地址。
|
||||
**要求显式填写 Search API 基础地址。** Search API 是 DeepSeek 模型路由之外内置的搜索默认值,空默认值会让它在每位用户填写一个 DeepSeek 模型路由已经确定的地址之前都不可用。其他部署仍可设置自己的基础地址。
|
||||
|
||||
**把两个 API 放在 Messages 提供方内部,由提供方自己的开关切换。** Messages 提供方内的开关无法改变抓取路由,因此除非用户另外修改 `web.fetchProvider`,`web_fetch` 仍会走 HTTP;它还会把两个 API 的生命周期绑在 Messages 搜索上。独立注册让 Web 服务通过现有的提供方选择机制选择各个提供方,不会把任一 API 与 Messages 提供方绑定。
|
||||
|
||||
|
||||
@@ -167,18 +167,33 @@ describe('web e2e: plugin configuration pages', () => {
|
||||
await expect.poll(() => page.getByRole('menuitem').count()).toBe(0)
|
||||
return items
|
||||
}
|
||||
// The shipped composition selects the DeepSeek Search API and local fetch, and the page writes nothing on mount.
|
||||
expect(await searchMenu.textContent()).toBe('DeepSeek Search API')
|
||||
// The shipped composition selects no search provider and local fetch, and the page writes nothing on mount.
|
||||
expect(await searchMenu.textContent()).toBe('自动选择')
|
||||
expect(await fetchMenu.textContent()).toBe('本机直接获取')
|
||||
expect(await panel.getByRole('button', { name: '网页搜索提供方 DeepSeek Search API', exact: true }).count()).toBe(1)
|
||||
expect(await panel.getByRole('button', { name: '网页搜索提供方 自动选择', exact: true }).count()).toBe(1)
|
||||
expect(await panel.getByRole('button', { name: '网页获取提供方 本机直接获取', exact: true }).count()).toBe(1)
|
||||
expect(await entries(searchMenu)).toEqual(['DeepSeek Search API', 'DeepSeek(旧版)'])
|
||||
expect(await entries(searchMenu)).toEqual(['自动选择', 'DeepSeek Search API', 'DeepSeek 服务端搜索'])
|
||||
expect(await entries(fetchMenu)).toEqual(['本机直接获取', 'DeepSeek Fetch API'])
|
||||
expect(await settingsDocument()).not.toContain('searchProvider:')
|
||||
// The page fixes the menu order itself; the Loader imports plugins concurrently, so the
|
||||
// Host's registration order is not the YAML row order and only its membership is checked here.
|
||||
const hostWeb = scaffold.ctx.get('web') as { listProviders(): Record<'search' | 'fetch', { id: string }[]> } | undefined
|
||||
expect(hostWeb?.listProviders().search.map(provider => provider.id).sort()).toEqual(['deepseek-official', 'deepseek-search-api'])
|
||||
// Automatic selection states which provider the Host runs for each model and shows no provider panel.
|
||||
expect(await searchSection.getByText(
|
||||
'跟随当前会话的模型:DeepSeek 模型使用 DeepSeek 服务端搜索,搜索不按次收费;其他模型使用 DeepSeek Search API。', { exact: true },
|
||||
).count()).toBe(1)
|
||||
expect(await searchSection.getByRole('link', { name: '网页搜索与获取指南', exact: true }).getAttribute('href'))
|
||||
.toBe('https://api-docs.deepseek.com/zh-cn/guides/search')
|
||||
expect(await searchSection.getByRole('textbox').count()).toBe(0)
|
||||
expect(await save.isDisabled()).toBe(true)
|
||||
|
||||
// The composition names no search provider, so a selected one is stored.
|
||||
await choose(searchMenu, 'DeepSeek Search API')
|
||||
await save.click()
|
||||
await expect.poll(() => save.isDisabled()).toBe(true)
|
||||
await expect.poll(settingsDocument).toContain('searchProvider: deepseek-search-api')
|
||||
expect(await panel.getByRole('button', { name: '网页搜索提供方 DeepSeek Search API', exact: true }).count()).toBe(1)
|
||||
expect(await panel.getByRole('link', { name: '网页搜索与获取指南', exact: true }).getAttribute('href'))
|
||||
.toBe('https://api-docs.deepseek.com/zh-cn/guides/search')
|
||||
// Each section shows the description its selected provider registered with the Host, in the active language.
|
||||
@@ -230,7 +245,7 @@ describe('web e2e: plugin configuration pages', () => {
|
||||
await expect.poll(() => save.isDisabled()).toBe(true)
|
||||
await expect.poll(settingsDocument).not.toContain('fetchProvider: deepseek-fetch-api')
|
||||
|
||||
await choose(searchMenu, 'DeepSeek(旧版)')
|
||||
await choose(searchMenu, 'DeepSeek 服务端搜索')
|
||||
const messagesEndpoint = panel.locator('#plugin-config-web-search-endpoint')
|
||||
expect(await panel.getByLabel('单次请求最多搜索次数', { exact: true }).inputValue()).toBe('5')
|
||||
await messagesEndpoint.fill('https://messages.test/anthropic/v1')
|
||||
@@ -241,17 +256,23 @@ describe('web e2e: plugin configuration pages', () => {
|
||||
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
||||
await openPlugins()
|
||||
await openPage(panel, '网页搜索与获取')
|
||||
expect(await searchMenu.textContent()).toBe('DeepSeek(旧版)')
|
||||
expect(await searchMenu.textContent()).toBe('DeepSeek 服务端搜索')
|
||||
expect(await messagesEndpoint.inputValue()).toBe('https://messages.test/anthropic/v1')
|
||||
expect(await entries(searchMenu)).toEqual(['DeepSeek Search API', 'DeepSeek(旧版)'])
|
||||
expect(await entries(searchMenu)).toEqual(['自动选择', 'DeepSeek Search API', 'DeepSeek 服务端搜索'])
|
||||
expect(await save.isDisabled()).toBe(true)
|
||||
expect(await settingsDocument()).toContain('searchProvider: deepseek-official')
|
||||
await choose(searchMenu, 'DeepSeek Search API')
|
||||
await count.fill('20')
|
||||
await save.click()
|
||||
await expect.poll(() => save.isDisabled()).toBe(true)
|
||||
await expect.poll(settingsDocument).not.toContain('searchProvider:')
|
||||
await expect.poll(settingsDocument).toContain('searchProvider: deepseek-search-api')
|
||||
expect(await settingsDocument()).toContain('count: 20')
|
||||
// Automatic selection clears the stored provider.
|
||||
await choose(searchMenu, '自动选择')
|
||||
await save.click()
|
||||
await expect.poll(() => save.isDisabled()).toBe(true)
|
||||
await expect.poll(settingsDocument).not.toContain('searchProvider:')
|
||||
expect(await searchMenu.textContent()).toBe('自动选择')
|
||||
expect(await settingsDocument()).not.toMatch(/ApiKeyEnv:|searchBaseURL:|fetchBaseURL:/)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
})
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# The replayed conversation runs on a DeepSeek model route, where an unconfigured search selects
|
||||
# legacy Messages search. This scenario exercises the DeepSeek Search API.
|
||||
- id: web
|
||||
config:
|
||||
searchProvider: deepseek-search-api
|
||||
fetchProvider: http
|
||||
@@ -1,5 +1,5 @@
|
||||
// Web e2e scenario for the shipped default search provider, the DeepSeek
|
||||
// Search API, with no provider selection patched. A real browser drives
|
||||
// Web e2e scenario for the DeepSeek Search API, selected for a conversation
|
||||
// on a DeepSeek model route. A real browser drives
|
||||
// `web_search`; the model stream is replayed while the real DeepSeek provider
|
||||
// calls a deterministic local Search API endpoint through the real
|
||||
// credentials service.
|
||||
@@ -141,7 +141,7 @@ async function startSearchServer(captured: CapturedSearchRequest[]): Promise<{ s
|
||||
return { server, baseURL: `http://127.0.0.1:${address.port}` }
|
||||
}
|
||||
|
||||
describe('web e2e: default Search API web search', () => {
|
||||
describe('web e2e: Search API web search', () => {
|
||||
let scaffold: WebScaffold
|
||||
let browser: Browser
|
||||
let page: Page
|
||||
@@ -154,7 +154,8 @@ describe('web e2e: default Search API web search', () => {
|
||||
const search = await startSearchServer(searchRequests)
|
||||
searchServer = search.server
|
||||
scaffold = await launchWebScaffold({
|
||||
extraOverlayPath: fileURLToPath(new URL('./pin-browse-picker.overlay.yml', import.meta.url)),
|
||||
extraOverlayPath: ['./pin-browse-picker.overlay.yml', './search-api-provider.overlay.yml']
|
||||
.map(path => fileURLToPath(new URL(path, import.meta.url))),
|
||||
compareReplaySession: true,
|
||||
// Own YAML endpoint settings pin Search to the local endpoint and a dedicated key.
|
||||
deepSeekWebApi: {
|
||||
|
||||
@@ -4815,7 +4815,7 @@ export type ApprovalPolicy = 'ask' | 'never'
|
||||
## `@deepseek-ai/dsh-web`
|
||||
|
||||
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
|
||||
- `source`: [`packages/web/web/src/index.ts:62`](../packages/web/web/src/index.ts)
|
||||
- `source`: [`packages/web/web/src/index.ts:77`](../packages/web/web/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/**
|
||||
@@ -4827,7 +4827,10 @@ export type ApprovalPolicy = 'ask' | 'never'
|
||||
* fields rather than introduce a hidden priority chain.
|
||||
*/
|
||||
export interface WebRuntimeConfig {
|
||||
/** Explicit search provider id. Omitted = auto-select when exactly one usable. */
|
||||
/**
|
||||
* Explicit search provider id. Omitted = the usable DeepSeek provider assigned to the route of the model
|
||||
* request, and otherwise auto-select when exactly one usable.
|
||||
*/
|
||||
readonly searchProvider: Volatile<string | undefined>
|
||||
/** Explicit fetch provider id. Omitted = auto-select when exactly one usable. */
|
||||
readonly fetchProvider: Volatile<string | undefined>
|
||||
|
||||
@@ -4817,7 +4817,7 @@ export type ApprovalPolicy = 'ask' | 'never'
|
||||
## `@deepseek-ai/dsh-web`
|
||||
|
||||
- `refs`: `Volatile` (`@deepseek-ai/cordis`)
|
||||
- `source`: [`packages/web/web/src/index.ts:62`](../packages/web/web/src/index.ts)
|
||||
- `source`: [`packages/web/web/src/index.ts:77`](../packages/web/web/src/index.ts)
|
||||
|
||||
```ts config-catalog
|
||||
/**
|
||||
@@ -4829,7 +4829,10 @@ export type ApprovalPolicy = 'ask' | 'never'
|
||||
* fields rather than introduce a hidden priority chain.
|
||||
*/
|
||||
export interface WebRuntimeConfig {
|
||||
/** Explicit search provider id. Omitted = auto-select when exactly one usable. */
|
||||
/**
|
||||
* Explicit search provider id. Omitted = the usable DeepSeek provider assigned to the route of the model
|
||||
* request, and otherwise auto-select when exactly one usable.
|
||||
*/
|
||||
readonly searchProvider: Volatile<string | undefined>
|
||||
/** Explicit fetch provider id. Omitted = auto-select when exactly one usable. */
|
||||
readonly fetchProvider: Volatile<string | undefined>
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
en: 380da3cd0aabd52b
|
||||
zh: 1317c26089c3ab07
|
||||
/web-access/search-request-and-result:
|
||||
en: c6eee490ae914ae0
|
||||
zh: d576eaeb48480c81
|
||||
en: aae36206db7d881a
|
||||
zh: 3db415334859f12a
|
||||
/web-access/fetch-request-and-result:
|
||||
en: b96bcdf42ced9eab
|
||||
zh: aa927e2450238557
|
||||
/web-access/provider-availability:
|
||||
en: ba99c3876cb05fd9
|
||||
zh: cd366d7c3279bd87
|
||||
en: 359df7da69bf2945
|
||||
zh: 007f24572cffe391
|
||||
/web-access/fetch-network-policy:
|
||||
en: 6851874be5841d90
|
||||
zh: dc085bf3b82d77df
|
||||
|
||||
+10
-3
@@ -12,7 +12,7 @@ Search and fetch share no request schema and no business logic, but they are del
|
||||
|
||||
## Search request and result
|
||||
|
||||
Each seam request carries exactly one `query`. The `dsh-tool-web` consumer accepts a required `queries` array and fans it out into separate seam requests; a one-item array performs one search. `maxResults` is a consumer-owned bound (`dsh-tool-web`'s `searchMaxResults` config, default `10`) passed through the seam and enforced on the way back — if a provider over-returns, the seam truncates `sources[]` and sets `truncated`.
|
||||
Each seam request carries exactly one `query`. The `dsh-tool-web` consumer accepts a required `queries` array and fans it out into separate seam requests; a one-item array performs one search. `maxResults` is a consumer-owned bound (`dsh-tool-web`'s `searchMaxResults` config, default `10`) passed through the seam and enforced on the way back — if a provider over-returns, the seam truncates `sources[]` and sets `truncated`. `llmProvider` names the provider route of the model request a search serves; `dsh-tool-web` sets it to the route of the calling Session's latest model request.
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
@@ -31,6 +31,12 @@ interface WebSearchRequest {
|
||||
* bound regardless.
|
||||
*/
|
||||
readonly maxResults?: number
|
||||
/**
|
||||
* Provider route id of the model request this search serves. While no search
|
||||
* provider is configured, the seam selects with it, as `searchReady()` selects
|
||||
* with its argument. Omitted = the search serves no model request.
|
||||
*/
|
||||
readonly llmProvider?: string
|
||||
}
|
||||
```
|
||||
|
||||
@@ -127,7 +133,7 @@ A provider's `available(): boolean` is a cheap LOCAL check (credential presence,
|
||||
|
||||
A search or fetch provider may also implement `ready(llmProvider): Promise<boolean>`, a configuration-only check that must not make network calls: it answers whether an operation made for a model request on that chat route has a credential to send. `searchReady(llmProvider?)` and `fetchReady(llmProvider?)` ask only the provider that `search()` or `fetch()` would select, treat a provider without `ready()` as ready, and answer true when selection fails, because the operation reports that failure as a `WebError`. Readiness is not a selection input; `dsh-tool-web` makes it the activation condition of `web_search` and `web_fetch`, so a model step whose route answers false neither declares nor dispatches the tool. The DeepSeek Search and Fetch API providers use the route to choose between the account token and the API key, as the [web-deepseek-api authentication](../../packages/web/web-deepseek-api/README.md#authentication) section describes.
|
||||
|
||||
Selection never depends on registration, config, or HMR order: a capability has an explicit provider id (config `searchProvider`/`fetchProvider`, or the matching env var feeding the same field), or auto-selects when exactly one usable provider is registered; multiple usable providers with no configured id is `WEB_PROVIDER_AMBIGUOUS`, not first-wins. Each operation reads the configured id when it runs, so a saved settings change applies to the next search or fetch without remounting `ctx.web`.
|
||||
Selection never depends on registration, config, or HMR order: a capability has an explicit provider id (config `searchProvider`/`fetchProvider`, or the matching env var feeding the same field), or auto-selects when exactly one usable provider is registered; multiple usable providers with no configured id is `WEB_PROVIDER_AMBIGUOUS`, not first-wins. One fixed preference precedes that rule for search: with no configured id, a search runs `deepseek-official` (DeepSeek Messages search, which has no per-search charge) for a model request on the `deepseek-official` or `deepseek-account` route, and `deepseek-search-api` on every other route and outside a model request, whenever that provider is registered and usable. `searchReady(llmProvider)` selects the same provider as a search whose request carries that `llmProvider`. Each operation reads the configured id when it runs, so a saved settings change applies to the next search or fetch without remounting `ctx.web`.
|
||||
|
||||
## Fetch network policy
|
||||
|
||||
@@ -162,6 +168,7 @@ Selection semantics (resolved at execution time, never order-dependent):
|
||||
- A configured id that is registered and `available()` → that provider.
|
||||
- A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.
|
||||
- A configured id registered but unavailable → `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.
|
||||
- No search id configured, and the provider assigned to the route of the model request the search serves is usable → that provider: `deepseek-official` (Messages search) on the `deepseek-official` and `deepseek-account` routes, `deepseek-search-api` on every other route and outside a model request.
|
||||
- No id configured, exactly one registered usable provider → that provider.
|
||||
- No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.
|
||||
- No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
|
||||
@@ -199,7 +206,7 @@ registerFetchProvider(provider: WebFetchProvider): () => void
|
||||
* time with the selection rules above; throws {@link WebError} when the
|
||||
* capability cannot run. The seam enforces `request.maxResults` on the result:
|
||||
* if the provider over-returns, `sources[]` is truncated and `truncated` set.
|
||||
* @param request - the query and optional result limit.
|
||||
* @param request - the query, the optional result limit, and the route of the model request the search serves.
|
||||
* @param signal - optional cancellation signal forwarded to the provider.
|
||||
* @returns the provider's results, capped to `request.maxResults`.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@ Web 访问 seam 是一个[能力 seam](../../.agents/notes/implemented/architect
|
||||
|
||||
## 搜索请求与结果
|
||||
|
||||
每个 seam 请求只携带一个 `query`。消费方 `dsh-tool-web` 接受必填的 `queries` 数组,并把它扇出为多个独立 seam 请求;单元素数组执行一次搜索。`maxResults` 是消费方自有的上限(`dsh-tool-web` 的 `searchMaxResults` 配置,默认 `10`),通过 seam 传递并在返回时强制执行——如果提供方返回超量,seam 截断 `sources[]` 并设置 `truncated`。
|
||||
每个 seam 请求只携带一个 `query`。消费方 `dsh-tool-web` 接受必填的 `queries` 数组,并把它扇出为多个独立 seam 请求;单元素数组执行一次搜索。`maxResults` 是消费方自有的上限(`dsh-tool-web` 的 `searchMaxResults` 配置,默认 `10`),通过 seam 传递并在返回时强制执行——如果提供方返回超量,seam 截断 `sources[]` 并设置 `truncated`。`llmProvider` 指明搜索所服务的模型请求的提供方路由;`dsh-tool-web` 把它设为发起调用的 Session 最近一次模型请求的路由。
|
||||
|
||||
```ts type-equiv
|
||||
/**
|
||||
@@ -31,6 +31,12 @@ interface WebSearchRequest {
|
||||
* bound regardless.
|
||||
*/
|
||||
readonly maxResults?: number
|
||||
/**
|
||||
* Provider route id of the model request this search serves. While no search
|
||||
* provider is configured, the seam selects with it, as `searchReady()` selects
|
||||
* with its argument. Omitted = the search serves no model request.
|
||||
*/
|
||||
readonly llmProvider?: string
|
||||
}
|
||||
```
|
||||
|
||||
@@ -127,7 +133,7 @@ type WebFetchBody =
|
||||
|
||||
搜索或抓取提供方还可以实现 `ready(llmProvider): Promise<boolean>`,这是只检查配置、禁止发起网络调用的判断:它回答为该对话路由上的模型请求发起的操作是否有可发送的凭据。`searchReady(llmProvider?)` 与 `fetchReady(llmProvider?)` 只询问 `search()` 或 `fetch()` 会选中的提供方,把没有 `ready()` 的提供方视为就绪,并在选择失败时回答 true,因为对应操作会把该失败报告为 `WebError`。就绪判断不是选择输入;`dsh-tool-web` 把它作为 `web_search` 与 `web_fetch` 的激活条件,因此路由回答 false 的模型步骤既不声明也不派发该工具。DeepSeek Search 与 Fetch API 提供方依据该路由在账号令牌与 API 密钥之间选择,见 [web-deepseek-api 鉴权](../../packages/web/web-deepseek-api/README.zh.md#authentication)一节。
|
||||
|
||||
选择从不依赖注册顺序、配置顺序或 HMR(热模块替换)顺序:一项能力要么有显式的提供方 id(配置 `searchProvider`/`fetchProvider`,或填充同一字段的对应环境变量),要么在恰好只有一个可用提供方注册时自动选择;如果存在多个可用提供方却未配置 id,则抛出 `WEB_PROVIDER_AMBIGUOUS`,而不会选用最先注册的提供方。每次操作在执行时读取配置的 id,因此保存的设置变更无需重新挂载 `ctx.web` 即对下一次搜索或抓取生效。
|
||||
选择从不依赖注册顺序、配置顺序或 HMR(热模块替换)顺序:一项能力要么有显式的提供方 id(配置 `searchProvider`/`fetchProvider`,或填充同一字段的对应环境变量),要么在恰好只有一个可用提供方注册时自动选择;如果存在多个可用提供方却未配置 id,则抛出 `WEB_PROVIDER_AMBIGUOUS`,而不会选用最先注册的提供方。搜索在这条规则之前有一条固定的优先规则:没有配置 id 时,为 `deepseek-official` 或 `deepseek-account` 路由上的模型请求发起的搜索运行 `deepseek-official`(不按次收费的 DeepSeek Messages 搜索),其他路由上以及不服务于模型请求的搜索运行 `deepseek-search-api`,前提是该提供方已注册且可用。`searchReady(llmProvider)` 选中的提供方与请求携带该 `llmProvider` 的搜索相同。每次操作在执行时读取配置的 id,因此保存的设置变更无需重新挂载 `ctx.web` 即对下一次搜索或抓取生效。
|
||||
|
||||
## 抓取网络策略
|
||||
|
||||
@@ -162,6 +168,7 @@ Selection semantics (resolved at execution time, never order-dependent):
|
||||
- A configured id that is registered and `available()` → that provider.
|
||||
- A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.
|
||||
- A configured id registered but unavailable → `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.
|
||||
- No search id configured, and the provider assigned to the route of the model request the search serves is usable → that provider: `deepseek-official` (Messages search) on the `deepseek-official` and `deepseek-account` routes, `deepseek-search-api` on every other route and outside a model request.
|
||||
- No id configured, exactly one registered usable provider → that provider.
|
||||
- No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.
|
||||
- No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
|
||||
@@ -199,7 +206,7 @@ registerFetchProvider(provider: WebFetchProvider): () => void
|
||||
* time with the selection rules above; throws {@link WebError} when the
|
||||
* capability cannot run. The seam enforces `request.maxResults` on the result:
|
||||
* if the provider over-returns, `sources[]` is truncated and `truncated` set.
|
||||
* @param request - the query and optional result limit.
|
||||
* @param request - the query, the optional result limit, and the route of the model request the search serves.
|
||||
* @param signal - optional cancellation signal forwarded to the provider.
|
||||
* @returns the provider's results, capped to `request.maxResults`.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
|
||||
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
||||
# After editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-rc.4/web-search-deepseek-model-default/guide.md
|
||||
/:
|
||||
en: 0770389edf4d335e
|
||||
zh: fdbfa622103fb642
|
||||
/search-on-deepseek-models-defaults-to-legacy-messages-search:
|
||||
en: 1b8b03f925f55d40
|
||||
zh: ad09560d0736d4a6
|
||||
/search-on-deepseek-models-defaults-to-legacy-messages-search/change:
|
||||
en: 02ae47ad15769fe8
|
||||
zh: 1f7b1fe3f97656da
|
||||
/search-on-deepseek-models-defaults-to-legacy-messages-search/migration:
|
||||
en: 5fbf8405a6a2c9dc
|
||||
zh: ae8bb97ee2970f07
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "The shipped composition no longer fixes a search provider, so web search in a conversation on a DeepSeek model runs legacy Messages search instead of the DeepSeek Search API."
|
||||
---
|
||||
|
||||
# Search on DeepSeek models defaults to legacy Messages search
|
||||
|
||||
English | [中文](guide.zh.md)
|
||||
|
||||
## Change
|
||||
|
||||
Previously, the shared base composition set `web.searchProvider` to `deepseek-search-api`, so every search was one DeepSeek Search API request. Now the base sets no `searchProvider`, and `dsh-web` selects per model provider route. A search made for a model request on the `deepseek-official` or `deepseek-account` route runs the `deepseek-official` search provider: an auxiliary Messages request to `web-search-deepseek`'s endpoint, which has no per-search charge and is billed as model tokens, and which appends a `web/deepseek-search-llm-request` event to the Session log. A search on any other route, or outside a model request, still runs `deepseek-search-api`.
|
||||
|
||||
The Messages search endpoint does not follow the model provider's base URL: it is `web-search-deepseek.baseURL`, else `$DEEPSEEK_SEARCH_BASE_URL`, else `https://api.deepseek.com/anthropic/v1`, and outside an account conversation it receives the key under `web-search-deepseek.apiKeyEnv` (`DEEPSEEK_API_KEY` by default). A deployment whose DeepSeek model provider points at a gateway therefore sends that key to the official endpoint and its searches fail until step 2 or 3 is applied.
|
||||
|
||||
The Web search provider menu on the Web search and fetch settings page gains **Automatic**, which is the selection when none is stored. A composition or profile that sets `web.searchProvider` itself, and `DSH_WEB_SEARCH_PROVIDER`, see no change. Fetch still defaults to `http`.
|
||||
|
||||
## Migration
|
||||
|
||||
1. To accept the new default, change nothing. Confirm: the Web search provider menu shows Automatic, and a search in a conversation on a DeepSeek model appends a `web/deepseek-search-llm-request` event.
|
||||
2. To keep the DeepSeek Search API for every model, select DeepSeek Search API in that menu and save, or set `searchProvider: deepseek-search-api` beside `fetchProvider: http` in the `config` of the `@deepseek-ai/dsh-web` row. Confirm: the menu shows DeepSeek Search API, and a search appends no `web/deepseek-search-llm-request` event.
|
||||
3. To use Messages search through a gateway, select DeepSeek server-side search in that menu and save the gateway's Anthropic-compatible base, which ends before `/messages`, as its Base URL, or set `web-search-deepseek.baseURL`; then select Automatic again if other models should keep the Search API. Confirm: a search on a DeepSeek model returns results, and its `web/deepseek-search-llm-request` event names the gateway endpoint.
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
kind: upgrade-guide
|
||||
description: "交付的组合不再固定搜索提供方,因此使用 DeepSeek 模型的会话中,网页搜索改用旧版 Messages 搜索而不是 DeepSeek Search API。"
|
||||
---
|
||||
|
||||
# DeepSeek 模型上的搜索默认使用旧版 Messages 搜索
|
||||
|
||||
[English](guide.md) | 中文
|
||||
|
||||
## 变更
|
||||
|
||||
过去,共享的基础组合把 `web.searchProvider` 设为 `deepseek-search-api`,因此每次搜索都是一次 DeepSeek Search API 请求。现在基础组合不设置 `searchProvider`,由 `dsh-web` 按模型提供方路由选择。为 `deepseek-official` 或 `deepseek-account` 路由上的模型请求发起的搜索使用 `deepseek-official` 搜索提供方:它向 `web-search-deepseek` 的端点发送一次辅助 Messages 请求,不按次收费,按模型 token 计费,并向会话日志追加一个 `web/deepseek-search-llm-request` 事件。其他路由上的搜索,以及不服务于模型请求的搜索,仍使用 `deepseek-search-api`。
|
||||
|
||||
Messages 搜索的端点不跟随模型提供方的基础地址:它是 `web-search-deepseek.baseURL`,其次是 `$DEEPSEEK_SEARCH_BASE_URL`,再次是 `https://api.deepseek.com/anthropic/v1`;在账号会话之外,它收到的是 `web-search-deepseek.apiKeyEnv`(默认 `DEEPSEEK_API_KEY`)下的密钥。因此,DeepSeek 模型提供方指向网关的部署会把该密钥发往官方端点,搜索会失败,直到执行第 2 步或第 3 步。
|
||||
|
||||
「网页搜索与获取」设置页的「网页搜索提供方」菜单新增**自动选择**,没有已存选择时即选中它。自行设置了 `web.searchProvider` 的组合或 profile,以及 `DSH_WEB_SEARCH_PROVIDER`,不受影响。Fetch 仍默认为 `http`。
|
||||
|
||||
## 迁移
|
||||
|
||||
1. 接受新的默认值时无需修改。确认:「网页搜索提供方」菜单显示「自动选择」,且使用 DeepSeek 模型的会话中的搜索会追加一个 `web/deepseek-search-llm-request` 事件。
|
||||
2. 要让所有模型继续使用 DeepSeek Search API,在该菜单中选择 DeepSeek Search API 并保存,或在 `@deepseek-ai/dsh-web` 条目的 `config` 中把 `searchProvider: deepseek-search-api` 与 `fetchProvider: http` 一起设置。确认:菜单显示 DeepSeek Search API,且搜索不再追加 `web/deepseek-search-llm-request` 事件。
|
||||
3. 要通过网关使用 Messages 搜索,在该菜单中选择 DeepSeek 服务端搜索,把网关的 Anthropic 兼容基础地址(到 `/messages` 之前为止)作为其 Base URL 保存,或设置 `web-search-deepseek.baseURL`;如果其他模型应继续使用 Search API,再重新选择「自动选择」。确认:DeepSeek 模型上的搜索返回结果,且其 `web/deepseek-search-llm-request` 事件指向网关端点。
|
||||
@@ -464,7 +464,11 @@
|
||||
# The shared base enables the stable model-facing web_search and web_fetch
|
||||
# tools. The Web app disables this host row and composes both tools per agent
|
||||
# preset; products with a stricter network policy override tool-web. Search
|
||||
# defaults to the DeepSeek Search API (deepseek-search-api) and fetch to the
|
||||
# composes no fixed provider, so dsh-web selects per model provider route:
|
||||
# legacy Messages search (deepseek-official) for a conversation on a DeepSeek
|
||||
# model route, because DeepSeek makes no per-search charge for it, and the
|
||||
# DeepSeek Search API (deepseek-search-api) for every other route. Fetch
|
||||
# defaults to the
|
||||
# anonymous local fetcher (http). The DeepSeek Search and Fetch APIs
|
||||
# (deepseek-search-api, deepseek-fetch-api) follow the conversation: on the
|
||||
# deepseek-account route they send the account token to that route's
|
||||
@@ -472,8 +476,8 @@
|
||||
# origin, so a DEEPSEEK_API_KEY alone serves both without a sign-in.
|
||||
# searchBaseURL / searchApiKeyEnv (fetch* for Fetch) pin one capability to
|
||||
# its own endpoint and key instead.
|
||||
# Legacy Messages search (deepseek-official) is selectable separately and
|
||||
# uses its own endpoint, with the account token or DEEPSEEK_API_KEY.
|
||||
# Legacy Messages search uses its own endpoint, with the account token or
|
||||
# DEEPSEEK_API_KEY.
|
||||
# Anonymous fetch accepts only public
|
||||
# HTTP(S) destinations, resolves and validates every destination, and pins
|
||||
# every actual connection. This composition gives web_search 60s whichever
|
||||
@@ -484,7 +488,6 @@
|
||||
- id: web
|
||||
name: '@deepseek-ai/dsh-web'
|
||||
config:
|
||||
searchProvider: deepseek-search-api
|
||||
fetchProvider: http
|
||||
|
||||
- id: web-search-deepseek
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('dsh-base bundle', () => {
|
||||
})
|
||||
expect(rows.filter(row => row.id === 'subagent-codex')).toHaveLength(0)
|
||||
expect(rows.filter(row => row.id === 'subagent-claude-code')).toHaveLength(0)
|
||||
expect(rows.find(row => row.id === 'web')?.config).toEqual({ searchProvider: 'deepseek-search-api', fetchProvider: 'http' })
|
||||
expect(rows.find(row => row.id === 'web')?.config).toEqual({ fetchProvider: 'http' })
|
||||
expect(rows.find(row => row.id === 'web-deepseek-api')).toEqual({ id: 'web-deepseek-api', name: '@deepseek-ai/dsh-web-deepseek-api' })
|
||||
expect(rows.find(row => row.id === 'web-fetch-http')).toBeDefined()
|
||||
expect(rows.find(row => row.id === 'web-search-deepseek')).toMatchObject({
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 09388d293f9be9cb
|
||||
/deepseek-ai-dsh-client-ui-settings-web-search/use-this-package:
|
||||
en: b00497ce4cf39d47
|
||||
zh: 9663997b7a4cc959
|
||||
en: 51188b15f7c1549a
|
||||
zh: 4504aa62dd90cd9e
|
||||
/deepseek-ai-dsh-client-ui-settings-web-search/understand-the-implementation:
|
||||
en: 836d3f3032033148
|
||||
zh: f5b5c1ee14450ab5
|
||||
@@ -30,8 +30,8 @@
|
||||
en: ca75c51c89c2c9b0
|
||||
zh: 6e1c9a8fdde89577
|
||||
/deepseek-ai-dsh-client-ui-settings-web-search/known-limitations-and-deferred-work:
|
||||
en: 5c6dad603abec1c3
|
||||
zh: a594f9def4ef8215
|
||||
en: 2e6d123d575e854b
|
||||
zh: cbcbc049d1f4a03b
|
||||
/deepseek-ai-dsh-client-ui-settings-web-search/known-limitations-and-deferred-work/dev-note:
|
||||
en: e67f633dc6fe7773
|
||||
zh: e88aeb617ffb74ea
|
||||
@@ -25,11 +25,11 @@ Open **Plugins** in the sidebar and select **Web search and fetch** in the Offic
|
||||
<a id="use-this-package"></a>
|
||||
## Use this package
|
||||
|
||||
The **Web search and fetch** card in the Official group opens the page. It has a **Web search provider** section and a **Web fetch provider** section, each with a provider menu directly under its title. A menu lists every provider the Host registers, including providers that plugins register, so a newly installed provider needs no change to this page; [Add another provider](../../web/web/README.md#adding-a-provider) shows how to mount one in a profile. The official ones come first while registered: the Search menu lists **DeepSeek Search API** (`deepseek-search-api`) followed by **DeepSeek (legacy)** (`deepseek-official`), and the Fetch menu lists **Direct fetch** (`http`) and then **DeepSeek Fetch API** (`deepseek-fetch-api`); every other provider follows in registration order and shows its registered title or id. The shipped composition selects DeepSeek Search API for Search and Direct fetch for Fetch, and a selection stored in settings or composed by the deployment still applies; opening the page writes nothing. Each menu has no label of its own; its accessible name is its section title followed by the selected provider, such as **Web search provider DeepSeek Search API**. A selected id the Host does not register appears as an extra **(not loaded)** entry and stays selected. While the deployment composes no provider for a capability, its menu starts with **Automatic**, which clears the stored selection so the Host chooses again. Selecting the deployment's composed provider clears the stored selection instead of writing a copy. When the provider list cannot be read, each section says its menu may be incomplete and offers **Retry**; the menus keep the last list read, or only the selected ids before any list arrives. Under each menu, the section shows the `description` the selected provider registered, in the active language, as plain text; a provider that registers none, or a selected id the Host does not register, shows no description. The official providers' descriptions state each one's credentials, charges, model calls, reachable addresses, and content limits, and Direct fetch's ends by suggesting DeepSeek Fetch API as plain text. A plugin provider's section adds, after its description, that it is configured in that plugin's own settings.
|
||||
The **Web search and fetch** card in the Official group opens the page. It has a **Web search provider** section and a **Web fetch provider** section, each with a provider menu directly under its title. A menu lists every provider the Host registers, including providers that plugins register, so a newly installed provider needs no change to this page; [Add another provider](../../web/web/README.md#adding-a-provider) shows how to mount one in a profile. The official ones come first while registered: the Search menu lists **DeepSeek Search API** (`deepseek-search-api`) followed by **DeepSeek server-side search** (`deepseek-official`), and the Fetch menu lists **Direct fetch** (`http`) and then **DeepSeek Fetch API** (`deepseek-fetch-api`); every other provider follows in registration order and shows its registered title or id. The shipped composition selects no Search provider and Direct fetch for Fetch, and a selection stored in settings or composed by the deployment still applies; opening the page writes nothing. Each menu has no label of its own; its accessible name is its section title followed by the selected provider, such as **Web search provider Automatic**. A selected id the Host does not register appears as an extra **(not loaded)** entry and stays selected. While the deployment composes no provider for a capability, its menu starts with **Automatic**, which clears the stored selection so the Host chooses again. Under automatic Search selection the section states the Host's choice: DeepSeek server-side search, which has no per-search charge, for a conversation on a DeepSeek model and DeepSeek Search API for other models ([provider selection](../../web/web/README.md#provider-selection)), followed by the DeepSeek Search & Fetch guide link, which states the Search API's charges; it shows no provider panel, so the settings of either provider are edited after selecting it. Selecting the deployment's composed provider clears the stored selection instead of writing a copy. When the provider list cannot be read, each section says its menu may be incomplete and offers **Retry**; the menus keep the last list read, or only the selected ids before any list arrives. Under each menu, the section shows the `description` the selected provider registered, in the active language, as plain text; a provider that registers none, or a selected id the Host does not register, shows no description. The official providers' descriptions state each one's credentials, charges, model calls, reachable addresses, and content limits, and Direct fetch's ends by suggesting DeepSeek Fetch API as plain text. A plugin provider's section adds, after its description, that it is configured in that plugin's own settings.
|
||||
|
||||
Under **Web search provider**, DeepSeek Search API adds a link to the DeepSeek search and fetch guide after its description, and a gray panel below the menu holds **Results per search** (an integer from 1 through 50, default 10; invalid counts block saving). The DeepSeek Fetch API section shows its provider menu and description. Each API's panel holds a **Billing** menu, writing `web-deepseek-api.searchBilling` or `fetchBilling`, with the selected billing's explanation below it: **Automatic** (`auto`, the default) uses the conversation's DeepSeek account or API key when it chats on DeepSeek, and otherwise the DeepSeek API key, then the signed-in DeepSeek account; **Signed-in DeepSeek account** (`account`) and **DeepSeek API key** (`api-key`) use only that credential. Selecting the deployment's composed billing, `auto` when it composes none, clears the stored billing. The page does not show whether the selected credential is available. The APIs' own endpoint fields are YAML-only and take precedence over billing ([web-deepseek-api authentication](../../web/web-deepseek-api/README.md#authentication)); while a capability has a non-empty `*BaseURL` or `*ApiKeyEnv`, its **Billing** label carries an **Overridden by** tag naming the set fields, and its menu is disabled. The page reads these fields and never writes or clears them. A provider with no settings on this page, such as Direct fetch or a plugin provider, shows no panel. Every control sits directly in its section; nothing is collapsed.
|
||||
|
||||
**DeepSeek (legacy)** shows its API key, independent Messages Base URL, and **Maximum searches per request** (`maxUses`, a positive integer, default 5) in the same panel layout. The key writes the `web-search-deepseek.apiKeyEnv` reference (`DEEPSEEK_API_KEY` by default); endpoint and limit writes stay in `web-search-deepseek`, separate from API settings. Switching away drops an unsaved key but preserves endpoint and limit settings.
|
||||
**DeepSeek server-side search** shows its API key, independent Messages Base URL, and **Maximum searches per request** (`maxUses`, a positive integer, default 5) in the same panel layout. The key writes the `web-search-deepseek.apiKeyEnv` reference (`DEEPSEEK_API_KEY` by default); endpoint and limit writes stay in `web-search-deepseek`, separate from API settings. Switching away drops an unsaved key but preserves endpoint and limit settings.
|
||||
|
||||
Value fields render the effective value, carry an **Overridden** badge with **Reset to default** once overridden, and save as a reset when emptied; a value equal to the deployment default saves as an override. The provider menus are disabled while an invalid edit or a failed save is staged, so a field the change would hide stays visible.
|
||||
|
||||
@@ -74,7 +74,7 @@ None; this package neither assembles nor sends a provider request.
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- **Automatic selection reads only the deployment composition** — a menu offers it when the composition layer sets no provider for that capability. While automatic selection applies, the Host's `DSH_WEB_SEARCH_PROVIDER` or `DSH_WEB_FETCH_PROVIDER` environment variable picks the provider instead, and the page does not show that choice. Without either, automatic selection with more than one usable registered provider makes each operation fail with `WEB_PROVIDER_AMBIGUOUS`.
|
||||
- **Automatic selection reads only the deployment composition** — a menu offers it when the composition layer sets no provider for that capability. While automatic selection applies, the Host's `DSH_WEB_SEARCH_PROVIDER` or `DSH_WEB_FETCH_PROVIDER` environment variable picks the provider instead, and the page does not show that choice. Without either, automatic Fetch selection with more than one usable registered provider makes each operation fail with `WEB_PROVIDER_AMBIGUOUS`, and so does automatic Search selection when the Host does not register the DeepSeek provider it prefers for the conversation's model. The line under automatic Search selection is fixed copy that describes the Host with both DeepSeek search providers registered.
|
||||
|
||||
- **Billing availability is not shown** — the page does not report that the selected billing has no signed-in account or no configured key; reading sign-in state needs the account remote, and the key reference of the DeepSeek API-key model provider is not visible to this page. An unavailable billing withholds the web tool from the model.
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ kind: "package-reference"
|
||||
<a id="use-this-package"></a>
|
||||
## 使用本包
|
||||
|
||||
官方分组里的**网页搜索与获取**卡片打开这一页。页面分为**网页搜索提供方**与**网页获取提供方**两节,每节标题下方紧接一个提供方下拉框。下拉框列出 Host 注册的全部提供方,包括插件注册的提供方,因此新安装的提供方无需修改本页;在 profile 中挂载提供方的方法见[添加其他提供方](../../web/web/README.zh.md#adding-a-provider)。已注册的官方提供方排在最前:搜索下拉框依次为 **DeepSeek Search API**(`deepseek-search-api`)与 **DeepSeek(旧版)**(`deepseek-official`),获取下拉框依次为**本机直接获取**(`http`)和 **DeepSeek Fetch API**(`deepseek-fetch-api`);其他提供方按注册顺序排在其后,显示其注册的标题或 id。随附组合默认搜索选择 DeepSeek Search API、获取选择本机直接获取,设置中已存的选择或部署组合的选择仍然生效;打开页面不会写入任何内容。下拉框没有单独的标签,其无障碍名称由所在节的标题和当前选中的提供方组成,例如**网页搜索提供方 DeepSeek Search API**。Host 未注册的已选 id 额外显示为一项**(未加载)**,并保持选中。部署没有为某项能力组合提供方时,其下拉框首项为**自动选择**,选中它会清除已存的选择,由 Host 重新选择。选择部署组合的提供方时清除已存的选择,而不写入一份副本。提供方列表读取失败时,每节提示其下拉框可能不完整并提供**重试**;下拉框保留上一次读到的列表,尚未读到任何列表时只包含已选 id。每节在下拉框下方以纯文本显示所选提供方注册的 `description`(按当前语言);未注册说明的提供方或 Host 未注册的已选 id 不显示说明。官方提供方的说明写明各自的凭据、计费、模型调用、可访问的地址和内容限制,本机直接获取的说明末尾以纯文本建议改用 DeepSeek Fetch API。插件提供方所在的节在其说明之后提示到该插件自己的设置中配置。
|
||||
官方分组里的**网页搜索与获取**卡片打开这一页。页面分为**网页搜索提供方**与**网页获取提供方**两节,每节标题下方紧接一个提供方下拉框。下拉框列出 Host 注册的全部提供方,包括插件注册的提供方,因此新安装的提供方无需修改本页;在 profile 中挂载提供方的方法见[添加其他提供方](../../web/web/README.zh.md#adding-a-provider)。已注册的官方提供方排在最前:搜索下拉框依次为 **DeepSeek Search API**(`deepseek-search-api`)与 **DeepSeek 服务端搜索**(`deepseek-official`),获取下拉框依次为**本机直接获取**(`http`)和 **DeepSeek Fetch API**(`deepseek-fetch-api`);其他提供方按注册顺序排在其后,显示其注册的标题或 id。随附组合不为搜索选择提供方、获取选择本机直接获取,设置中已存的选择或部署组合的选择仍然生效;打开页面不会写入任何内容。下拉框没有单独的标签,其无障碍名称由所在节的标题和当前选中的提供方组成,例如**网页搜索提供方 自动选择**。Host 未注册的已选 id 额外显示为一项**(未加载)**,并保持选中。部署没有为某项能力组合提供方时,其下拉框首项为**自动选择**,选中它会清除已存的选择,由 Host 重新选择。搜索为自动选择时,该节说明 Host 的选择:会话使用 DeepSeek 模型时用不按次收费的 DeepSeek 服务端搜索,使用其他模型时用 DeepSeek Search API([提供方选择](../../web/web/README.zh.md#provider-selection)),其后是说明 Search API 收费方式的 DeepSeek 网页搜索与获取指南链接;此时不显示提供方面板,因此两个提供方的设置都要在选中它之后编辑。选择部署组合的提供方时清除已存的选择,而不写入一份副本。提供方列表读取失败时,每节提示其下拉框可能不完整并提供**重试**;下拉框保留上一次读到的列表,尚未读到任何列表时只包含已选 id。每节在下拉框下方以纯文本显示所选提供方注册的 `description`(按当前语言);未注册说明的提供方或 Host 未注册的已选 id 不显示说明。官方提供方的说明写明各自的凭据、计费、模型调用、可访问的地址和内容限制,本机直接获取的说明末尾以纯文本建议改用 DeepSeek Fetch API。插件提供方所在的节在其说明之后提示到该插件自己的设置中配置。
|
||||
|
||||
**网页搜索提供方**一节中,DeepSeek Search API 在说明之后显示 DeepSeek 网页搜索与获取指南链接,下拉框下方的灰色面板中是**每次搜索结果数**(1–50 的整数,默认 10;无效值阻止保存)。DeepSeek Fetch API 所在节显示提供方下拉框及说明。每个 API 的面板中有一个**计费方式**下拉框,写入 `web-deepseek-api.searchBilling` 或 `fetchBilling`,下方显示所选计费方式的说明:**自动**(`auto`,默认)在会话使用 DeepSeek 模型时沿用其账号或 API Key,否则依次使用 DeepSeek API Key、已登录的 DeepSeek 账号;**已登录的 DeepSeek 账号**(`account`)和 **DeepSeek API Key**(`api-key`)只使用该凭据。选择部署组合的计费方式(未组合时为 `auto`)会清除已存的计费方式。页面不显示所选凭据当前是否可用。两个 API 单独配置的端点字段只能在 YAML 中设置,并优先于计费方式([web-deepseek-api 鉴权](../../web/web-deepseek-api/README.zh.md#authentication));某一能力的 `*BaseURL` 或 `*ApiKeyEnv` 非空时,其**计费方式**标题旁显示**已被…覆盖**标签并列出已设置的字段,下拉框不可用。页面只读取这些字段,从不写入或清除。在本页没有设置项的提供方(例如本机直接获取或插件提供方)不显示面板。所有控件直接位于所在节中,没有折叠区。
|
||||
|
||||
**DeepSeek(旧版)**在同样的面板布局中显示 API Key、独立的 Messages Base URL 与**单次请求最多搜索次数**(`maxUses`,正整数,默认 5)。密钥写入 `web-search-deepseek.apiKeyEnv` 指向的引用(默认 `DEEPSEEK_API_KEY`);端点和次数上限写入 `web-search-deepseek`,与 API 设置分开。切换其他提供方会丢弃未保存的密钥,但保留端点和次数设置。
|
||||
**DeepSeek 服务端搜索**在同样的面板布局中显示 API Key、独立的 Messages Base URL 与**单次请求最多搜索次数**(`maxUses`,正整数,默认 5)。密钥写入 `web-search-deepseek.apiKeyEnv` 指向的引用(默认 `DEEPSEEK_API_KEY`);端点和次数上限写入 `web-search-deepseek`,与 API 设置分开。切换其他提供方会丢弃未保存的密钥,但保留端点和次数设置。
|
||||
|
||||
数值字段显示生效值,一旦被覆盖就带**已覆盖**标签和**恢复默认**,清空后保存等于重置;填写部署默认值则作为覆盖值保存。暂存了无效编辑或保存失败时提供方下拉框不可用,以免切换后隐藏的字段不再可见。
|
||||
|
||||
@@ -74,7 +74,7 @@ kind: "package-reference"
|
||||
|
||||
<a id="known-limitations-and-deferred-work"></a>
|
||||
|
||||
- **自动选择只看部署组合层**——组合层没有为该能力设置提供方时,下拉框才提供自动选择。自动选择生效时,Host 的 `DSH_WEB_SEARCH_PROVIDER` 或 `DSH_WEB_FETCH_PROVIDER` 环境变量会改为由它指定提供方,而页面不会显示这一选择。两者都没有时,如果注册了多个可用提供方,自动选择会让每次操作以 `WEB_PROVIDER_AMBIGUOUS` 失败。
|
||||
- **自动选择只看部署组合层**——组合层没有为该能力设置提供方时,下拉框才提供自动选择。自动选择生效时,Host 的 `DSH_WEB_SEARCH_PROVIDER` 或 `DSH_WEB_FETCH_PROVIDER` 环境变量会改为由它指定提供方,而页面不会显示这一选择。两者都没有时,如果注册了多个可用提供方,获取的自动选择会让每次操作以 `WEB_PROVIDER_AMBIGUOUS` 失败;Host 没有注册它为会话模型优先选用的 DeepSeek 提供方时,搜索的自动选择同样如此。搜索自动选择下方的说明是固定文案,描述的是两个 DeepSeek 搜索提供方都已注册的 Host。
|
||||
|
||||
- **不显示计费方式是否可用**——所选计费方式没有已登录账号或没有配置密钥时,页面不会提示;读取登录状态需要账号 remote,而本页看不到 DeepSeek API Key 模型提供方实际使用的密钥引用。不可用的计费方式会让模型看不到对应的网页工具。
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ export function WebSearchCard(props: WebSearchCardProps) {
|
||||
const description = section.options.find(option => option.id === section.selected)?.description
|
||||
return description === undefined ? undefined : props.resolveText(description) || undefined
|
||||
}
|
||||
// Automatic Search selection names no provider, so the page states which provider the Host runs.
|
||||
const searchAuto = search.auto && search.selected === AUTO_ID
|
||||
return (
|
||||
<SettingsForm labels={formLabels(t)} state={state} onSave={props.save} onDiscard={props.discard}>
|
||||
<section className={styles.section} aria-labelledby="plugin-config-web-search-section">
|
||||
@@ -72,8 +74,8 @@ export function WebSearchCard(props: WebSearchCardProps) {
|
||||
<ProviderSelect id="plugin-config-web-search-provider" labelledBy="plugin-config-web-search-section" t={t}
|
||||
section={search} disabled={menuDisabled} field="searchProvider" onSelect={props.selectProvider}
|
||||
providersFailed={state.providersFailed} onRetry={props.retryProviders}
|
||||
description={describe(search)}
|
||||
hint={search.kind === 'deepseek'
|
||||
description={searchAuto ? t('searchAutoHint') : describe(search)}
|
||||
hint={search.kind === 'deepseek' || searchAuto
|
||||
? <a className={styles.link} href={t('searchGuideUrl')} target="_blank" rel="noopener noreferrer">{t('searchGuide')}</a>
|
||||
: search.kind === 'plugin' ? t('pluginProviderHint') : undefined} />
|
||||
{search.kind === 'deepseek' && (
|
||||
@@ -267,7 +269,7 @@ function ProviderSelect(props: {
|
||||
disabled: boolean
|
||||
field: keyof WebProviderSelection
|
||||
onSelect: WebSearchCardFace['selectProvider']
|
||||
/** The selected provider's registered description, resolved to the active language, if it has one. */
|
||||
/** The selected provider's registered description in the active language, or the page's line for automatic selection, if any. */
|
||||
description: string | undefined
|
||||
/** The page's own line about the selected provider, after its description, if it has one. */
|
||||
hint: ReactNode
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { SettingsFormLabels } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
/** Locale keys the page renders. */
|
||||
export type WebSearchSettingsLocaleKey =
|
||||
| 'title' | 'description' | 'searchSection' | 'fetchSection'
|
||||
| 'providerDeepSeek' | 'providerLocal' | 'providerDeepSeekFetch' | 'providerMissing' | 'providerAuto'
|
||||
| 'providerDeepSeek' | 'providerLocal' | 'providerDeepSeekFetch' | 'providerMissing' | 'providerAuto' | 'searchAutoHint'
|
||||
| 'providerLegacy' | 'legacyKeyHint' | 'maxUses' | 'maxUsesHint' | 'invalidMaxUses'
|
||||
| 'providersFailed' | 'retry'
|
||||
| 'pluginProviderHint' | 'searchGuide' | 'searchGuideUrl'
|
||||
@@ -24,7 +24,7 @@ export const en: Record<WebSearchSettingsLocaleKey, string> = {
|
||||
searchSection: 'Web search provider',
|
||||
fetchSection: 'Web fetch provider',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (legacy)',
|
||||
providerLegacy: 'DeepSeek server-side search',
|
||||
legacyKeyHint: 'Uses the signed-in account on account-model requests; otherwise uses this API key ({ref}), shared with Models by default.',
|
||||
maxUses: 'Maximum searches per request',
|
||||
maxUsesHint: 'Maximum server-side searches per Messages request: a positive integer, default 5.',
|
||||
@@ -33,6 +33,7 @@ export const en: Record<WebSearchSettingsLocaleKey, string> = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (not loaded)',
|
||||
providerAuto: 'Automatic',
|
||||
searchAutoHint: "Follows the conversation's model: DeepSeek models use DeepSeek server-side search, which has no per-search charge; other models use DeepSeek Search API.",
|
||||
providersFailed: "Couldn't load the provider list, so this menu may be incomplete.",
|
||||
retry: 'Retry',
|
||||
pluginProviderHint: 'Configure this provider in its own plugin settings.',
|
||||
@@ -71,7 +72,7 @@ export const zh: Record<WebSearchSettingsLocaleKey, string> = {
|
||||
searchSection: '网页搜索提供方',
|
||||
fetchSection: '网页获取提供方',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek(旧版)',
|
||||
providerLegacy: 'DeepSeek 服务端搜索',
|
||||
legacyKeyHint: '账号模型发起的请求使用已登录账号;其他请求使用此 API Key({ref}),默认与「模型」页共用',
|
||||
maxUses: '单次请求最多搜索次数',
|
||||
maxUsesHint: '每次 Messages 请求允许的服务端搜索次数上限,须为正整数,默认 5',
|
||||
@@ -80,6 +81,7 @@ export const zh: Record<WebSearchSettingsLocaleKey, string> = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id}(未加载)',
|
||||
providerAuto: '自动选择',
|
||||
searchAutoHint: '跟随当前会话的模型:DeepSeek 模型使用 DeepSeek 服务端搜索,搜索不按次收费;其他模型使用 DeepSeek Search API。',
|
||||
providersFailed: '无法读取提供方列表,此菜单可能不完整',
|
||||
retry: '重试',
|
||||
pluginProviderHint: '请在该插件自己的设置中配置',
|
||||
@@ -127,7 +129,7 @@ export const ja = {
|
||||
'searchSection': 'Web 検索プロバイダー',
|
||||
'fetchSection': 'Web 取得プロバイダー',
|
||||
'providerDeepSeek': 'DeepSeek Search API',
|
||||
'providerLegacy': 'DeepSeek(旧版)',
|
||||
'providerLegacy': 'DeepSeek サーバー側検索',
|
||||
'legacyKeyHint': 'アカウントモデルのリクエストではログイン中のアカウントを使い、それ以外ではこの API キー({ref}、既定ではモデル設定と共有)を使います。',
|
||||
'maxUses': 'リクエストごとの最大検索回数',
|
||||
'maxUsesHint': 'Messages リクエストごとのサーバー側検索回数の上限です。正の整数で、既定値は 5 です。',
|
||||
@@ -136,6 +138,7 @@ export const ja = {
|
||||
'providerDeepSeekFetch': 'DeepSeek Fetch API',
|
||||
'providerMissing': '{id}(未読み込み)',
|
||||
'providerAuto': '自動',
|
||||
'searchAutoHint': '会話のモデルに従います。DeepSeek モデルでは検索ごとの料金がかからない DeepSeek サーバー側検索を、他のモデルでは DeepSeek Search API を使います。',
|
||||
'providersFailed': 'プロバイダー一覧を読み込めなかったため、このメニューは不完全な可能性があります。',
|
||||
'retry': '再試行',
|
||||
'pluginProviderHint': 'このプロバイダーは、そのプラグイン自身の設定で構成してください。',
|
||||
@@ -174,7 +177,7 @@ export const es = {
|
||||
searchSection: 'Proveedor de búsqueda web',
|
||||
fetchSection: 'Proveedor de obtención web',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (heredado)',
|
||||
providerLegacy: 'Búsqueda en servidor de DeepSeek',
|
||||
legacyKeyHint: 'Las solicitudes del modelo de cuenta usan la cuenta conectada; las demás usan esta clave API ({ref}), compartida con Modelos de forma predeterminada.',
|
||||
maxUses: 'Búsquedas máximas por solicitud',
|
||||
maxUsesHint: 'Máximo de búsquedas del servidor por solicitud Messages: entero positivo, predeterminado 5.',
|
||||
@@ -183,6 +186,7 @@ export const es = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (no cargado)',
|
||||
providerAuto: 'Automático',
|
||||
searchAutoHint: 'Sigue el modelo de la conversación: los modelos de DeepSeek usan la búsqueda en servidor de DeepSeek, sin cargo por búsqueda; los demás modelos usan DeepSeek Search API.',
|
||||
providersFailed: 'No se pudo cargar la lista de proveedores, por lo que este menú puede estar incompleto.',
|
||||
retry: 'Reintentar',
|
||||
pluginProviderHint: 'Configure este proveedor en la configuración de su propio complemento.',
|
||||
@@ -221,7 +225,7 @@ export const fr = {
|
||||
searchSection: 'Fournisseur de recherche web',
|
||||
fetchSection: 'Fournisseur de récupération web',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (ancienne version)',
|
||||
providerLegacy: 'Recherche côté serveur DeepSeek',
|
||||
legacyKeyHint: 'Les requêtes du modèle de compte utilisent le compte connecté ; les autres utilisent cette clé API ({ref}), partagée avec Modèles par défaut.',
|
||||
maxUses: 'Recherches maximales par requête',
|
||||
maxUsesHint: 'Maximum de recherches côté serveur par requête Messages : entier positif, 5 par défaut.',
|
||||
@@ -230,6 +234,7 @@ export const fr = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (non chargé)',
|
||||
providerAuto: 'Automatique',
|
||||
searchAutoHint: 'Suit le modèle de la conversation : les modèles DeepSeek utilisent la recherche côté serveur DeepSeek, sans frais par recherche ; les autres modèles utilisent DeepSeek Search API.',
|
||||
providersFailed: 'Impossible de charger la liste des fournisseurs ; ce menu peut être incomplet.',
|
||||
retry: 'Réessayer',
|
||||
pluginProviderHint: 'Configurez ce fournisseur dans les paramètres de son propre plugin.',
|
||||
@@ -268,7 +273,7 @@ export const de = {
|
||||
searchSection: 'Anbieter für Websuche',
|
||||
fetchSection: 'Anbieter für Webabruf',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (Legacy)',
|
||||
providerLegacy: 'DeepSeek-Serversuche',
|
||||
legacyKeyHint: 'Kontomodellanfragen verwenden das angemeldete Konto; andere verwenden diesen API-Schlüssel ({ref}), standardmäßig mit Modelle geteilt.',
|
||||
maxUses: 'Maximale Suchen pro Anfrage',
|
||||
maxUsesHint: 'Maximale serverseitige Suchen pro Messages-Anfrage: positive Ganzzahl, Standard 5.',
|
||||
@@ -277,6 +282,7 @@ export const de = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (nicht geladen)',
|
||||
providerAuto: 'Automatisch',
|
||||
searchAutoHint: 'Folgt dem Modell der Unterhaltung: DeepSeek-Modelle verwenden die DeepSeek-Serversuche ohne Kosten pro Suche; andere Modelle verwenden DeepSeek Search API.',
|
||||
providersFailed: 'Die Anbieterliste konnte nicht geladen werden, daher ist dieses Menü möglicherweise unvollständig.',
|
||||
retry: 'Erneut versuchen',
|
||||
pluginProviderHint: 'Konfigurieren Sie diesen Anbieter in den Einstellungen seines eigenen Plugins.',
|
||||
@@ -315,7 +321,7 @@ export const ru = {
|
||||
searchSection: 'Поставщик веб-поиска',
|
||||
fetchSection: 'Поставщик загрузки веб-страниц',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (прежняя версия)',
|
||||
providerLegacy: 'Серверный поиск DeepSeek',
|
||||
legacyKeyHint: 'Запросы модели аккаунта используют активный аккаунт; остальные — этот ключ API ({ref}), по умолчанию общий с настройками моделей.',
|
||||
maxUses: 'Максимум поисков на запрос',
|
||||
maxUsesHint: 'Максимум серверных поисков на запрос Messages: положительное целое, по умолчанию 5.',
|
||||
@@ -324,6 +330,7 @@ export const ru = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (не загружен)',
|
||||
providerAuto: 'Автоматически',
|
||||
searchAutoHint: 'Следует модели разговора: модели DeepSeek используют серверный поиск DeepSeek без платы за каждый поиск; остальные модели используют DeepSeek Search API.',
|
||||
providersFailed: 'Не удалось загрузить список поставщиков, поэтому это меню может быть неполным.',
|
||||
retry: 'Повторить',
|
||||
pluginProviderHint: 'Настройте этого поставщика в настройках его собственного плагина.',
|
||||
@@ -362,7 +369,7 @@ export const pt = {
|
||||
searchSection: 'Provedor de pesquisa na web',
|
||||
fetchSection: 'Provedor de obtenção na web',
|
||||
providerDeepSeek: 'DeepSeek Search API',
|
||||
providerLegacy: 'DeepSeek (legado)',
|
||||
providerLegacy: 'Pesquisa no servidor da DeepSeek',
|
||||
legacyKeyHint: 'Pedidos do modelo de conta usam a conta conectada; os demais usam esta chave API ({ref}), compartilhada com Modelos por padrão.',
|
||||
maxUses: 'Máximo de pesquisas por pedido',
|
||||
maxUsesHint: 'Máximo de pesquisas no servidor por pedido Messages: inteiro positivo, padrão 5.',
|
||||
@@ -371,6 +378,7 @@ export const pt = {
|
||||
providerDeepSeekFetch: 'DeepSeek Fetch API',
|
||||
providerMissing: '{id} (não carregado)',
|
||||
providerAuto: 'Automático',
|
||||
searchAutoHint: 'Segue o modelo da conversa: os modelos da DeepSeek usam a pesquisa no servidor da DeepSeek, sem cobrança por pesquisa; os outros modelos usam DeepSeek Search API.',
|
||||
providersFailed: 'Não foi possível carregar a lista de provedores, por isso este menu pode estar incompleto.',
|
||||
retry: 'Tentar novamente',
|
||||
pluginProviderHint: 'Configure este provedor nas configurações do próprio plugin.',
|
||||
|
||||
@@ -207,8 +207,8 @@ describe('WebSearchCard billing', () => {
|
||||
describe('WebSearchCard', () => {
|
||||
it('offers legacy search in both locales and renders its own settings', () => {
|
||||
const { actions } = renderPage(legacy())
|
||||
expect(searchMenu().textContent).toBe('DeepSeek (legacy)')
|
||||
expect(zh.providerLegacy).toBe('DeepSeek(旧版)')
|
||||
expect(searchMenu().textContent).toBe('DeepSeek server-side search')
|
||||
expect(zh.providerLegacy).toBe('DeepSeek 服务端搜索')
|
||||
expect(screen.queryByLabelText(en.count)).toBeNull()
|
||||
fireEvent.change(screen.getByLabelText(en.credential), { target: { value: 'new-key' } })
|
||||
fireEvent.change(screen.getByLabelText(en.baseUrl), { target: { value: 'https://messages.test/v1' } })
|
||||
@@ -395,6 +395,27 @@ describe('WebSearchCard', () => {
|
||||
expect(actions.selectProvider).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('explains automatic Search selection with the guide link, and shows no provider panel under it', () => {
|
||||
const base = shipped()
|
||||
renderPage({ ...base, search: { ...base.search, selected: '', kind: 'none', auto: true } })
|
||||
expect(searchMenu().textContent).toBe(en.providerAuto)
|
||||
expect(screen.getByText(en.searchAutoHint)).toBeTruthy()
|
||||
expect(screen.getByRole('link', { name: en.searchGuide }).getAttribute('href')).toBe(en.searchGuideUrl)
|
||||
expect(screen.queryByLabelText(en.count)).toBeNull()
|
||||
})
|
||||
|
||||
it('does not explain automatic Search selection while a provider is selected or under automatic Fetch selection', () => {
|
||||
const base = shipped()
|
||||
renderPage({
|
||||
...base,
|
||||
search: { ...base.search, selected: 'deepseek-official', kind: 'none', auto: true },
|
||||
fetch: { ...base.fetch, selected: '', kind: 'none', auto: true },
|
||||
})
|
||||
expect(fetchMenu().textContent).toBe(en.providerAuto)
|
||||
expect(screen.queryByText(en.searchAutoHint)).toBeNull()
|
||||
expect(screen.queryByRole('link', { name: en.searchGuide })).toBeNull()
|
||||
})
|
||||
|
||||
it('reports a failed provider list read in each section and retries it', () => {
|
||||
const { actions } = renderPage({ ...shipped(), providersFailed: true })
|
||||
for (const name of [en.searchSection, en.fetchSection]) {
|
||||
|
||||
@@ -4551,7 +4551,7 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [
|
||||
{
|
||||
key: 'web',
|
||||
summary: 'The web access service.',
|
||||
description: 'The web access service. Registered as `ctx.web` (one instance per context) and exposed to Clients as the `web` Remote namespace (`listProviders`).\n\nSelection semantics (resolved at execution time, never order-dependent):\n\n- A configured id that is registered and `available()` → that provider.\n- A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.\n- A configured id registered but unavailable → `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.\n- No id configured, exactly one registered usable provider → that provider.\n- No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.\n- No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.',
|
||||
description: 'The web access service. Registered as `ctx.web` (one instance per context) and exposed to Clients as the `web` Remote namespace (`listProviders`).\n\nSelection semantics (resolved at execution time, never order-dependent):\n\n- A configured id that is registered and `available()` → that provider.\n- A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.\n- A configured id registered but unavailable → `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.\n- No search id configured, and the provider assigned to the route of the model request the search serves is usable → that provider: `deepseek-official` (Messages search) on the `deepseek-official` and `deepseek-account` routes, `deepseek-search-api` on every other route and outside a model request.\n- No id configured, exactly one registered usable provider → that provider.\n- No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.\n- No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.',
|
||||
methods: [
|
||||
{
|
||||
signature: 'registerSearchProvider(provider: WebSearchProvider): () => void',
|
||||
@@ -4574,7 +4574,7 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [
|
||||
{
|
||||
signature: 'async search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>',
|
||||
description: 'Run one search through the selected provider. Resolves the provider at call time with the selection rules above; throws WebError when the capability cannot run. The seam enforces `request.maxResults` on the result: if the provider over-returns, `sources[]` is truncated and `truncated` set.',
|
||||
parameters: [{ name: 'request', description: 'the query and optional result limit.' }, { name: 'signal', description: 'optional cancellation signal forwarded to the provider.' }],
|
||||
parameters: [{ name: 'request', description: 'the query, the optional result limit, and the route of the model request the search serves.' }, { name: 'signal', description: 'optional cancellation signal forwarded to the provider.' }],
|
||||
returns: 'the provider\'s results, capped to `request.maxResults`.',
|
||||
},
|
||||
{
|
||||
@@ -10602,7 +10602,7 @@ export const TYPE_API: readonly TypeApiEntry[] = [
|
||||
},
|
||||
{
|
||||
name: 'WebSearchRequest',
|
||||
declaration: 'export interface WebSearchRequest {\n readonly query: string;\n readonly maxResults?: number;\n}',
|
||||
declaration: 'export interface WebSearchRequest {\n readonly query: string;\n readonly maxResults?: number;\n readonly llmProvider?: string;\n}',
|
||||
},
|
||||
{
|
||||
name: 'WebSearchResult',
|
||||
|
||||
@@ -48,8 +48,8 @@
|
||||
en: 72bef08cbfa2f3a7
|
||||
zh: 0d504871abaf3cb2
|
||||
/deepseek-ai-dsh-tool-web/understand-the-implementation/search-flow:
|
||||
en: 80b7de753fe6b0de
|
||||
zh: 09727a7727248888
|
||||
en: e132415eb5d94d72
|
||||
zh: 1d1dde6eb983b683
|
||||
/deepseek-ai-dsh-tool-web/understand-the-implementation/readiness-flow:
|
||||
en: f5e46c1f6f713e72
|
||||
zh: 3c9a8b165c46d2b1
|
||||
|
||||
@@ -112,7 +112,7 @@ The package is built on one separation and one registration rule:
|
||||
|
||||
### Search flow
|
||||
|
||||
`web_search` validates the arguments (non-empty array, count bound, non-blank strings), collapses exact duplicates to first occurrence, then runs one to `searchMaxQueries` distinct searches concurrently through `ctx.web`. A failure aborts the batch via a fused signal; the call waits for every started search to settle before returning the first failure. Successful results merge round-robin by rank, deduplicate by URL, cap at `searchMaxResults`, and format into the model-facing text.
|
||||
`web_search` validates the arguments (non-empty array, count bound, non-blank strings), collapses exact duplicates to first occurrence, then runs one to `searchMaxQueries` distinct searches concurrently through `ctx.web`. Each search request carries, as `llmProvider`, the provider route of the calling Session's latest model request, which is the request that called the tool, so `ctx.web` selects the provider the step's readiness check asked. A failure aborts the batch via a fused signal; the call waits for every started search to settle before returning the first failure. Successful results merge round-robin by rank, deduplicate by URL, cap at `searchMaxResults`, and format into the model-facing text.
|
||||
|
||||
### Readiness flow
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ schema 校验会在执行前拒绝缺失或非数组的 `queries` 字段、非
|
||||
|
||||
### 搜索流程
|
||||
|
||||
`web_search` 校验参数(非空数组、数量上限、非空白字符串),把完全相同的重复查询折叠为首现位置,然后通过 `ctx.web` 并发执行 1 至 `searchMaxQueries` 个不同搜索。失败通过融合信号中止批次;调用会等待每个已启动搜索结算后才返回首次失败。成功结果按排名轮询合并、按 URL 去重、在 `searchMaxResults` 处截断,并格式化为面向模型的文本。
|
||||
`web_search` 校验参数(非空数组、数量上限、非空白字符串),把完全相同的重复查询折叠为首现位置,然后通过 `ctx.web` 并发执行 1 至 `searchMaxQueries` 个不同搜索。每个搜索请求都在 `llmProvider` 中携带发起调用的 Session 最近一次模型请求(即调用该工具的请求)的提供方路由,因此 `ctx.web` 选中的就是该步骤就绪判断所询问的提供方。失败通过融合信号中止批次;调用会等待每个已启动搜索结算后才返回首次失败。成功结果按排名轮询合并、按 URL 去重、在 `searchMaxResults` 处截断,并格式化为面向模型的文本。
|
||||
|
||||
### 就绪流程
|
||||
|
||||
|
||||
@@ -258,6 +258,7 @@ export function presentSearchResult(args: WebSearchArgs, result: ToolResult): We
|
||||
* @param ctx - context whose `web` service performs the searches.
|
||||
* @param queries - validated non-empty queries.
|
||||
* @param maxResults - the deployment's source cap for the combined result.
|
||||
* @param llmProvider - provider route of the model request that called the tool, when known.
|
||||
* @param signal - cancellation signal forwarded to every search.
|
||||
* @returns the combined search result.
|
||||
*/
|
||||
@@ -265,10 +266,12 @@ async function runSearchQueries(
|
||||
ctx: Context,
|
||||
queries: string[],
|
||||
maxResults: number,
|
||||
llmProvider: string | undefined,
|
||||
signal: AbortSignal,
|
||||
): Promise<WebSearchResult> {
|
||||
const route = llmProvider === undefined ? {} : { llmProvider }
|
||||
if (queries.length === 1) {
|
||||
return ctx.web.search({ query: queries[0] as string, maxResults }, signal)
|
||||
return ctx.web.search({ query: queries[0] as string, maxResults, ...route }, signal)
|
||||
}
|
||||
const controller = new AbortController()
|
||||
const batchSignal = AbortSignal.any([signal, controller.signal])
|
||||
@@ -276,7 +279,7 @@ async function runSearchQueries(
|
||||
const results: WebSearchResult[] = []
|
||||
const searches = queries.map(async (query, index) => {
|
||||
try {
|
||||
results[index] = await ctx.web.search({ query, maxResults }, batchSignal)
|
||||
results[index] = await ctx.web.search({ query, maxResults, ...route }, batchSignal)
|
||||
} catch (error) {
|
||||
if (firstFailure === undefined) firstFailure = { error }
|
||||
controller.abort(error)
|
||||
@@ -402,7 +405,9 @@ export function applyWebSearchTool(
|
||||
isConcurrencySafe: () => true,
|
||||
async execute(args, exec) {
|
||||
const queries = parseSearchArgs(args, maxQueries)
|
||||
const result = await runSearchQueries(ctx, queries, maxResults, exec.signal)
|
||||
// The latest request context names the route that served the model request which called this tool.
|
||||
const llmProvider = exec.agent?.session.requestContext()?.provider
|
||||
const result = await runSearchQueries(ctx, queries, maxResults, llmProvider, exec.signal)
|
||||
return {
|
||||
...result.content !== undefined ? { content: result.content } : {},
|
||||
sources: result.sources.map(source => modelSource(source, summaryMaxChars)),
|
||||
|
||||
@@ -36,7 +36,7 @@ let handler: Handler
|
||||
let ctx: Context
|
||||
let fiber: Awaited<ReturnType<Context['plugin']>>
|
||||
// web_search and web_fetch are conditional registrations, so calls run inside an agent's step admission.
|
||||
const agent = { id: SessionId('tool-web-integration') } as Agent
|
||||
const agent = { id: SessionId('tool-web-integration'), session: { requestContext: () => undefined } } as Agent
|
||||
|
||||
beforeEach(async () => {
|
||||
handler = (_req, res) => { res.writeHead(200, { 'content-type': 'text/html' }); res.end('<h1>Hello</h1><p>World</p>') }
|
||||
|
||||
@@ -62,12 +62,25 @@ function searchProvider(result: WebSearchResult, isAvailable = available): WebSe
|
||||
return { id: 'stub-search', available: () => isAvailable, search: () => Promise.resolve(result) }
|
||||
}
|
||||
|
||||
/**
|
||||
* An agent whose Session reports `route` as the provider route of its latest model request.
|
||||
* @param id - the agent's Session id.
|
||||
* @param route - the route, or undefined for a Session that has made no model request.
|
||||
* @returns the agent fixture.
|
||||
*/
|
||||
function agentOnRoute(id: string, route?: string): Agent {
|
||||
const requestContext = () => route === undefined ? undefined : { provider: route, model: 'test' }
|
||||
return { id: SessionId(id), session: { requestContext } } as Agent
|
||||
}
|
||||
|
||||
/** Mount the real registry, seam, and tool-web; return an executor helper. */
|
||||
async function mountTools(opts: {
|
||||
config?: ToolWeb.Config
|
||||
webConfig?: { searchProvider?: string; fetchProvider?: string }
|
||||
search?: WebSearchProvider
|
||||
fetchProvider?: WebFetchProvider
|
||||
/** Provider route of the agent's latest model request. */
|
||||
route?: string
|
||||
} = {}): Promise<{ ctx: Context; agent: Agent; fiber: Awaited<ReturnType<Context['plugin']>>; call: (name: string, args: unknown) => Promise<ToolExecutionResult> }> {
|
||||
const ctx = new Context()
|
||||
await ctx.plugin(SystemPrompt)
|
||||
@@ -77,7 +90,7 @@ async function mountTools(opts: {
|
||||
if (opts.search) ctx.web.registerSearchProvider(opts.search)
|
||||
if (opts.fetchProvider) ctx.web.registerFetchProvider(opts.fetchProvider)
|
||||
const fiber = await ctx.plugin(ToolWeb, opts.config ?? {})
|
||||
const agent = { id: SessionId('tool-web') } as Agent
|
||||
const agent = agentOnRoute('tool-web', opts.route)
|
||||
await ctx.plugin(Object.assign((inner: Context) => { createScope(inner, agent) }, { inject: ['tools'] }))
|
||||
let counter = 0
|
||||
const call = (name: string, args: unknown) => executeInStep(ctx, agent, { signal: testToolSignal, callId: ToolCallId(`call-${++counter}`), name, arguments: args })
|
||||
@@ -767,6 +780,26 @@ describe('tool-web execution through the real registry', () => {
|
||||
await fiber.dispose()
|
||||
})
|
||||
|
||||
it.each([
|
||||
['Messages search for a model request on a DeepSeek model route', 'deepseek-account', 'deepseek-official'],
|
||||
['the Search API for a model request on another route', 'openai', 'deepseek-search-api'],
|
||||
['the Search API for a Session that has made no model request', undefined, 'deepseek-search-api'],
|
||||
])('with no provider configured, searches through %s', async (_label, route, expected) => {
|
||||
const requests: unknown[] = []
|
||||
const { ctx, fiber, call } = await mountTools(route === undefined ? {} : { route })
|
||||
for (const id of ['deepseek-search-api', 'deepseek-official']) {
|
||||
ctx.web.registerSearchProvider({
|
||||
id, available: () => available,
|
||||
search: (request) => { requests.push(request); return Promise.resolve({ content: id, sources: [], truncated: false }) },
|
||||
})
|
||||
}
|
||||
const out = await call('web_search', { queries: ['one', 'two'] })
|
||||
expect(out.isError).toBe(false)
|
||||
expect(out.value).toMatchObject({ content: `### one\n\n${expected}\n\n### two\n\n${expected}` })
|
||||
expect(requests).toEqual(['one', 'two'].map(query => ({ query, maxResults: 10, ...route === undefined ? {} : { llmProvider: route } })))
|
||||
await fiber.dispose()
|
||||
})
|
||||
|
||||
it.each([{}, { queries: [123] }])('rejects absent or wrongly typed queries with a structured INVALID_ARGS error', async (args) => {
|
||||
const { fiber, call } = await mountTools({ webConfig: { searchProvider: 'stub-search' }, search: searchProvider({ sources: [], truncated: false }) })
|
||||
const out = await call('web_search', args)
|
||||
@@ -1203,7 +1236,7 @@ describe('web tool admission per model step', () => {
|
||||
for (const provider of setup.providers) ctx.web.registerSearchProvider(provider)
|
||||
for (const provider of setup.fetchProviders ?? []) ctx.web.registerFetchProvider(provider)
|
||||
const fiber = await ctx.plugin(ToolWeb, {})
|
||||
const agent = { id: SessionId('web-search-admission') } as Agent
|
||||
const agent = agentOnRoute('web-search-admission')
|
||||
await ctx.plugin(Object.assign((inner: Context) => { createScope(inner, agent) }, { inject: ['tools'] }))
|
||||
const selection: ModelSelection = { provider: setup.route ?? 'deepseek-official', model: 'deepseek-v4-flash' }
|
||||
const step = async (): Promise<{ toolSet: ResolvedToolSet; tools: string[]; prompt: string }> => {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
en: 76368b6b1da79c80
|
||||
zh: 1e8f931a56b7d34d
|
||||
/deepseek-ai-dsh-web-deepseek-api/use-this-package:
|
||||
en: 673ba23a4e608cf2
|
||||
zh: 042afa607aaf4335
|
||||
en: 912a9cb542bc51fa
|
||||
zh: 0f6c1bc8d459d7a9
|
||||
/deepseek-ai-dsh-web-deepseek-api/use-this-package/authentication:
|
||||
en: b25cbe2a7894c03e
|
||||
zh: db47f20dffe77a30
|
||||
|
||||
@@ -24,7 +24,7 @@ Search and fetch the web through the DeepSeek Search and Fetch APIs: one direct
|
||||
<a id="use-this-package"></a>
|
||||
## Use this package
|
||||
|
||||
Mount the plugin alongside `dsh-web` and select its providers. Shipped profiles mount it and select its Search API (`deepseek-search-api`) for search and local HTTP fetch for fetch. In **Plugins > Built-in plugin settings > Web search and fetch**, choosing **DeepSeek Search API** in the **Search** menu selects `deepseek-search-api` and choosing **DeepSeek Fetch API** in the **Fetch** menu selects `deepseek-fetch-api`; each menu is saved independently, and choosing another entry restores another provider. While a menu selects one of these providers, its **Billing** menu below writes `searchBilling` or `fetchBilling`: **Automatic**, **Signed-in DeepSeek account**, or **DeepSeek API key**. A saved selection applies to the next operation.
|
||||
Mount the plugin alongside `dsh-web` and select its providers. Shipped profiles mount it, configure no search provider, and select local HTTP fetch for fetch; an unconfigured search runs its Search API (`deepseek-search-api`) except for a model request on a DeepSeek model route, which runs [legacy Messages search](../web/README.md#provider-selection). In **Plugins > Built-in plugin settings > Web search and fetch**, choosing **DeepSeek Search API** in the **Search** menu selects `deepseek-search-api` and choosing **DeepSeek Fetch API** in the **Fetch** menu selects `deepseek-fetch-api`; each menu is saved independently, and choosing another entry restores another provider. While a menu selects one of these providers, its **Billing** menu below writes `searchBilling` or `fetchBilling`: **Automatic**, **Signed-in DeepSeek account**, or **DeepSeek API key**. A saved selection applies to the next operation.
|
||||
|
||||
```yaml
|
||||
- name: '@deepseek-ai/dsh-web'
|
||||
|
||||
@@ -24,7 +24,7 @@ kind: "package-reference"
|
||||
<a id="use-this-package"></a>
|
||||
## 使用此包
|
||||
|
||||
将插件与 `dsh-web` 一起挂载,并选择它的提供方。内置配置挂载此插件,为搜索选择它的 Search API(`deepseek-search-api`),为抓取选择本地 HTTP 抓取。在**插件 > 内置插件配置 > 网页搜索与获取**中,在**搜索**下拉框选择 **DeepSeek Search API** 会选中 `deepseek-search-api`,在**获取**下拉框选择 **DeepSeek Fetch API** 会选中 `deepseek-fetch-api`;两个下拉框分别保存,选择其他条目即改用其他提供方。下拉框选中这两个提供方之一时,其下方的**计费方式**下拉框写入 `searchBilling` 或 `fetchBilling`:**自动**、**已登录的 DeepSeek 账号**或 **DeepSeek API Key**。保存的选择从下一次操作开始生效。
|
||||
将插件与 `dsh-web` 一起挂载,并选择它的提供方。内置配置挂载此插件,不配置搜索提供方,并为抓取选择本地 HTTP 抓取;未配置时搜索使用它的 Search API(`deepseek-search-api`),但为 DeepSeek 模型路由上的模型请求发起的搜索使用[旧版 Messages 搜索](../web/README.zh.md#provider-selection)。在**插件 > 内置插件配置 > 网页搜索与获取**中,在**搜索**下拉框选择 **DeepSeek Search API** 会选中 `deepseek-search-api`,在**获取**下拉框选择 **DeepSeek Fetch API** 会选中 `deepseek-fetch-api`;两个下拉框分别保存,选择其他条目即改用其他提供方。下拉框选中这两个提供方之一时,其下方的**计费方式**下拉框写入 `searchBilling` 或 `fetchBilling`:**自动**、**已登录的 DeepSeek 账号**或 **DeepSeek API Key**。保存的选择从下一次操作开始生效。
|
||||
|
||||
```yaml
|
||||
- name: '@deepseek-ai/dsh-web'
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
en: d152484eb41ac6b4
|
||||
zh: 09388d293f9be9cb
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package:
|
||||
en: e0d352d6402d9d3b
|
||||
zh: a449234557ef8bd6
|
||||
en: 9a454a87296117c4
|
||||
zh: 460c22441b1dab1f
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package/when-to-choose-it:
|
||||
en: 0187c8af8d2d98c5
|
||||
zh: 1c9607b3a662bcaa
|
||||
en: 60c58e847abc01ab
|
||||
zh: 730e65a38783002a
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package/minimal-configuration:
|
||||
en: 3ed88edabdf63c8d
|
||||
zh: c66176c8a7c9a434
|
||||
@@ -27,14 +27,14 @@
|
||||
en: 7a765ba931329067
|
||||
zh: 6fc14edcc378684a
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package/what-a-search-returns:
|
||||
en: e30442c90365357b
|
||||
zh: 9c9e2f1182963a8a
|
||||
en: 8f852321e5c111a7
|
||||
zh: ae43d88540e0ccde
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package/request-logging:
|
||||
en: 467b8238cf7e140c
|
||||
zh: 85a519c8811557aa
|
||||
/deepseek-ai-dsh-web-search-deepseek/use-this-package/failures-and-recovery:
|
||||
en: 8e69cf009b707c49
|
||||
zh: f7d50bfc06b01b6d
|
||||
en: 64814d2b8679eb05
|
||||
zh: 0234a8494663fc4e
|
||||
/deepseek-ai-dsh-web-search-deepseek/understand-the-implementation:
|
||||
en: 9842c69ad3636bb3
|
||||
zh: 3cdc3f816cbdd0cb
|
||||
@@ -45,8 +45,8 @@
|
||||
en: 6488e1c85646339f
|
||||
zh: 2b5ca1c6b5939a8c
|
||||
/deepseek-ai-dsh-web-search-deepseek/understand-the-implementation/request-flow:
|
||||
en: d6c3f30b70a5f4b5
|
||||
zh: ab7c5b7d6fc3cae6
|
||||
en: 9918bcc18ad1cf49
|
||||
zh: ba0a08146f74bdd2
|
||||
/deepseek-ai-dsh-web-search-deepseek/further-exploration:
|
||||
en: 3a650478cf33d792
|
||||
zh: ab4247c4c31f4a90
|
||||
@@ -69,8 +69,8 @@
|
||||
en: 666f5753c99783ab
|
||||
zh: b44328e99bcc45c9
|
||||
/deepseek-ai-dsh-web-search-deepseek/model-experience/conversation-tool-result-indirectly/what-the-model-sees:
|
||||
en: 0764d19c9b82aa98
|
||||
zh: 88b0ba22ef64225b
|
||||
en: 6df8e6cbf927a701
|
||||
zh: 82c4a625a9ec5957
|
||||
/deepseek-ai-dsh-web-search-deepseek/model-experience/conversation-tool-result-indirectly/token-effect:
|
||||
en: 01ec43a9b616139d
|
||||
zh: 0a5b7c28fde34bcf
|
||||
@@ -90,11 +90,11 @@
|
||||
en: 1d836a33dfa97fcf
|
||||
zh: 2593ccf2a5716b02
|
||||
/deepseek-ai-dsh-web-search-deepseek/known-limitations-and-deferred-work:
|
||||
en: 1cb15cc5e9b1967d
|
||||
zh: 64f1d93e94bbc9c3
|
||||
en: 3eb9f8b55ffc5305
|
||||
zh: 4f4bf14e3d695335
|
||||
/deepseek-ai-dsh-web-search-deepseek/known-limitations-and-deferred-work/dev-note:
|
||||
en: 7f775cc79dbce94b
|
||||
zh: 12b8f68f9e7c48ca
|
||||
/deepseek-ai-dsh-web-search-deepseek/known-limitations-and-deferred-work/dev-note/dedicated-retrieval-endpoint:
|
||||
en: 188ca3400a73352e
|
||||
zh: f948e2c565ec6ac1
|
||||
en: 33df5365305ef1d7
|
||||
zh: 3dff758d01d9bcd8
|
||||
@@ -25,11 +25,11 @@ With `dsh-web-search-deepseek`, the harness searches the web through DeepSeek's
|
||||
<a id="use-this-package"></a>
|
||||
## Use this package
|
||||
|
||||
Mount the provider in a composition that already loads the web service; it registers as the `deepseek-official` search provider, so `ctx.web.search()` resolves it automatically when it is the only usable search backend — or pin it with `searchProvider: deepseek-official`.
|
||||
Mount the provider in a composition that already loads the web service; it registers as the `deepseek-official` search provider, so `ctx.web.search()` resolves it automatically when it is the only usable search backend, and while no search provider is configured also for a model request on the `deepseek-official` or `deepseek-account` model route ([provider selection](../web/README.md#provider-selection)) — or pin it with `searchProvider: deepseek-official`.
|
||||
|
||||
### When to choose it
|
||||
|
||||
Choose this backend when a deployment wants DeepSeek's native server-side web search and its users either sign in to a DeepSeek account or hold a `DEEPSEEK_API_KEY` — the provider reuses those credentials as [Authentication](#authentication) describes. One search is heavier than a dedicated retrieval endpoint: DeepSeek runs the search inside a full model turn, so expect one Messages call's latency and generated tokens per search, with up to `maxUses` server-side searches per request. Avoid it when per-search cost or latency dominates.
|
||||
Choose this backend when a deployment wants DeepSeek's native server-side web search and its users either sign in to a DeepSeek account or hold a `DEEPSEEK_API_KEY` — the provider reuses those credentials as [Authentication](#authentication) describes. One search is heavier than a dedicated retrieval endpoint: DeepSeek runs the search inside a full model turn, so expect one Messages call's latency and generated tokens per search, with up to `maxUses` server-side searches per request. DeepSeek makes no per-search charge for it, so its cost is that model turn's tokens. Avoid it when latency dominates.
|
||||
|
||||
### Minimal configuration
|
||||
|
||||
@@ -66,7 +66,7 @@ Referenced keys use the [shared DeepSeek credential helpers](../../llm/llm-deeps
|
||||
|
||||
### What a search returns
|
||||
|
||||
`content` is always omitted: DeepSeek's provider prose is not trusted as an answer. `sources[]` comes from `web_search_result` items inside `web_search_tool_result` blocks — `url` and `title` directly, and `publishedAt` from `page_age` — with snippets joined from URL-keyed `cited_text` entries where an excerpt exists. Results are deduplicated by URL, and because DeepSeek exposes no result-count knob, the service enforces `maxResults` by truncating and flagging.
|
||||
`content` is always omitted: DeepSeek's provider prose is not trusted as an answer. `sources[]` comes from `web_search_result` items inside `web_search_tool_result` blocks — `url` and `title` directly, and `publishedAt` from `page_age` — and `snippet` from the item's own `snippet`, or for an item without one from the URL-keyed `cited_text` entry where an excerpt exists. Results are deduplicated by URL, and because DeepSeek exposes no result-count knob, the service enforces `maxResults` by truncating and flagging.
|
||||
|
||||
### Request logging
|
||||
|
||||
@@ -74,7 +74,7 @@ A search running under an initiating agent appends the log-only `web/deepseek-se
|
||||
|
||||
### Failures and recovery
|
||||
|
||||
Failures throw `WebError` with a machine-routable code: a missing credential is `WEB_PROVIDER_CREDENTIAL_MISSING`, caller cancellation is `WEB_ABORTED`, and provider or transport failures — including a response with no `web_search_tool_result` block — are `WEB_PROVIDER_ERROR`. HTTP redirects are rejected before the `Location` target is contacted. Every failure after dispatch names the resolved search endpoint and explains that search endpoint configuration is separate from chat. If the endpoint is unintended, the message tells the conversation model to guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek (legacy) under Search, and save its Base URL. When that page is unavailable, it names `web-search-deepseek.baseURL` as the deployment configuration alternative. The model must not choose or change the endpoint. The model-facing `web_search` tool surfaces this text under its own error wrapper.
|
||||
Failures throw `WebError` with a machine-routable code: a missing credential is `WEB_PROVIDER_CREDENTIAL_MISSING`, caller cancellation is `WEB_ABORTED`, and provider or transport failures — including a response with no `web_search_tool_result` block — are `WEB_PROVIDER_ERROR`. HTTP redirects are rejected before the `Location` target is contacted. Every failure after dispatch names the resolved search endpoint and explains that search endpoint configuration is separate from chat. If the endpoint is unintended, the message tells the conversation model to guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek server-side search under Search, and save its Base URL. When that page is unavailable, it names `web-search-deepseek.baseURL` as the deployment configuration alternative. The model must not choose or change the endpoint. The model-facing `web_search` tool surfaces this text under its own error wrapper.
|
||||
|
||||
-----
|
||||
|
||||
@@ -103,7 +103,7 @@ The provider is built on two commitments:
|
||||
|
||||
### Request flow
|
||||
|
||||
Each search captures the current Config values into provider options — endpoint, model, key reference, limits — then asks `ctx.deepseekAccount` for a token when the initiating Session uses the account route, otherwise resolves the credential reference through `ctx.credentials` (or the environment), appends the log-only session event, and dispatches the Messages request with the native `web_search` server tool. The response's `web_search_tool_result` blocks become `sources[]`; `cited_text` entries from text blocks are joined to their URLs as snippets; results are deduplicated by URL; and the service enforces the requested source bound on the way back.
|
||||
Each search captures the current Config values into provider options — endpoint, model, key reference, limits — then asks `ctx.deepseekAccount` for a token when the initiating Session uses the account route, otherwise resolves the credential reference through `ctx.credentials` (or the environment), appends the log-only session event, and dispatches the Messages request with the native `web_search` server tool. The response's `web_search_tool_result` blocks become `sources[]`, each with its item's own snippet; `cited_text` entries from text blocks are joined by URL as the snippets of items without one; results are deduplicated by URL; and the service enforces the requested source bound on the way back.
|
||||
|
||||
Readiness captures the same options but reads no API key value: on the account route it first asks `ctx.deepseekAccount` for a token, then checks the literal key or asks `ctx.credentials.describe()` (or the environment) whether the key reference is configured.
|
||||
|
||||
@@ -147,7 +147,7 @@ Independent of the conversation request cache. The auxiliary instruction and nat
|
||||
|
||||
#### What the model sees
|
||||
|
||||
Through `dsh-tool-web`, the conversation model sees deduplicated URLs, titles, dates, and citation snippets from structured search blocks; provider prose is not trusted as an answer. This provider's exact failures include the actionable missing-credential message, which also names DeepSeek Account sign-in, `DeepSeek search credential resolution failed: <error>`, and `DeepSeek search aborted`. An HTTP 401 to an account-authenticated search appends an instruction to guide the user to sign in to DeepSeek again. Other request, HTTP, native-search, and response-body failures append the resolved endpoint and the conditional configuration instruction described above. The consumer owns the error wrapper.
|
||||
Through `dsh-tool-web`, the conversation model sees deduplicated URLs, titles, dates, and snippets from structured search blocks; provider prose is not trusted as an answer. This provider's exact failures include the actionable missing-credential message, which also names DeepSeek Account sign-in, `DeepSeek search credential resolution failed: <error>`, and `DeepSeek search aborted`. An HTTP 401 to an account-authenticated search appends an instruction to guide the user to sign in to DeepSeek again. Other request, HTTP, native-search, and response-body failures append the resolved endpoint and the conditional configuration instruction described above. The consumer owns the error wrapper.
|
||||
|
||||
#### Token effect
|
||||
|
||||
@@ -183,7 +183,7 @@ These limits define when the provider is expensive or incomplete. They are curre
|
||||
- **Readiness checks presence, not validity** — a wrong key, or an endpoint without the native `web_search_20250305` server tool, counts as ready, so `web_search` stays offered and each call fails with a structured error.
|
||||
- **Search does not follow the chat endpoint** — when the official route chats through a gateway, search still sends its key to the configured search endpoint, the official one by default, and fails unless that endpoint accepts the key.
|
||||
- **Over-returned sources still cost tokens** — with no result-count knob on the wire, `maxResults` is enforced only post-hoc by service truncation.
|
||||
- **Sources usually carry no `snippet`** — a source gains one only when a text-block citation (`cited_text`) matches its URL, and DeepSeek's Anthropic-compatible endpoint returns text blocks without `citations`.
|
||||
- **A source's `snippet` depends on the endpoint** — it is the excerpt the endpoint returns with the result item, or else a text-block citation (`cited_text`) matching its URL; an Anthropic-compatible endpoint that returns neither yields sources without snippets.
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### Dev Note
|
||||
@@ -195,6 +195,6 @@ This Dev Note is working context for maintainers: open questions and undecided d
|
||||
|
||||
#### Dedicated retrieval endpoint
|
||||
|
||||
DeepSeek's Search and Fetch APIs, which avoid the full model turn, live in [dsh-web-deepseek-api](../web-deepseek-api/README.md) and are selected with the Search and Fetch menus on the Web search and fetch settings page. Shipped profiles select the Search API, so this provider runs only when `searchProvider: deepseek-official` is selected (for example, on gateways without Search API routes).
|
||||
DeepSeek's Search and Fetch APIs, which avoid the full model turn, live in [dsh-web-deepseek-api](../web-deepseek-api/README.md) and are selected with the Search and Fetch menus on the Web search and fetch settings page. Shipped profiles fix no search provider, so this provider runs for model requests on the DeepSeek model routes and the Search API runs on other routes; `searchProvider: deepseek-official` selects this provider for every route (for example, on gateways without Search API routes).
|
||||
|
||||
</details>
|
||||
@@ -25,11 +25,11 @@ kind: "package-reference"
|
||||
<a id="use-this-package"></a>
|
||||
## 使用本包
|
||||
|
||||
在已加载 web 服务的组合中挂载本提供方;它以 `deepseek-official` 搜索提供方身份注册,因此当它是唯一可用的搜索后端时,`ctx.web.search()` 会自动解析到它——也可以用 `searchProvider: deepseek-official` 固定。
|
||||
在已加载 web 服务的组合中挂载本提供方;它以 `deepseek-official` 搜索提供方身份注册,因此当它是唯一可用的搜索后端时,`ctx.web.search()` 会自动解析到它;没有配置搜索提供方时,为 `deepseek-official` 或 `deepseek-account` 模型路由上的模型请求发起的搜索也解析到它([提供方选择](../web/README.zh.md#provider-selection))——也可以用 `searchProvider: deepseek-official` 固定。
|
||||
|
||||
### 何时选择
|
||||
|
||||
当部署希望使用 DeepSeek 原生服务端 web 搜索、且其用户登录 DeepSeek 账号或持有 `DEEPSEEK_API_KEY` 时选择此后端——提供方按[鉴权](#authentication)所述复用这些凭据。一次搜索比专用检索端点更重:DeepSeek 在完整模型轮次内执行搜索,因此每次搜索都要预期一次 Messages 调用的延迟与生成 token,每次请求最多 `maxUses` 次服务端搜索。当单次搜索的成本或延迟占主导时避免使用它。
|
||||
当部署希望使用 DeepSeek 原生服务端 web 搜索、且其用户登录 DeepSeek 账号或持有 `DEEPSEEK_API_KEY` 时选择此后端——提供方按[鉴权](#authentication)所述复用这些凭据。一次搜索比专用检索端点更重:DeepSeek 在完整模型轮次内执行搜索,因此每次搜索都要预期一次 Messages 调用的延迟与生成 token,每次请求最多 `maxUses` 次服务端搜索。DeepSeek 不对它按次收费,因此其成本是该模型轮次的 token。当延迟占主导时避免使用它。
|
||||
|
||||
### 最小配置
|
||||
|
||||
@@ -66,7 +66,7 @@ kind: "package-reference"
|
||||
|
||||
### 搜索返回什么
|
||||
|
||||
`content` 始终省略:DeepSeek 的提供方文本不作为答案受到信任。`sources[]` 来自 `web_search_tool_result` 块内的 `web_search_result` 条目——`url` 和 `title` 直接取自同名字段,`publishedAt` 取自 `page_age`——snippet 在存在摘录时按 URL 关联的 `cited_text` 条目拼接。结果按 URL 去重,且由于 DeepSeek 不公开结果数量旋钮,服务通过截断并标记来强制执行 `maxResults`。
|
||||
`content` 始终省略:DeepSeek 的提供方文本不作为答案受到信任。`sources[]` 来自 `web_search_tool_result` 块内的 `web_search_result` 条目——`url` 和 `title` 直接取自同名字段,`publishedAt` 取自 `page_age`,`snippet` 取自条目自带的 `snippet`,条目没有时取自按 URL 关联且存在摘录的 `cited_text` 条目。结果按 URL 去重,且由于 DeepSeek 不公开结果数量旋钮,服务通过截断并标记来强制执行 `maxResults`。
|
||||
|
||||
### 请求日志
|
||||
|
||||
@@ -74,7 +74,7 @@ kind: "package-reference"
|
||||
|
||||
### 失败与恢复
|
||||
|
||||
失败抛出携带可按机器路由 code 的 `WebError`:凭据缺失为 `WEB_PROVIDER_CREDENTIAL_MISSING`,调用方取消为 `WEB_ABORTED`,提供方或传输失败,包括响应中没有 `web_search_tool_result` 块,为 `WEB_PROVIDER_ERROR`。HTTP 重定向会在接触 `Location` 指向的目标之前被拒绝。请求发出后的每项失败都会指出已解析的搜索端点,并说明搜索端点配置独立于聊天端点。如果该端点不符合用户预期,错误消息会要求会话模型指导用户进入 Plugins > Built-in plugin settings > Web search and fetch,在 Search 中选择 DeepSeek(旧版),修改其 Base URL 并保存。该页面不可用时,消息会把 `web-search-deepseek.baseURL` 作为部署配置方式。模型不得替用户选择或修改端点。面向模型的 `web_search` 工具会在自己的错误包装层内呈现这段文本。
|
||||
失败抛出携带可按机器路由 code 的 `WebError`:凭据缺失为 `WEB_PROVIDER_CREDENTIAL_MISSING`,调用方取消为 `WEB_ABORTED`,提供方或传输失败,包括响应中没有 `web_search_tool_result` 块,为 `WEB_PROVIDER_ERROR`。HTTP 重定向会在接触 `Location` 指向的目标之前被拒绝。请求发出后的每项失败都会指出已解析的搜索端点,并说明搜索端点配置独立于聊天端点。如果该端点不符合用户预期,错误消息会要求会话模型指导用户进入 Plugins > Built-in plugin settings > Web search and fetch,在 Search 中选择 DeepSeek 服务端搜索,修改其 Base URL 并保存。该页面不可用时,消息会把 `web-search-deepseek.baseURL` 作为部署配置方式。模型不得替用户选择或修改端点。面向模型的 `web_search` 工具会在自己的错误包装层内呈现这段文本。
|
||||
|
||||
-----
|
||||
|
||||
@@ -103,7 +103,7 @@ kind: "package-reference"
|
||||
|
||||
### 请求流程
|
||||
|
||||
每次搜索先把当前 Config 段投影为提供方选项——端点、模型、密钥引用、上限——然后在发起会话使用账号路由时向 `ctx.deepseekAccount` 请求 token,否则通过 `ctx.credentials`(或环境)解析凭据引用,追加仅用于日志的会话事件,并以原生 `web_search` 服务器工具分发 Messages 请求。响应中的 `web_search_tool_result` 块变为 `sources[]`;文本块中的 `cited_text` 条目按其 URL 拼接为 snippet;结果按 URL 去重;服务在返回路径上强制执行请求的来源上限。
|
||||
每次搜索先把当前 Config 段投影为提供方选项——端点、模型、密钥引用、上限——然后在发起会话使用账号路由时向 `ctx.deepseekAccount` 请求 token,否则通过 `ctx.credentials`(或环境)解析凭据引用,追加仅用于日志的会话事件,并以原生 `web_search` 服务器工具分发 Messages 请求。响应中的 `web_search_tool_result` 块变为 `sources[]`,各带其条目自带的 snippet;文本块中的 `cited_text` 条目按 URL 关联,作为没有 snippet 的条目的 snippet;结果按 URL 去重;服务在返回路径上强制执行请求的来源上限。
|
||||
|
||||
就绪判断捕获相同的选项,但不读取 API 密钥的值:账号路由先向 `ctx.deepseekAccount` 请求 token,再检查字面密钥,或询问 `ctx.credentials.describe()`(或环境)密钥引用是否已配置。
|
||||
|
||||
@@ -147,7 +147,7 @@ kind: "package-reference"
|
||||
|
||||
#### 模型看到的内容
|
||||
|
||||
通过 `dsh-tool-web`,会话模型会看到结构化搜索块中去重后的 URL、标题、日期与引用 snippet;提供方文本不会作为答案受到信任。该提供方的具体失败消息包括带有处理指引的凭据缺失消息(其中也提到 DeepSeek 账号登录)、`DeepSeek search credential resolution failed: <error>` 和 `DeepSeek search aborted`。账号鉴权的搜索收到 HTTP 401 时,会追加引导用户重新登录 DeepSeek 的指引。其他请求、HTTP、原生搜索和响应正文失败会追加已解析端点及前述条件式配置指引。错误包装属于消费方。
|
||||
通过 `dsh-tool-web`,会话模型会看到结构化搜索块中去重后的 URL、标题、日期与 snippet;提供方文本不会作为答案受到信任。该提供方的具体失败消息包括带有处理指引的凭据缺失消息(其中也提到 DeepSeek 账号登录)、`DeepSeek search credential resolution failed: <error>` 和 `DeepSeek search aborted`。账号鉴权的搜索收到 HTTP 401 时,会追加引导用户重新登录 DeepSeek 的指引。其他请求、HTTP、原生搜索和响应正文失败会追加已解析端点及前述条件式配置指引。错误包装属于消费方。
|
||||
|
||||
#### Token 影响
|
||||
|
||||
@@ -183,7 +183,7 @@ kind: "package-reference"
|
||||
- **就绪判断只检查凭据是否存在,不检查是否有效**——错误的密钥,或不提供原生 `web_search_20250305` 服务器工具的端点,都视为就绪,因此 `web_search` 继续提供,每次调用都以结构化错误失败。
|
||||
- **搜索不跟随聊天地址**——官方路由经网关聊天时,搜索仍把密钥发往配置的搜索端点(默认是官方端点),除非该端点接受这个密钥,否则调用失败。
|
||||
- **超量返回的来源仍消耗 token**——协议没有结果数量旋钮,`maxResults` 只能由服务在事后截断。
|
||||
- **来源通常没有 `snippet`**——只有当文本块引用(`cited_text`)匹配其 URL 时,来源才会获得 snippet,而 DeepSeek 的 Anthropic 兼容端点返回的文本块不带 `citations`。
|
||||
- **来源的 `snippet` 取决于端点**——它是端点随结果条目返回的摘录,否则是匹配其 URL 的文本块引用(`cited_text`);两者都不返回的 Anthropic 兼容端点产生没有 snippet 的来源。
|
||||
|
||||
<a id="dev-note"></a>
|
||||
### 开发备注
|
||||
@@ -195,6 +195,6 @@ kind: "package-reference"
|
||||
|
||||
#### 专用检索端点
|
||||
|
||||
无需完整模型轮次的 DeepSeek Search 与 Fetch API 位于 [dsh-web-deepseek-api](../web-deepseek-api/README.zh.md),由「网页搜索与获取」设置页的搜索和获取下拉框分别选择。内置配置选择 Search API,因此仅在选用 `searchProvider: deepseek-official` 时(例如网关未提供 Search API 路由)本提供方才会运行。
|
||||
无需完整模型轮次的 DeepSeek Search 与 Fetch API 位于 [dsh-web-deepseek-api](../web-deepseek-api/README.zh.md),由「网页搜索与获取」设置页的搜索和获取下拉框分别选择。内置配置不固定搜索提供方,因此本提供方为 DeepSeek 模型路由上的模型请求运行,其他路由运行 Search API;`searchProvider: deepseek-official` 会在所有路由上选用本提供方(例如网关未提供 Search API 路由时)。
|
||||
|
||||
</details>
|
||||
@@ -125,9 +125,9 @@ export interface DeepSeekSearchProviderOptions {
|
||||
|
||||
/**
|
||||
* Build a `url → cited_text` map from every `text` block's `citations[]`. This
|
||||
* is the snippet source: Anthropic `web_search_result` items carry
|
||||
* `url`/`title`/`page_age` but typically NO inline snippet — the excerpt lives
|
||||
* in a separate `text` block's citation, keyed by `url` (first occurrence wins).
|
||||
* is the snippet source for a `web_search_result` item that carries no `snippet`
|
||||
* of its own: the excerpt then lives in a separate `text` block's citation, keyed
|
||||
* by `url` (first occurrence wins).
|
||||
*
|
||||
* @param blocks - the response's content blocks; non-`text` blocks are skipped.
|
||||
* @returns the `url → cited_text` map (empty when no citations are present).
|
||||
@@ -147,13 +147,13 @@ export function citationSnippets(blocks: readonly ContentBlock[]): Map<string, s
|
||||
|
||||
/**
|
||||
* Map a DeepSeek Anthropic Messages response to a normalized search result. Walks
|
||||
* `web_search_tool_result` blocks for citeable `web_search_result` items, joins each to its
|
||||
* citation excerpt as `snippet`, and dedupes by `url` (a `max_uses > 1` request can surface
|
||||
* the same URL across searches). The web service owns the final `maxResults` truncation, so
|
||||
* `truncated` is always `false` here.
|
||||
* `web_search_tool_result` blocks for citeable `web_search_result` items, takes each item's own
|
||||
* `snippet` or else its citation excerpt as `snippet`, and dedupes by `url` (a `max_uses > 1`
|
||||
* request can surface the same URL across searches). The web service owns the final `maxResults`
|
||||
* truncation, so `truncated` is always `false` here.
|
||||
*
|
||||
* @param response - the parsed Messages response body.
|
||||
* @returns the normalized result with deduped, snippet-joined sources.
|
||||
* @returns the normalized result with deduped sources and their snippets.
|
||||
* @throws {@link WebError} when native search produced no result block.
|
||||
*/
|
||||
export function mapAnthropicResponse(response: AnthropicResponse): WebSearchResult {
|
||||
@@ -175,7 +175,7 @@ export function mapAnthropicResponse(response: AnthropicResponse): WebSearchResu
|
||||
for (const item of block.content ?? []) {
|
||||
if (item.type !== 'web_search_result' || item.url.length === 0 || seen.has(item.url)) continue
|
||||
seen.add(item.url)
|
||||
const snippet = snippets.get(item.url)
|
||||
const snippet = item.snippet != null && item.snippet.length > 0 ? item.snippet : snippets.get(item.url)
|
||||
sources.push({
|
||||
url: item.url,
|
||||
...item.title != null && item.title.length > 0 ? { title: item.title } : {},
|
||||
@@ -205,14 +205,14 @@ export class DeepSeekSearchProvider implements WebSearchProvider {
|
||||
readonly id = DEEPSEEK_PROVIDER_ID
|
||||
/** Picker description: what this provider suits and what it costs or cannot do. */
|
||||
readonly description: NonNullable<WebSearchProvider['description']> = {
|
||||
en: 'Slower, and every search uses extra model tokens. Requires a DeepSeek account or API key.',
|
||||
zh: '速度较慢,每次搜索都会额外消耗模型 token。需要 DeepSeek 账号或 API Key。',
|
||||
ja: '低速で、検索のたびに追加のモデルトークンを消費します。DeepSeek アカウントまたは API キーが必要です。',
|
||||
es: 'Más lenta, y cada búsqueda consume tokens adicionales del modelo. Requiere una cuenta de DeepSeek o una clave de API.',
|
||||
fr: 'Plus lente, et chaque recherche consomme des jetons de modèle supplémentaires. Nécessite un compte DeepSeek ou une clé API.',
|
||||
de: 'Langsamer, und jede Suche verbraucht zusätzliche Modell-Tokens. Erfordert ein DeepSeek-Konto oder einen API-Schlüssel.',
|
||||
ru: 'Работает медленнее, и каждый поиск расходует дополнительные токены модели. Требуется учётная запись DeepSeek или ключ API.',
|
||||
pt: 'Mais lenta, e cada pesquisa consome tokens extras do modelo. Requer uma conta DeepSeek ou uma chave de API.',
|
||||
en: 'No per-search charge, but every search uses extra model tokens. Requires a DeepSeek account or API key.',
|
||||
zh: '搜索不按次收费,每次搜索都会额外消耗模型 token。需要 DeepSeek 账号或 API Key。',
|
||||
ja: '検索ごとの料金はかかりませんが、検索のたびに追加のモデルトークンを消費します。DeepSeek アカウントまたは API キーが必要です。',
|
||||
es: 'Sin cargo por búsqueda, pero cada búsqueda consume tokens adicionales del modelo. Requiere una cuenta de DeepSeek o una clave de API.',
|
||||
fr: 'Sans frais par recherche, mais chaque recherche consomme des jetons de modèle supplémentaires. Nécessite un compte DeepSeek ou une clé API.',
|
||||
de: 'Keine Kosten pro Suche, aber jede Suche verbraucht zusätzliche Modell-Tokens. Erfordert ein DeepSeek-Konto oder einen API-Schlüssel.',
|
||||
ru: 'Плата за каждый поиск не взимается, но каждый поиск расходует дополнительные токены модели. Требуется учётная запись DeepSeek или ключ API.',
|
||||
pt: 'Sem cobrança por pesquisa, mas cada pesquisa consome tokens extras do modelo. Requer uma conta DeepSeek ou uma chave de API.',
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,7 +407,7 @@ function searchEndpointError(endpoint: string, message: string, cause?: unknown)
|
||||
return new WebError(
|
||||
`${message}\n\nThe web request used endpoint ${JSON.stringify(endpoint)}. `
|
||||
+ 'Search endpoint configuration is separate from chat. If that endpoint is not intended, '
|
||||
+ 'guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek (legacy) under Search, '
|
||||
+ 'guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek server-side search under Search, '
|
||||
+ 'and change and save its Base URL. If that settings page is unavailable, the user can set '
|
||||
+ 'web-search-deepseek.baseURL to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint.',
|
||||
'WEB_PROVIDER_ERROR',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Provider-private wire types for DeepSeek's Anthropic-compatible Messages API. Citeable
|
||||
* result items and citation excerpts arrive in separate blocks; the provider joins them by
|
||||
* URL. These types do not create a dependency on `ctx.llm`.
|
||||
* Provider-private wire types for DeepSeek's Anthropic-compatible Messages API. A citeable
|
||||
* result item may carry its own excerpt; citation excerpts arrive in separate blocks, and the
|
||||
* provider joins them to items by URL. These types do not create a dependency on `ctx.llm`.
|
||||
* @module @deepseek-ai/dsh-web-search-deepseek/types
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,8 @@ export interface WebSearchResultItem {
|
||||
title?: string | null
|
||||
/** Provider-supplied page age/recency string (mapped to `publishedAt`). */
|
||||
page_age?: string | null
|
||||
/** Excerpt of the page, when the endpoint returns one with the item. */
|
||||
snippet?: string | null
|
||||
}
|
||||
|
||||
/** A `web_search_tool_result` content block: the citeable result shape. */
|
||||
|
||||
@@ -101,6 +101,33 @@ describe('mapAnthropicResponse', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('takes the snippet an item carries, and the citation excerpt only for an item without one', () => {
|
||||
const result = mapAnthropicResponse({
|
||||
content: [
|
||||
{ type: 'text', citations: [
|
||||
{ url: 'https://own.test', cited_text: 'answer text citing own' },
|
||||
{ url: 'https://empty.test', cited_text: 'excerpt for empty' },
|
||||
{ url: 'https://null.test', cited_text: 'excerpt for null' },
|
||||
] },
|
||||
{
|
||||
type: 'web_search_tool_result',
|
||||
content: [
|
||||
{ type: 'web_search_result', url: 'https://own.test', snippet: 'page excerpt' },
|
||||
{ type: 'web_search_result', url: 'https://uncited.test', snippet: 'uncited page excerpt' },
|
||||
{ type: 'web_search_result', url: 'https://empty.test', snippet: '' },
|
||||
{ type: 'web_search_result', url: 'https://null.test', snippet: null },
|
||||
],
|
||||
},
|
||||
],
|
||||
})
|
||||
expect(result.sources).toEqual([
|
||||
{ url: 'https://own.test', snippet: 'page excerpt' },
|
||||
{ url: 'https://uncited.test', snippet: 'uncited page excerpt' },
|
||||
{ url: 'https://empty.test', snippet: 'excerpt for empty' },
|
||||
{ url: 'https://null.test', snippet: 'excerpt for null' },
|
||||
])
|
||||
})
|
||||
|
||||
it('dedupes repeated urls across result blocks (first wins)', () => {
|
||||
const result = mapAnthropicResponse({
|
||||
content: [
|
||||
@@ -528,7 +555,7 @@ describe('DeepSeekSearchProvider error handling', () => {
|
||||
message: 'DeepSeek API error (HTTP 429): rate limited\n\n'
|
||||
+ 'The web request used endpoint "https://api.deepseek.test/anthropic/v1/messages". '
|
||||
+ 'Search endpoint configuration is separate from chat. If that endpoint is not intended, '
|
||||
+ 'guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek (legacy) under Search, '
|
||||
+ 'guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek server-side search under Search, '
|
||||
+ 'and change and save its Base URL. If that settings page is unavailable, the user can set '
|
||||
+ 'web-search-deepseek.baseURL to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint.',
|
||||
}))
|
||||
|
||||
@@ -70,8 +70,8 @@ describe('web-search-deepseek settings section', () => {
|
||||
expect(listed).toMatchObject({ id: 'deepseek-official' })
|
||||
expect(listed).not.toHaveProperty('title')
|
||||
expect(listed?.description).toMatchObject({
|
||||
en: 'Slower, and every search uses extra model tokens. Requires a DeepSeek account or API key.',
|
||||
zh: '速度较慢,每次搜索都会额外消耗模型 token。需要 DeepSeek 账号或 API Key。',
|
||||
en: 'No per-search charge, but every search uses extra model tokens. Requires a DeepSeek account or API key.',
|
||||
zh: '搜索不按次收费,每次搜索都会额外消耗模型 token。需要 DeepSeek 账号或 API Key。',
|
||||
})
|
||||
await bench.ctx.fiber.dispose()
|
||||
})
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
en: 557a8a3f2dfebae4
|
||||
zh: 3c85382484e4b717
|
||||
/deepseek-ai-dsh-web/use-this-package/minimal-configuration:
|
||||
en: cb5267c425eef938
|
||||
zh: 26c3c04ee28c8c01
|
||||
en: df619fcd78b5ddf3
|
||||
zh: 37b2a636bc0e9811
|
||||
/deepseek-ai-dsh-web/use-this-package/searching-and-fetching:
|
||||
en: 713944abf68263cd
|
||||
zh: c428cb53b8708e99
|
||||
en: b9bbc748372e1324
|
||||
zh: 4255ecb86224a9a9
|
||||
/deepseek-ai-dsh-web/use-this-package/provider-selection:
|
||||
en: 5973c94b327aa8ae
|
||||
zh: cbc15a2925f70347
|
||||
en: 5db9d1699d347aa5
|
||||
zh: c283c6ae8655e20a
|
||||
/deepseek-ai-dsh-web/use-this-package/listing-providers:
|
||||
en: 229aed591f2194e0
|
||||
zh: d62b4b41d26be94c
|
||||
@@ -36,8 +36,8 @@
|
||||
en: cf0c7f95d944be5a
|
||||
zh: 1a2b3796acec7c29
|
||||
/deepseek-ai-dsh-web/use-this-package/search-and-fetch-readiness:
|
||||
en: 30fec45dfb417eed
|
||||
zh: 253f887aeb3deeea
|
||||
en: f843292cd4c207cf
|
||||
zh: 18371ec971492f46
|
||||
/deepseek-ai-dsh-web/use-this-package/failures-and-recovery:
|
||||
en: d8d09ed3839f6474
|
||||
zh: 7164d902f333592a
|
||||
@@ -45,8 +45,8 @@
|
||||
en: a3364d8193deb7f0
|
||||
zh: d1c4afbf25a7ae4d
|
||||
/deepseek-ai-dsh-web/understand-the-implementation/design-philosophy:
|
||||
en: c4d5437cfb1e2157
|
||||
zh: 411b1b398de73426
|
||||
en: 37cecf7386caa27c
|
||||
zh: 11eb1701574cfa95
|
||||
/deepseek-ai-dsh-web/understand-the-implementation/source-map:
|
||||
en: 2d8d315dba3b5f1e
|
||||
zh: dca7443453d96ba7
|
||||
@@ -54,8 +54,8 @@
|
||||
en: 300340ff8465a03e
|
||||
zh: 34ab66eb6969dc94
|
||||
/deepseek-ai-dsh-web/understand-the-implementation/selection-flow:
|
||||
en: d5cd4851d81892e6
|
||||
zh: 18266b0bc8b1d1ae
|
||||
en: 0472b53e93e9c7dc
|
||||
zh: 63bd2d31724681e1
|
||||
/deepseek-ai-dsh-web/further-exploration:
|
||||
en: f969a627e746906d
|
||||
zh: e6ffbe79fc539cec
|
||||
@@ -66,8 +66,8 @@
|
||||
en: 40294c1c31b74824
|
||||
zh: d75d48f485447a74
|
||||
/deepseek-ai-dsh-web/known-limitations-and-deferred-work:
|
||||
en: 12624cc86e6bc4e9
|
||||
zh: c86de7d9b5302601
|
||||
en: 03d33ddd7673e228
|
||||
zh: 9ccc0441abfbe729
|
||||
/deepseek-ai-dsh-web/known-limitations-and-deferred-work/dev-note:
|
||||
en: 7f775cc79dbce94b
|
||||
zh: 12b8f68f9e7c48ca
|
||||
|
||||
@@ -45,7 +45,7 @@ Load the service and let a single mounted backend auto-select, or pin a provider
|
||||
|
||||
| Field | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `searchProvider` | (unset) | Pinned search provider id; unset auto-selects when exactly one is usable |
|
||||
| `searchProvider` | (unset) | Pinned search provider id; unset prefers the usable DeepSeek provider of the [request's model route](#provider-selection), and otherwise auto-selects when exactly one is usable |
|
||||
| `fetchProvider` | (unset) | Pinned fetch provider id; unset auto-selects when exactly one is usable |
|
||||
|
||||
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-web) is the exhaustive source for every accepted field and its JSDoc.
|
||||
@@ -62,8 +62,9 @@ const result = await ctx.web.search({ query: 'deepseek harness', maxResults: 8 }
|
||||
const page = await ctx.web.fetch({ url: 'https://example.com' })
|
||||
```
|
||||
|
||||
Both calls accept an optional `AbortSignal` that is forwarded to the provider for cancellation. The normalized request and result shapes are the contract callers build on; the vocabulary section of the [web subsystem](../../../docs/subsystems/web.md) reference describes them exhaustively.
|
||||
A search made for a model request also carries that request's provider route as `llmProvider`, which [provider selection](#provider-selection) reads. Both calls accept an optional `AbortSignal` that is forwarded to the provider for cancellation. The normalized request and result shapes are the contract callers build on; the vocabulary section of the [web subsystem](../../../docs/subsystems/web.md) reference describes them exhaustively.
|
||||
|
||||
<a id="provider-selection"></a>
|
||||
### Provider selection
|
||||
|
||||
Each call resolves its provider at execution time, and registration or load order never matters. A configured provider id wins when it is registered and usable; without a configured id, the service runs the single usable provider or fails clearly:
|
||||
@@ -73,11 +74,12 @@ Each call resolves its provider at execution time, and registration or load orde
|
||||
| configured id registered and usable | runs that provider |
|
||||
| configured id not registered | `WEB_PROVIDER_CONFIGURED_MISSING` |
|
||||
| configured id registered but unavailable | `WEB_PROVIDER_CONFIGURED_UNAVAILABLE` |
|
||||
| no search id, the provider preferred for the request's `llmProvider` is registered and usable | runs that provider |
|
||||
| no id, exactly one registered usable provider | runs it |
|
||||
| no id, no usable provider | `WEB_PROVIDER_UNAVAILABLE` |
|
||||
| no id, multiple usable providers | `WEB_PROVIDER_AMBIGUOUS` |
|
||||
|
||||
The shipped `deepseek-official` and `deepseek-search-api` search ids select legacy Messages search and the direct Search API respectively.
|
||||
The shipped `deepseek-official` and `deepseek-search-api` search ids select legacy Messages search and the direct Search API respectively. While no search provider is configured, a search prefers `deepseek-official` for a model request on the `deepseek-official` or `deepseek-account` model route, because DeepSeek makes no per-search charge for Messages search, and `deepseek-search-api` for a request on any other route and for a search that serves no model request. The preference is fixed in this package and applies only while the preferred provider is registered and usable, so a composition without these providers selects as the table states. The [base composition](../../bundle/base/cordis.patch.yml) mounts both and configures no search provider. A configured `searchProvider`, or `$DSH_WEB_SEARCH_PROVIDER`, applies to every route.
|
||||
|
||||
A provider's availability is a cheap local check — for example whether its API key is present — and never makes network calls, so selection stays fast and deterministic.
|
||||
|
||||
@@ -111,7 +113,7 @@ A search or fetch backend outside the shipped composition is a plugin package th
|
||||
<a id="search-readiness"></a>
|
||||
### Search and fetch readiness
|
||||
|
||||
`searchReady(llmProvider?)` and `fetchReady(llmProvider?)` ask the provider that `search()` or `fetch()` would select whether an operation made for a model request on that chat route has a credential to send; [`dsh-tool-web`](../tool-web/README.md#search-readiness) uses the answers to decide whether each model step admits `web_search` and `web_fetch`. A provider answers through its optional `ready(llmProvider)`, a configuration-only check that must not make network calls; a provider without it counts as ready. When selection fails, the readiness method answers true, because the operation reports that failure as a structured `WebError`. Readiness never changes which provider is selected.
|
||||
`searchReady(llmProvider?)` and `fetchReady(llmProvider?)` ask the provider that `search()` or `fetch()` would select, for a search the one selected for a request with that `llmProvider`, whether an operation made for a model request on that chat route has a credential to send; [`dsh-tool-web`](../tool-web/README.md#search-readiness) uses the answers to decide whether each model step admits `web_search` and `web_fetch`. A provider answers through its optional `ready(llmProvider)`, a configuration-only check that must not make network calls; a provider without it counts as ready. When selection fails, the readiness method answers true, because the operation reports that failure as a structured `WebError`. Readiness never changes which provider is selected.
|
||||
|
||||
```text
|
||||
// false only when the selected provider cannot authenticate this route's operations:
|
||||
@@ -138,7 +140,7 @@ This section explains the design decisions behind the service; the observable be
|
||||
The package is built on one deliberate separation:
|
||||
|
||||
- **One seam, two independent operations.** Search and fetch share no request schema and no business logic, but they share one service so provider selection, cancellation, errors, and product configuration have a single owner. The parallel `Search`/`Fetch` method pairs are intentional.
|
||||
- **Selection is never order-dependent.** A capability either pins a provider id or auto-selects when exactly one usable provider is registered; `search()`/`fetch()` resolve the provider at execution time.
|
||||
- **Selection is never order-dependent.** A capability either pins a provider id or auto-selects when exactly one usable provider is registered, and an unpinned search prefers the DeepSeek provider of the request's model route; `search()`/`fetch()` resolve the provider at execution time.
|
||||
- **The service owns the result bound.** `maxResults` is enforced by the seam after the provider returns, so an over-returning provider can never leak more sources than the caller asked for.
|
||||
|
||||
### Source map
|
||||
@@ -154,7 +156,7 @@ The request and result types define the normalized vocabulary callers build on
|
||||
|
||||
### Selection flow
|
||||
|
||||
At call time the service resolves the provider — configured id first, then the unique usable provider — and throws the matching `WebError` when no clear winner exists. A search result then passes through `capSources`, which truncates `sources[]` to `maxResults` and flags `truncated`. `searchReady()` and `fetchReady()` resolve the same provider as the matching operation, answer true when resolution throws, and otherwise return the provider's `ready()` answer, or true when it has none. Registration is effect-based: providers register with the calling fiber and unregister when it disposes, and a duplicate id within a capability kind is rejected at registration.
|
||||
At call time the service resolves the provider — configured id first, then for a search the usable provider preferred for the request's route, then the unique usable provider — and throws the matching `WebError` when no clear winner exists. A search result then passes through `capSources`, which truncates `sources[]` to `maxResults` and flags `truncated`. `searchReady()` and `fetchReady()` resolve the same provider as the matching operation, answer true when resolution throws, and otherwise return the provider's `ready()` answer, or true when it has none. Registration is effect-based: providers register with the calling fiber and unregister when it disposes, and a duplicate id within a capability kind is rejected at registration.
|
||||
|
||||
</details>
|
||||
|
||||
@@ -192,8 +194,9 @@ No direct invalidation; the named consumer owns any request-prefix changes.
|
||||
These limits define when the service is incomplete on its own. They are current package constraints.
|
||||
|
||||
- **No availability observation** — `listProviders()` and `web/providers-changed` report which providers are registered, not whether they are usable; there is no capability-status query, and `searchReady()` and `fetchReady()` report only the selected provider's credential readiness and answer true when selection fails. Availability is observable only by running a search or fetch and routing the thrown code, and the no-provider failure is the generic `WEB_PROVIDER_UNAVAILABLE` with no per-provider reason enumeration ([Agent Note](../../../.agents/notes/archived/simplification/2026-07-04-drop-unconsumed-web-observation-surface.md)).
|
||||
- **Search requests carry only `query` and `maxResults`** — provider-neutral controls (recency, domain filters, regional hints, search depth) are deferred until the backends can honor them ([seam Agent Note](../../../.agents/notes/implemented/architecture/2026-06-24-web-capability-seam.md)).
|
||||
- **Search requests carry only `query`, `maxResults`, and `llmProvider`** — provider-neutral controls (recency, domain filters, regional hints, search depth) are deferred until the backends can honor them ([seam Agent Note](../../../.agents/notes/implemented/architecture/2026-06-24-web-capability-seam.md)).
|
||||
- **`WebFetchBody` has no `pdf` arm** — text-extractable PDF support is named deferred work; the closed union makes adding it a compile-enforced change across the web packages.
|
||||
- **The per-route search preference is fixed** — the two DeepSeek model routes and the two DeepSeek search provider ids are constants of this package, so a deployment changes the outcome only by configuring `searchProvider`, and a provider-neutral rule is deferred until a second pair of routes and providers needs one.
|
||||
- **Provider-backed page extraction is out of scope of `fetch()`** — a Firecrawl/Tavily-style `web_extract` capability is deferred rather than widening the fetch operation.
|
||||
|
||||
<a id="dev-note"></a>
|
||||
|
||||
@@ -45,7 +45,7 @@ kind: "package-reference"
|
||||
|
||||
| 字段 | 默认值 | 含义 |
|
||||
|---|---|---|
|
||||
| `searchProvider` | (未设置) | 固定的搜索提供方 id;未设置时仅在恰好一个可用时自动选择 |
|
||||
| `searchProvider` | (未设置) | 固定的搜索提供方 id;未设置时优先使用[请求的模型路由](#provider-selection)对应的可用 DeepSeek 提供方,否则仅在恰好一个可用时自动选择 |
|
||||
| `fetchProvider` | (未设置) | 固定的抓取提供方 id;未设置时仅在恰好一个可用时自动选择 |
|
||||
|
||||
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-web)是每个受支持字段及其 JSDoc 的穷尽式真源。
|
||||
@@ -62,8 +62,9 @@ const result = await ctx.web.search({ query: 'deepseek harness', maxResults: 8 }
|
||||
const page = await ctx.web.fetch({ url: 'https://example.com' })
|
||||
```
|
||||
|
||||
两个调用都接受可选的 `AbortSignal`,用于把取消转发给提供方。规范化的请求与结果形状是调用方赖以构建的约定;[web 子系统](../../../docs/subsystems/web.zh.md) 参考中的词汇章节对其有穷尽式描述。
|
||||
为模型请求发起的搜索还会在 `llmProvider` 中携带该请求的提供方路由,供[提供方选择](#provider-selection)读取。两个调用都接受可选的 `AbortSignal`,用于把取消转发给提供方。规范化的请求与结果形状是调用方赖以构建的约定;[web 子系统](../../../docs/subsystems/web.zh.md) 参考中的词汇章节对其有穷尽式描述。
|
||||
|
||||
<a id="provider-selection"></a>
|
||||
### 提供方选择
|
||||
|
||||
每次调用都在执行时解析提供方,注册或加载顺序从不影响结果。已配置的提供方 id 在已注册且可用时优先;没有配置 id 时,服务运行唯一可用的提供方,或在情况不明时明确失败:
|
||||
@@ -73,11 +74,12 @@ const page = await ctx.web.fetch({ url: 'https://example.com' })
|
||||
| 已配置 id 已注册且可用 | 运行该提供方 |
|
||||
| 已配置 id 未注册 | `WEB_PROVIDER_CONFIGURED_MISSING` |
|
||||
| 已配置 id 已注册但不可用 | `WEB_PROVIDER_CONFIGURED_UNAVAILABLE` |
|
||||
| 无搜索 id,请求的 `llmProvider` 所优先的提供方已注册且可用 | 运行该提供方 |
|
||||
| 无 id,恰好一个已注册的可用提供方 | 运行它 |
|
||||
| 无 id,没有可用提供方 | `WEB_PROVIDER_UNAVAILABLE` |
|
||||
| 无 id,多个可用提供方 | `WEB_PROVIDER_AMBIGUOUS` |
|
||||
|
||||
随附的 `deepseek-official` 与 `deepseek-search-api` 搜索 id 分别选择旧版 Messages 搜索与直接 Search API。
|
||||
随附的 `deepseek-official` 与 `deepseek-search-api` 搜索 id 分别选择旧版 Messages 搜索与直接 Search API。没有配置搜索提供方时,为 `deepseek-official` 或 `deepseek-account` 模型路由上的模型请求发起的搜索优先使用 `deepseek-official`,因为 DeepSeek 不对 Messages 搜索按次收费;其他路由上的请求以及不服务于任何模型请求的搜索优先使用 `deepseek-search-api`。这一优先规则固定在本包中,仅在被优先的提供方已注册且可用时生效,因此没有这些提供方的组合按上表选择。[base 组合](../../bundle/base/cordis.patch.yml)挂载这两个提供方且不配置搜索提供方。已配置的 `searchProvider` 或 `$DSH_WEB_SEARCH_PROVIDER` 对所有路由生效。
|
||||
|
||||
提供方的可用性是一项廉价的局部检查——例如其 API 密钥是否存在——并且从不发起网络调用,因此选择保持快速且确定。
|
||||
|
||||
@@ -111,7 +113,7 @@ ctx.remote.$on('web/providers-changed', () => { /* re-read the lists */ })
|
||||
<a id="search-readiness"></a>
|
||||
### 搜索与抓取就绪
|
||||
|
||||
`searchReady(llmProvider?)` 与 `fetchReady(llmProvider?)` 询问 `search()` 或 `fetch()` 会选中的提供方:为该对话路由上的模型请求发起的操作是否有可发送的凭据;[`dsh-tool-web`](../tool-web/README.zh.md#search-readiness) 据此决定每个模型步骤是否准入 `web_search` 与 `web_fetch`。提供方通过可选的 `ready(llmProvider)` 回答,它是只检查配置的判断,禁止发起网络调用;未实现它的提供方视为就绪。选择失败时就绪方法回答 true,因为对应操作会把该失败报告为结构化 `WebError`。就绪判断从不改变选中哪个提供方。
|
||||
`searchReady(llmProvider?)` 与 `fetchReady(llmProvider?)` 询问 `search()` 或 `fetch()` 会选中的提供方(搜索为携带该 `llmProvider` 的请求所选中的提供方):为该对话路由上的模型请求发起的操作是否有可发送的凭据;[`dsh-tool-web`](../tool-web/README.zh.md#search-readiness) 据此决定每个模型步骤是否准入 `web_search` 与 `web_fetch`。提供方通过可选的 `ready(llmProvider)` 回答,它是只检查配置的判断,禁止发起网络调用;未实现它的提供方视为就绪。选择失败时就绪方法回答 true,因为对应操作会把该失败报告为结构化 `WebError`。就绪判断从不改变选中哪个提供方。
|
||||
|
||||
```text
|
||||
// false only when the selected provider cannot authenticate this route's operations:
|
||||
@@ -138,7 +140,7 @@ const fetchOffered = await ctx.web.fetchReady('deepseek-official')
|
||||
本包建立在一个刻意的分离之上:
|
||||
|
||||
- **一个 seam,两个独立操作。** 搜索与抓取没有共享请求 schema 或业务逻辑,但它们共用一个服务,使提供方选择、取消、错误与产品配置只有一个归属方。并行的 `Search`/`Fetch` 方法对是有意为之。
|
||||
- **选择绝不依赖顺序。** 能力要么固定提供方 id,要么在恰好注册一个可用提供方时自动选择;`search()`/`fetch()` 在执行时解析提供方。
|
||||
- **选择绝不依赖顺序。** 能力要么固定提供方 id,要么在恰好注册一个可用提供方时自动选择,未固定的搜索优先使用请求的模型路由对应的 DeepSeek 提供方;`search()`/`fetch()` 在执行时解析提供方。
|
||||
- **服务拥有结果上限。** `maxResults` 由 seam 在提供方返回后强制执行,因此超量返回的提供方绝不可能泄漏超出调用方要求的来源。
|
||||
|
||||
### 源码地图
|
||||
@@ -154,7 +156,7 @@ const fetchOffered = await ctx.web.fetchReady('deepseek-official')
|
||||
|
||||
### 选择流程
|
||||
|
||||
执行时,服务先按配置 id、再按唯一可用提供方解析提供方,没有明确赢家时抛出对应的 `WebError`。搜索结果随后经过 `capSources`:把 `sources[]` 截断到 `maxResults` 并标记 `truncated`。`searchReady()` 与 `fetchReady()` 解析与对应操作相同的提供方,解析抛错时回答 true,否则返回该提供方 `ready()` 的回答,提供方没有 `ready()` 时回答 true。注册基于 effect:提供方随调用 fiber 注册,fiber 释放时注销;同一能力类型下重复的 id 会在注册时被拒绝。
|
||||
执行时,服务先按配置 id、搜索再按请求路由所优先的可用提供方、最后按唯一可用提供方解析提供方,没有明确赢家时抛出对应的 `WebError`。搜索结果随后经过 `capSources`:把 `sources[]` 截断到 `maxResults` 并标记 `truncated`。`searchReady()` 与 `fetchReady()` 解析与对应操作相同的提供方,解析抛错时回答 true,否则返回该提供方 `ready()` 的回答,提供方没有 `ready()` 时回答 true。注册基于 effect:提供方随调用 fiber 注册,fiber 释放时注销;同一能力类型下重复的 id 会在注册时被拒绝。
|
||||
|
||||
</details>
|
||||
|
||||
@@ -192,8 +194,9 @@ const fetchOffered = await ctx.web.fetchReady('deepseek-official')
|
||||
这些限制说明本服务单独使用时在哪些方面不完整。它们是当前包约束。
|
||||
|
||||
- **没有可用性观测**:`listProviders()` 与 `web/providers-changed` 只报告哪些提供方已注册,不报告它们是否可用;没有能力状态查询,`searchReady()` 与 `fetchReady()` 只报告选中提供方的凭据就绪状态,选择失败时回答 true。可用性只能通过执行搜索或抓取并按抛出的 code 路由来观测,无提供方失败是通用的 `WEB_PROVIDER_UNAVAILABLE`,不枚举逐提供方原因(见 [Agent Note](../../../.agents/notes/archived/simplification/2026-07-04-drop-unconsumed-web-observation-surface.md))。
|
||||
- **搜索请求只携带 `query` 与 `maxResults`**:提供方无关的控制项(新近程度、域名过滤条件、区域提示、搜索深度)暂缓至后端都能诚实支持时(见 [seam Agent Note](../../../.agents/notes/implemented/architecture/2026-06-24-web-capability-seam.zh.md))。
|
||||
- **搜索请求只携带 `query`、`maxResults` 与 `llmProvider`**:提供方无关的控制项(新近程度、域名过滤条件、区域提示、搜索深度)暂缓至后端都能诚实支持时(见 [seam Agent Note](../../../.agents/notes/implemented/architecture/2026-06-24-web-capability-seam.zh.md))。
|
||||
- **`WebFetchBody` 没有 `pdf` 分支**:可提取文本的 PDF 支持属于明确的延期工作;封闭联合会使新增该分支成为跨 web 包、由编译强制执行的变更。
|
||||
- **按路由的搜索优先规则是固定的**:两条 DeepSeek 模型路由与两个 DeepSeek 搜索提供方 id 是本包中的常量,因此部署只能通过配置 `searchProvider` 改变结果;提供方无关的规则延期至出现第二组路由与提供方时。
|
||||
- **提供方支持的页面提取不属于 `fetch()` 范围**:Firecrawl/Tavily 风格的 `web_extract` 能力延期,而不会扩展抓取操作。
|
||||
|
||||
<a id="dev-note"></a>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* Service Definition for the web access capability seam (`ctx.web`): registries and provider-selecting execution for search and
|
||||
* fetch. Duplicate ids are rejected. At execution time, a configured provider must exist and
|
||||
* be usable; without one, exactly one usable provider is required, so selection never depends
|
||||
* on registration order.
|
||||
* be usable; without one, exactly one usable provider is required, except that a search prefers the
|
||||
* usable DeepSeek provider assigned to the route of the model request it serves, so selection never
|
||||
* depends on registration order.
|
||||
* @module @deepseek-ai/dsh-web
|
||||
*/
|
||||
|
||||
@@ -49,8 +50,22 @@ interface Selection<P> {
|
||||
readonly configuredId?: string
|
||||
/** Providers registered for this capability kind. */
|
||||
readonly providers: ReadonlyMap<string, P>
|
||||
/** The provider that wins among the usable ones while none is configured, if it is usable. */
|
||||
readonly preferredId?: string
|
||||
}
|
||||
|
||||
/** Provider routes of the DeepSeek API-key and account models. */
|
||||
const DEEPSEEK_MODEL_ROUTES: ReadonlySet<string> = new Set(['deepseek-official', 'deepseek-account'])
|
||||
|
||||
/**
|
||||
* Search provider preferred for a model request on a DeepSeek model route while none is configured: DeepSeek
|
||||
* Messages search, which DeepSeek serves without a per-search charge.
|
||||
*/
|
||||
const DEEPSEEK_ROUTE_SEARCH_PROVIDER = 'deepseek-official'
|
||||
|
||||
/** Search provider preferred on every other route and outside a model request while none is configured. */
|
||||
const OTHER_ROUTE_SEARCH_PROVIDER = 'deepseek-search-api'
|
||||
|
||||
/**
|
||||
* Config for the web seam. `searchProvider` / `fetchProvider` pin which provider
|
||||
* wins for each capability; both are optional (a single registered usable
|
||||
@@ -60,7 +75,10 @@ interface Selection<P> {
|
||||
* fields rather than introduce a hidden priority chain.
|
||||
*/
|
||||
export interface WebRuntimeConfig {
|
||||
/** Explicit search provider id. Omitted = auto-select when exactly one usable. */
|
||||
/**
|
||||
* Explicit search provider id. Omitted = the usable DeepSeek provider assigned to the route of the model
|
||||
* request, and otherwise auto-select when exactly one usable.
|
||||
*/
|
||||
readonly searchProvider: Volatile<string | undefined>
|
||||
/** Explicit fetch provider id. Omitted = auto-select when exactly one usable. */
|
||||
readonly fetchProvider: Volatile<string | undefined>
|
||||
@@ -75,6 +93,10 @@ export interface WebRuntimeConfig {
|
||||
* - A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.
|
||||
* - A configured id registered but unavailable →
|
||||
* `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.
|
||||
* - No search id configured, and the provider assigned to the route of the model request
|
||||
* the search serves is usable → that provider: `deepseek-official` (Messages search) on the
|
||||
* `deepseek-official` and `deepseek-account` routes, `deepseek-search-api` on every other
|
||||
* route and outside a model request.
|
||||
* - No id configured, exactly one registered usable provider → that provider.
|
||||
* - No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.
|
||||
* - No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
|
||||
@@ -178,12 +200,12 @@ export class WebRuntime extends TypertRemoteService {
|
||||
* time with the selection rules above; throws {@link WebError} when the
|
||||
* capability cannot run. The seam enforces `request.maxResults` on the result:
|
||||
* if the provider over-returns, `sources[]` is truncated and `truncated` set.
|
||||
* @param request - the query and optional result limit.
|
||||
* @param request - the query, the optional result limit, and the route of the model request the search serves.
|
||||
* @param signal - optional cancellation signal forwarded to the provider.
|
||||
* @returns the provider's results, capped to `request.maxResults`.
|
||||
*/
|
||||
async search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult> {
|
||||
const result = await this.selectSearchProvider().search(request, signal)
|
||||
const result = await this.selectSearchProvider(request.llmProvider).search(request, signal)
|
||||
return capSources(result, request.maxResults)
|
||||
}
|
||||
|
||||
@@ -196,14 +218,22 @@ export class WebRuntime extends TypertRemoteService {
|
||||
* @returns false only when the selected provider reports that it cannot authenticate.
|
||||
*/
|
||||
async searchReady(llmProvider?: string): Promise<boolean> {
|
||||
return await selectedProviderReady(() => this.selectSearchProvider(), llmProvider)
|
||||
return await selectedProviderReady(() => this.selectSearchProvider(llmProvider), llmProvider)
|
||||
}
|
||||
|
||||
/** Select the search provider with the rules above, throwing the matching {@link WebError}. */
|
||||
private selectSearchProvider(): WebSearchProvider {
|
||||
/**
|
||||
* Select the search provider with the rules above, throwing the matching {@link WebError}.
|
||||
* @param llmProvider - provider route id of the model request the search serves, when known.
|
||||
* @returns the provider the search runs through.
|
||||
*/
|
||||
private selectSearchProvider(llmProvider: string | undefined): WebSearchProvider {
|
||||
const configuredId = this.config.searchProvider.get() ?? this.searchProviderEnv
|
||||
const preferredId = llmProvider !== undefined && DEEPSEEK_MODEL_ROUTES.has(llmProvider)
|
||||
? DEEPSEEK_ROUTE_SEARCH_PROVIDER
|
||||
: OTHER_ROUTE_SEARCH_PROVIDER
|
||||
return resolveProvider({
|
||||
providers: this.searchProviders,
|
||||
preferredId,
|
||||
...configuredId !== undefined ? { configuredId } : {},
|
||||
})
|
||||
}
|
||||
@@ -285,6 +315,8 @@ function resolveProvider<P extends ResolvableProvider>(selection: Selection<P>):
|
||||
return provider
|
||||
}
|
||||
const usable = [...providers.values()].filter(provider => provider.available())
|
||||
const preferred = usable.find(provider => provider.id === selection.preferredId)
|
||||
if (preferred !== undefined) return preferred
|
||||
const [single] = usable
|
||||
if (single === undefined) {
|
||||
throw new WebError('no usable web provider is registered', 'WEB_PROVIDER_UNAVAILABLE')
|
||||
|
||||
@@ -38,6 +38,12 @@ export interface WebSearchRequest {
|
||||
* bound regardless.
|
||||
*/
|
||||
readonly maxResults?: number
|
||||
/**
|
||||
* Provider route id of the model request this search serves. While no search
|
||||
* provider is configured, the seam selects with it, as `searchReady()` selects
|
||||
* with its argument. Omitted = the search serves no model request.
|
||||
*/
|
||||
readonly llmProvider?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -198,6 +198,50 @@ describe('WebRuntime execution resolution', () => {
|
||||
await expect(b.web.search({ query: 'q' })).resolves.toMatchObject({ content: 'perplexity' })
|
||||
})
|
||||
|
||||
describe('with both DeepSeek search providers and none configured', () => {
|
||||
/** Mount the seam with Messages search and the Search API registered. */
|
||||
async function mountDeepSeek(
|
||||
usable: { messages?: boolean; api?: boolean } = {}, config: Parameters<typeof mountWeb>[0] = {},
|
||||
): Promise<WebRuntime> {
|
||||
const { web } = await mountWeb(config)
|
||||
web.registerSearchProvider(makeSearchProvider('deepseek-search-api', usable.api ?? available, () => Promise.resolve(searchResult('api'))))
|
||||
web.registerSearchProvider(makeSearchProvider('deepseek-official', usable.messages ?? available, () => Promise.resolve(searchResult('messages'))))
|
||||
return web
|
||||
}
|
||||
|
||||
it.each(['deepseek-official', 'deepseek-account'])('runs Messages search for a model request on the %s route', async (llmProvider) => {
|
||||
const web = await mountDeepSeek()
|
||||
await expect(web.search({ query: 'q', llmProvider })).resolves.toMatchObject({ content: 'messages' })
|
||||
})
|
||||
|
||||
it.each([['another route', 'openai'], ['a search that serves no model request', undefined]])(
|
||||
'runs the Search API for %s', async (_label, llmProvider) => {
|
||||
const web = await mountDeepSeek()
|
||||
await expect(web.search({ query: 'q', ...llmProvider === undefined ? {} : { llmProvider } })).resolves.toMatchObject({ content: 'api' })
|
||||
},
|
||||
)
|
||||
|
||||
it('runs the one usable provider when the preferred one is unavailable', async () => {
|
||||
await expect((await mountDeepSeek({ messages: unavailable })).search({ query: 'q', llmProvider: 'deepseek-official' }))
|
||||
.resolves.toMatchObject({ content: 'api' })
|
||||
await expect((await mountDeepSeek({ api: unavailable })).search({ query: 'q', llmProvider: 'openai' }))
|
||||
.resolves.toMatchObject({ content: 'messages' })
|
||||
})
|
||||
|
||||
it('runs the configured provider on every route', async () => {
|
||||
const web = await mountDeepSeek({}, { searchProvider: 'deepseek-search-api' })
|
||||
await expect(web.search({ query: 'q', llmProvider: 'deepseek-official' })).resolves.toMatchObject({ content: 'api' })
|
||||
})
|
||||
|
||||
it('still fails as ambiguous when the preferred provider is not registered', async () => {
|
||||
const { web } = await mountWeb()
|
||||
web.registerSearchProvider(makeSearchProvider('deepseek-search-api', available, () => Promise.resolve(searchResult('api'))))
|
||||
web.registerSearchProvider(makeSearchProvider('exa', available, () => Promise.resolve(searchResult('exa'))))
|
||||
await expect(web.search({ query: 'q', llmProvider: 'deepseek-official' })).rejects.toThrow(expect.objectContaining({ code: 'WEB_PROVIDER_AMBIGUOUS' }))
|
||||
await expect(web.search({ query: 'q', llmProvider: 'openai' })).resolves.toMatchObject({ content: 'api' })
|
||||
})
|
||||
})
|
||||
|
||||
it('runs the selected provider and returns its result', async () => {
|
||||
const { web } = await mountWeb()
|
||||
web.registerSearchProvider(makeSearchProvider('exa', available, () => Promise.resolve(
|
||||
@@ -258,6 +302,19 @@ describe('WebRuntime search readiness', () => {
|
||||
await expect(web.searchReady(undefined)).resolves.toBe(false)
|
||||
})
|
||||
|
||||
it('asks the provider preferred for the request route when none is configured', async () => {
|
||||
const { web } = await mountWeb()
|
||||
const legacyAsked: (string | undefined)[] = []
|
||||
const apiAsked: (string | undefined)[] = []
|
||||
web.registerSearchProvider(readyProvider('deepseek-official', available, false, legacyAsked))
|
||||
web.registerSearchProvider(readyProvider('deepseek-search-api', available, true, apiAsked))
|
||||
await expect(web.searchReady('deepseek-official')).resolves.toBe(false)
|
||||
await expect(web.searchReady('other')).resolves.toBe(true)
|
||||
await expect(web.searchReady(undefined)).resolves.toBe(true)
|
||||
expect(legacyAsked).toEqual(['deepseek-official'])
|
||||
expect(apiAsked).toEqual(['other', undefined])
|
||||
})
|
||||
|
||||
it('treats a selected provider without ready() as ready', async () => {
|
||||
const { web } = await mountWeb()
|
||||
web.registerSearchProvider(makeSearchProvider('plain', available, () => Promise.resolve(searchResult('plain'))))
|
||||
|
||||
@@ -31,3 +31,10 @@
|
||||
searchApiKeyEnv: DSH_SNAPSHOT_SEARCH_KEY
|
||||
# The fixture maps this recorded authority to its OS-assigned listener.
|
||||
searchBaseURL: http://127.0.0.1:43118/api/v1/tools
|
||||
|
||||
# The conversation runs on a DeepSeek model route, where an unconfigured search selects Messages search.
|
||||
- id: web
|
||||
name: '@deepseek-ai/dsh-web'
|
||||
config:
|
||||
searchProvider: deepseek-search-api
|
||||
fetchProvider: http
|
||||
@@ -9,3 +9,10 @@
|
||||
searchApiKeyEnv: DSH_SNAPSHOT_SEARCH_KEY
|
||||
# The fixture maps this recorded authority to its OS-assigned listener.
|
||||
searchBaseURL: http://127.0.0.1:43118/api/v1/tools
|
||||
|
||||
# The conversation runs on a DeepSeek model route, where an unconfigured search selects Messages search.
|
||||
- id: web
|
||||
name: '@deepseek-ai/dsh-web'
|
||||
config:
|
||||
searchProvider: deepseek-search-api
|
||||
fetchProvider: http
|
||||
@@ -31,10 +31,3 @@
|
||||
apiKey: snapshot-key
|
||||
# The fixture maps this recorded authority to its OS-assigned listener.
|
||||
baseURL: http://127.0.0.1:43118/anthropic/v1
|
||||
|
||||
# The case exercises legacy Messages search, which the base no longer selects by default.
|
||||
- id: web
|
||||
name: '@deepseek-ai/dsh-web'
|
||||
config:
|
||||
searchProvider: deepseek-official
|
||||
fetchProvider: http
|
||||
@@ -1,4 +1,5 @@
|
||||
# Live-recording patch for a deterministic failed DeepSeek search request.
|
||||
# Live-recording patch for a deterministic failed DeepSeek search request. No search provider is
|
||||
# configured: the conversation runs on a DeepSeek model route, where a search selects Messages search.
|
||||
- insert:
|
||||
- id: web-search-error-fixture
|
||||
name: './web-search-error-fixture.mjs'
|
||||
@@ -9,10 +10,3 @@
|
||||
apiKey: snapshot-key
|
||||
# The fixture maps this recorded authority to its OS-assigned listener.
|
||||
baseURL: http://127.0.0.1:43118/anthropic/v1
|
||||
|
||||
# The case exercises legacy Messages search, which the base no longer selects by default.
|
||||
- id: web
|
||||
name: '@deepseek-ai/dsh-web'
|
||||
config:
|
||||
searchProvider: deepseek-official
|
||||
fetchProvider: http
|
||||
@@ -15,7 +15,7 @@
|
||||
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The user wants me to use web_search exactly once for \"DSH endpoint configuration snapshot\". If it fails, don't retry. Report only the endpoint and config/restriction facts stated in the tool error. Let me do that."},{"type":"tool-call","id":"call_00_F6R6olIacpEEdwQuqCm40371","name":"web_search","arguments":"{\"queries\": [\"DSH endpoint configuration snapshot\"]}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-flash"},"blocks":[{"type":"reasoning","signature":"fdd73c03-6e1a-41e6-80ee-444ff2130de8"},{"type":"tool-call"}]}},"id":"{{message:4}}"},"usage":{"inputTokens":313,"outputTokens":93,"cacheReadTokens":5504,"cacheWriteTokens":0,"totalTokens":5910},"stream":[{"type":"chunk","time":1792136615206,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1792136615206,"index":0,"dt":[0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"texts":["The"," user"," wants"," me"," to"," use"," web","_search"," exactly"," once"," for"," \"","DS","H"," endpoint"," configuration"," snapshot","\"."," If"," it"," fails",","," don","'t"," ret","ry","."," Report"," only"," the"," endpoint"," and"," config","/","rest","riction"," facts"," stated"," in"," the"," tool"," error","."," Let"," me"," do"," that","."]},{"type":"chunk","time":1792136615208,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The user wants me to use web_search exactly once for \"DSH endpoint configuration snapshot\". If it fails, don't retry. Report only the endpoint and config/restriction facts stated in the tool error. Let me do that."}}},{"type":"chunk","time":1792136615208,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1792136615208,"index":1,"dt":[],"id":"call_00_F6R6olIacpEEdwQuqCm40371","name":"web_search","args":[""]},{"type":"tool-call-chunks","time0":1792136615208,"index":1,"dt":[0,0,0,0,0,3,0,0,18,0,0,0,22],"id":"call_00_F6R6olIacpEEdwQuqCm40371","args":["{","\"","qu","eries","\"",": ","[\"","DS","H"," endpoint"," configuration"," snapshot","\"]","}"]},{"type":"chunk","time":1792136615285,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_00_F6R6olIacpEEdwQuqCm40371","name":"web_search","arguments":"{\"queries\": [\"DSH endpoint configuration snapshot\"]}"}}},{"type":"chunk","time":1792136615285,"chunk":{"type":"usage","usage":{"inputTokens":313,"outputTokens":93,"cacheReadTokens":5504,"cacheWriteTokens":0,"totalTokens":5910}}},{"type":"chunk","time":1792136615286,"chunk":{"type":"finish","reason":{"kind":"tool-calls"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-flash"},"blocks":[{"type":"reasoning","signature":"fdd73c03-6e1a-41e6-80ee-444ff2130de8"},{"type":"tool-call"}]}}}]},"surfaceOp":"append"}
|
||||
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_00_F6R6olIacpEEdwQuqCm40371","name":"web_search","arguments":"{\"queries\": [\"DSH endpoint configuration snapshot\"]}"}}
|
||||
{"type":"web/deepseek-search-llm-request","data":{"endpoint":"http://127.0.0.1:43118/anthropic/v1/messages","apiVersion":"2023-06-01","body":{"model":"deepseek-v4-flash","max_tokens":4096,"messages":[{"role":"user","content":[{"type":"text","text":"Perform a web search for the query: DSH endpoint configuration snapshot"}]}],"tools":[{"type":"web_search_20250305","name":"web_search","max_uses":5}],"thinking":{"type":"disabled"}}}}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_F6R6olIacpEEdwQuqCm40371"},"toolCallId":"call_00_F6R6olIacpEEdwQuqCm40371","content":[{"type":"text","text":"Error: DeepSeek API error (HTTP 401): invalid snapshot API key\n\nThe web request used endpoint \"http://127.0.0.1:43118/anthropic/v1/messages\". Search endpoint configuration is separate from chat. If that endpoint is not intended, guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek (legacy) under Search, and change and save its Base URL. If that settings page is unavailable, the user can set web-search-deepseek.baseURL to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint."}],"isError":true,"id":"{{message:5}}"},"error":{"name":"WebError","code":"WEB_PROVIDER_ERROR"}},"sourceEventSeqs":[14],"surfaceOp":"append"}
|
||||
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_00_F6R6olIacpEEdwQuqCm40371"},"toolCallId":"call_00_F6R6olIacpEEdwQuqCm40371","content":[{"type":"text","text":"Error: DeepSeek API error (HTTP 401): invalid snapshot API key\n\nThe web request used endpoint \"http://127.0.0.1:43118/anthropic/v1/messages\". Search endpoint configuration is separate from chat. If that endpoint is not intended, guide the user to Plugins > Built-in plugin settings > Web search and fetch, select DeepSeek server-side search under Search, and change and save its Base URL. If that settings page is unavailable, the user can set web-search-deepseek.baseURL to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint."}],"isError":true,"id":"{{message:5}}"},"error":{"name":"WebError","code":"WEB_PROVIDER_ERROR"}},"sourceEventSeqs":[14],"surfaceOp":"append"}
|
||||
{"type":"step/end","data":{"turn":1,"step":1}}
|
||||
{"type":"step/start","data":{"turn":1,"step":2}}
|
||||
{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":""},{"type":"text","text":"The single `web_search` call failed; no retry was made. Per the tool error:\n\n- **Endpoint used:** `http://127.0.0.1:43118/anthropic/v1/messages`\n- **Error:** DeepSeek API error (HTTP 401): invalid snapshot API key\n- **Configuration facts stated:** Search endpoint configuration is separate from chat. If that endpoint is not intended, the user can change/save the Messages API base URL under Plugins > Built-in plugin settings > Web search. If that settings page is unavailable, `web-search-deepseek.baseURL` can be set to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint.\n\nI make no inference about the cause of the failure or the correctness of the endpoint."}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash","replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-flash"},"blocks":[{"type":"reasoning","signature":"7228c543-8a73-4759-90eb-9c1fbcf6b340"},{"type":"text"}]}},"id":"{{message:6}}"},"usage":{"inputTokens":153,"outputTokens":164,"cacheReadTokens":5888,"cacheWriteTokens":0,"totalTokens":6205},"stream":[{"type":"chunk","time":1792136619364,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"chunk","time":1792136619364,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":""}}},{"type":"chunk","time":1792136619364,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":1792136619364,"index":1,"dt":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0],"texts":["The"," single"," `","web","_search","`"," call"," failed",";"," no"," ret","ry"," was"," made","."," Per"," the"," tool"," error",":\n\n","-"," **","Endpoint"," used",":**"," `","http","://","127",".","0",".","0",".","1",":","431","18","/an","throp","ic","/v","1","/m","essages","`\n","-"," **","Error",":**"," Deep","Se","ek"," API"," error"," (","HTTP"," ","401","):"," invalid"," snapshot"," API"," key","\n","-"," **","Configuration"," facts"," stated",":**"," Search"," endpoint"," configuration"," is"," separate"," from"," chat","."," If"," that"," endpoint"," is"," not"," intended",","," the"," user"," can"," change","/s","ave"," the"," Messages"," API"," base"," URL"," under"," Plug","ins"," >"," Built","-in"," plugin"," settings"," >"," Web"," search","."," If"," that"," settings"," page"," is"," unavailable",","," `","web","-search","-de","ep","seek",".base","URL","`"," can"," be"," set"," to"," a"," trusted"," Deep","Se","ek"," endpoint","."," Only"," the"," user"," should"," choose"," or"," change"," the"," endpoint",".\n\n","I"," make"," no"," inference"," about"," the"," cause"," of"," the"," failure"," or"," the"," correctness"," of"," the"," endpoint","."]},{"type":"chunk","time":1792136619459,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"The single `web_search` call failed; no retry was made. Per the tool error:\n\n- **Endpoint used:** `http://127.0.0.1:43118/anthropic/v1/messages`\n- **Error:** DeepSeek API error (HTTP 401): invalid snapshot API key\n- **Configuration facts stated:** Search endpoint configuration is separate from chat. If that endpoint is not intended, the user can change/save the Messages API base URL under Plugins > Built-in plugin settings > Web search. If that settings page is unavailable, `web-search-deepseek.baseURL` can be set to a trusted DeepSeek endpoint. Only the user should choose or change the endpoint.\n\nI make no inference about the cause of the failure or the correctness of the endpoint."}}},{"type":"chunk","time":1792136619459,"chunk":{"type":"usage","usage":{"inputTokens":153,"outputTokens":164,"cacheReadTokens":5888,"cacheWriteTokens":0,"totalTokens":6205}}},{"type":"chunk","time":1792136619459,"chunk":{"type":"finish","reason":{"kind":"stop"},"replayState":{"response":{"kind":"deepseek-messages","version":1,"model":"deepseek-v4-flash"},"blocks":[{"type":"reasoning","signature":"7228c543-8a73-4759-90eb-9c1fbcf6b340"},{"type":"text"}]}}}]},"surfaceOp":"append"}
|
||||
|
||||
Reference in new issue
Block a user