dsh-web-search-plugin 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +35 -19
- package/README.zh.md +35 -19
- package/cordis.patch.yml +3 -0
- package/lib/client.js +215 -24
- package/lib/deepseek.js +2 -1
- package/lib/shared.js +1 -1
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
## [未发布]
|
|
6
6
|
|
|
7
|
+
## [0.6.0] - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### 新增
|
|
10
|
+
|
|
11
|
+
- “设置 → 网页搜索”保留一个入口,页面分为“搜索引擎”和“网页抓取”,统一暂存、保存和放弃修改。
|
|
12
|
+
- 新增 DeepSeek Search API 搜索选项,复用 DSH `0.2.1-rc.2` 的官方提供方,无辅助模型轮次;现有第三方引擎和 DeepSeek Messages 搜索继续保留。
|
|
13
|
+
- 网页抓取可独立选择本地 HTTP(默认)或官方 DeepSeek Fetch API;不自动联动搜索与抓取,也不自动回退到付费接口。
|
|
14
|
+
- 新版 Search / Fetch 共用官方 `web-deepseek-api` 的密钥引用和基础地址,与旧 Messages 参数分别保存;不提供这套配置的 Host 禁用新版 API 选项。
|
|
15
|
+
|
|
16
|
+
### 变更
|
|
17
|
+
|
|
18
|
+
- 四个 DSH peer 范围显式接纳 `0.2.1-rc.2`,保留 `0.2.0-rc.2`;包版本与 User-Agent 更新为 `0.6.0`。
|
|
19
|
+
- DeepSeek Messages 搜索显式关闭辅助思考,与 rc.2 官方行为一致。
|
|
20
|
+
- 跨配置区域保存时先保存引擎和 API 参数,再以同一 `web` mutation 提交所修改的提供方选择;各区域使用各自 revision,失败保留草稿并提示可能已有部分设置保存。
|
|
21
|
+
- 保持原有安装默认值和用户选择,新增 API 由用户主动选择;不迁移旧 Messages 端点或模型配置。
|
|
22
|
+
- 下拉选项使用“DeepSeek Messages 搜索(默认)”与“DeepSeek Search API”,标明默认项,不附加推荐标记。
|
|
23
|
+
|
|
7
24
|
## [0.5.1] - 2026-10-10
|
|
8
25
|
|
|
9
26
|
### 新增
|
package/README.md
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](./README.zh.md)
|
|
4
4
|
|
|
5
|
-
A web search plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) that gives your agent more search options through Harness's existing `web_search` tool.
|
|
5
|
+
A web search plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) that gives your agent more search options through Harness's existing `web_search` tool. **Settings → Web search** contains two independent sections: **Search engines** (ten choices) and **Web retrieval** (local HTTP or DeepSeek Fetch API), with one Save action.
|
|
6
6
|
|
|
7
7
|
## Why use this plugin?
|
|
8
8
|
|
|
9
|
-
- **Avoid an extra DeepSeek model call for search.**
|
|
9
|
+
- **Avoid an extra DeepSeek model call for search.** DeepSeek Search API and the eight third-party backends call search APIs directly instead of DeepSeek's official model-backed search endpoint. This avoids the additional DeepSeek model token usage for that search request. (Your conversation and the model's processing of search results still use tokens, and search providers may charge their own fees or credits.)
|
|
10
10
|
- **Configure everything in a settings card.** Switch engines, enter keys, and adjust result limits in **Settings → Web search**, then save. Changes take effect on the next search without restarting the plugin or editing YAML.
|
|
11
11
|
- **Choose the search service that fits your needs.** Use Google results through Serper, semantic search through Exa, or a self-hosted SearXNG instance. Tavily's keyless mode lets you try search without an account or API key.
|
|
12
|
-
- **
|
|
12
|
+
- **Keep existing engines and settings.** Messages search and third-party engines remain available. Search and retrieval are selected independently; see [Disable or uninstall](#disable-or-uninstall) before removing saved provider overrides.
|
|
13
13
|
|
|
14
|
-
**The default engine is still DeepSeek
|
|
14
|
+
**The default engine is still DeepSeek Messages search.** To avoid the extra official search model call, select **DeepSeek Search API** or a third-party engine in the settings card after installation and save your changes. Selecting DeepSeek Messages search uses the official search API and may incur model invocation charges.
|
|
15
15
|
|
|
16
16
|
## Supported providers
|
|
17
17
|
|
|
18
|
-
- **DeepSeek
|
|
18
|
+
- **DeepSeek Search API** — Reuses rc.2's official `deepseek-search-api`. Direct `/v1/tools/search` requests without an auxiliary model turn. Its `count` is 1–50 (default 10), further bounded by the calling tool; it does not use this plugin's `maxResults`.
|
|
19
|
+
- **DeepSeek Messages search (installation default)** — Uses DeepSeek's Anthropic-compatible Messages API with the native search tool type `web_search_20250305`. Supports account tokens or `DEEPSEEK_API_KEY`. Each search sends a model request and may incur model invocation charges.
|
|
19
20
|
- **Tavily** — Supports `keyless` access (free, rate-limited, no account required) or `keyed` access (`TAVILY_API_KEY`, Bearer token). The settings card shows a quota bar in keyed mode.
|
|
20
21
|
- **Brave Search** — Calls `GET https://api.search.brave.com/res/v1/web/search` with the `X-Subscription-Token` header (credential name: `BRAVE_API_KEY`). Each search is one HTTP request and does not consume a model turn. The settings card displays Capacity and monthly quota from response headers.
|
|
21
22
|
- **Serper** — Google results via `POST /search`, using the `X-API-KEY` header (credential name: `SERPER_API_KEY`).
|
|
@@ -29,7 +30,7 @@ For DuckDuckGo results, choose a SearXNG instance that aggregates DuckDuckGo. Du
|
|
|
29
30
|
|
|
30
31
|
## Requirements
|
|
31
32
|
|
|
32
|
-
- DeepSeek Harness `0.2.
|
|
33
|
+
- Verified with DeepSeek Harness `0.2.1-rc.2`. New Search / Fetch options require the Host's `web` and `web-deepseek-api` configuration namespaces. Compatible `0.2.0-rc.2` Hosts retain existing engines; unavailable API options are disabled.
|
|
33
34
|
- Node.js `^22.19.0` or `>=24.0.0`
|
|
34
35
|
- pnpm, used by `dsh plugin` to install the plugin into a profile
|
|
35
36
|
|
|
@@ -44,22 +45,37 @@ dsh plugin --profile web add dsh-web-search-plugin
|
|
|
44
45
|
After installation, configure the plugin in the Harness Web UI:
|
|
45
46
|
|
|
46
47
|
1. Open **Settings → Web search** and find the plugin's settings card. The sidebar's **Plugins** page controls whether the bundle is enabled; engine settings live in this card.
|
|
47
|
-
2. Choose a search engine. For direct API search without an extra DeepSeek model call, select Tavily, Brave, Serper, SerpApi, Exa, SearXNG, Scavio, or Firecrawl.
|
|
48
|
+
2. Choose a search engine. For direct API search without an extra DeepSeek model call, select DeepSeek Search API, Tavily, Brave, Serper, SerpApi, Exa, SearXNG, Scavio, or Firecrawl.
|
|
48
49
|
3. Enter the engine's API key if required. Engines that require a key show “Get API key ↗”, which opens the official dashboard. For Tavily without a key, choose `keyless`; for SearXNG, set an instance URL with JSON search enabled. These two keyless options do not show a key dashboard link. Existing credentials can be reused, such as `BRAVE_API_KEY` for Brave.
|
|
49
|
-
4.
|
|
50
|
+
4. Under **Web retrieval**, independently select local HTTP (default) or DeepSeek Fetch API.
|
|
51
|
+
5. Adjust parameters and click **Save** at the bottom. Unsaved changes remain drafts; the next operation uses the saved settings.
|
|
50
52
|
|
|
51
53
|
> For installation from a local source checkout, including Windows cross-drive considerations, see [Development → Local installation and verification](#local-installation-and-verification).
|
|
52
54
|
|
|
53
55
|
## Configuration
|
|
54
56
|
|
|
55
|
-
For normal use, configure the plugin in **Settings → Web search**. The card shows options for the selected engine and
|
|
57
|
+
For normal use, configure the plugin in **Settings → Web search**. The card shows options for the selected engine and retrieval method. Existing engine settings use `dsh-web-search-plugin`; new API settings use `web-deepseek-api`, and provider selection uses `web` in the current profile. The tables below include advanced fields hidden from the card.
|
|
58
|
+
|
|
59
|
+
### New Search API and web retrieval
|
|
60
|
+
|
|
61
|
+
The page reuses the official providers rather than registering duplicate implementations. Selecting the new Search API sets `web.searchProvider: deepseek-search-api`. Selecting an existing engine restores `dsh-web-search` and saves the plugin's `provider`. Retrieval independently selects `web.fetchProvider: http` or `deepseek-fetch-api`. Existing custom fetch providers are shown and preserved until explicitly changed.
|
|
62
|
+
|
|
63
|
+
Search API and Fetch API share the official `web-deepseek-api` namespace: `apiKeyEnv` (default `DEEPSEEK_API_KEY`), `baseURL` (default `https://api.deepseek.com/v1/tools`), and the credential. Only one API configuration is shown when both are selected. Messages endpoint/model/key settings remain separate. API `count` controls returned results, not requests or spending. The official advanced `sendOriginalQuestion` setting defaults to true: search sends the triggering question with whitespace normalized and at most 128 characters. It can be disabled in the official configuration; this page preserves it.
|
|
64
|
+
|
|
65
|
+
Recommended: **DeepSeek Search API + local HTTP**. Search avoids an auxiliary model call. Local HTTP requests the target from the device running DSH without calling paid Fetch. DeepSeek Fetch is optional remote Markdown retrieval; it does not guarantee access to every site. Local HTTP does not execute JavaScript. Tool results still consume main-conversation tokens. No automatic engine or paid retrieval fallback occurs.
|
|
66
|
+
|
|
67
|
+
See [official billing](https://api-docs.deepseek.com/zh-cn/guides/search/#计费) for current successful-request prices and conditions. Estimated costs are not presented as an actual bill.
|
|
68
|
+
|
|
69
|
+
Save writes credentials, then engine/API parameters, then the edited search/retrieval selections in a single `web` mutation. Each namespace has its own revision: this is not a transaction across namespaces. A later refusal leaves accepted writes in place, reports possible partial saving, and retains the draft for review and retry. Editing is locked during saving; Discard never writes settings.
|
|
70
|
+
|
|
71
|
+
The tables below describe the original nine plugin backends; new Search API configuration is described above.
|
|
56
72
|
|
|
57
73
|
### General settings
|
|
58
74
|
|
|
59
75
|
| Key | Default | Meaning and scope |
|
|
60
76
|
|---|---|---|
|
|
61
77
|
| `provider` | `deepseek-official` | Active engine: `deepseek-official`, `tavily`, `brave`, `serper`, `serpapi`, `exa`, `searxng`, `scavio`, or `firecrawl`. Each request uses only the selected engine, with no automatic failover to another engine on error. Unknown values fall back to official DeepSeek |
|
|
62
|
-
| `maxResults` | `8` | Maximum returned sources for
|
|
78
|
+
| `maxResults` | `8` | Maximum returned sources for the original nine plugin backends (excluding the independent new Search API), from 1–20, also capped by the caller's `request.maxResults`. SearXNG and Scavio send no request-level count parameter; their results are truncated after retrieval and URL deduplication. The upstream response determines how many results are actually available |
|
|
63
79
|
|
|
64
80
|
### Keys and credential references
|
|
65
81
|
|
|
@@ -110,7 +126,7 @@ Clearing a text input or using “Restore default” in the card normally remove
|
|
|
110
126
|
</thead>
|
|
111
127
|
<tbody>
|
|
112
128
|
<tr>
|
|
113
|
-
<td rowspan="4"><strong>DeepSeek
|
|
129
|
+
<td rowspan="4"><strong>DeepSeek Messages search</strong></td>
|
|
114
130
|
<td><code>deepseekModel</code></td>
|
|
115
131
|
<td><code>deepseek-flash</code></td>
|
|
116
132
|
<td>Model used only for the DeepSeek search request; does not change the conversation's chat model. Must be supported by the target endpoint</td>
|
|
@@ -190,7 +206,7 @@ The startup environment variable `DSH_WEB_SEARCH_PROVIDER=dsh-web-search` select
|
|
|
190
206
|
|
|
191
207
|
## Quotas
|
|
192
208
|
|
|
193
|
-
- **DeepSeek
|
|
209
|
+
- **DeepSeek Messages search**: No quota bar. Search still makes a model request, with usage subject to your account or API billing.
|
|
194
210
|
- **Tavily keyless**: No quota bar; access is free and rate-limited.
|
|
195
211
|
- **Tavily keyed**: Requests `include_usage` during searches and accumulates credits for the current credential in memory. The Host periodically calls `GET /usage`, and the settings card supports manual refresh. Manual refreshes must be at least 10 seconds apart; automatic reconciliation is not subject to this limit. The quota comes from `account.current_plan` / `plan_limit`; usage is the larger of the local total for the current credential and the remote value. Changing keys clears the previous account's usage and triggers immediate reconciliation. Tavily quota data is no longer persisted to disk.
|
|
196
212
|
- **Brave**: No usage/spending endpoint. Dashboard **Capacity** represents the per-second window from response headers (for example, 50 requests/second). A monthly limit of `0` means unlimited requests, not an exhausted quota. Billing credits are available only in the [Brave API dashboard](https://api-dashboard.search.brave.com/).
|
|
@@ -198,15 +214,15 @@ The startup environment variable `DSH_WEB_SEARCH_PROVIDER=dsh-web-search` select
|
|
|
198
214
|
|
|
199
215
|
## Disable or uninstall
|
|
200
216
|
|
|
201
|
-
### Switch to DeepSeek
|
|
217
|
+
### Switch to DeepSeek Messages search first
|
|
202
218
|
|
|
203
|
-
If you only want to use official search again, select **DeepSeek
|
|
219
|
+
If you only want to use official search again, select **DeepSeek Messages search** in **Settings → Web search** and save. There is no need to disable or uninstall this plugin. The next search uses the official search API through this plugin and may still incur model invocation charges.
|
|
204
220
|
|
|
205
221
|
### Disable and restore built-in search
|
|
206
222
|
|
|
207
223
|
Use the following steps when you want to stop using this plugin and restore Harness's original search plugin. Selecting this plugin's DeepSeek engine and restoring the original plugin are separate operations.
|
|
208
224
|
|
|
209
|
-
Open **Plugins** in the sidebar and turn off the **entire `dsh-web-search-plugin` bundle**.
|
|
225
|
+
Open **Plugins** in the sidebar and turn off the **entire `dsh-web-search-plugin` bundle**. This removes its composition layer and re-enables the built-in Messages search plugin. Explicit provider settings saved through this page remain in the profile: review `web.searchProvider` and `web.fetchProvider` and remove the overrides to restore profile defaults. You can turn the bundle back on later.
|
|
210
226
|
|
|
211
227
|
Use the bundle's main switch: disabling only an individual component inside the bundle leaves its other configuration overrides in place. Profiles with configuration hot reload apply the change immediately; otherwise, restart Harness.
|
|
212
228
|
|
|
@@ -220,11 +236,11 @@ To remove the installed package as well, run:
|
|
|
220
236
|
dsh plugin --profile web remove dsh-web-search-plugin
|
|
221
237
|
```
|
|
222
238
|
|
|
223
|
-
The same checks for manually added overrides apply after uninstallation.
|
|
239
|
+
The same checks for manually added overrides apply after uninstallation. Explicit `web` and `web-deepseek-api` settings survive disabling or uninstalling the bundle. To restore standard profile defaults, review and remove saved search/retrieval overrides. Re-enable the built-in `web-search-deepseek` before restoring Messages search; retrieval can return to `http`.
|
|
224
240
|
|
|
225
241
|
## How it works
|
|
226
242
|
|
|
227
|
-
The plugin registers a single `WebSearchProvider` with the stable ID `dsh-web-search` through `ctx.web`, following the same provider contract as `@deepseek-ai/dsh-web-search-deepseek` (`inject: ['web']` and `ctx.web.registerSearchProvider`).
|
|
243
|
+
The plugin registers a single `WebSearchProvider` with the stable ID `dsh-web-search` through `ctx.web`, following the same provider contract as `@deepseek-ai/dsh-web-search-deepseek` (`inject: ['web']` and `ctx.web.registerSearchProvider`). The original nine engines share this provider; selecting the new Search API switches to the official provider, independently of retrieval. Results are normalized to `WebSearchResult` (optional `content` and `sources[]`) and deduplicated by URL. All configuration fields use `volatile()`, so saved settings are read without restarting the plugin.
|
|
228
244
|
|
|
229
245
|
This package is a **bundle**. The `dsh.bundle.patch` declaration points to `cordis.patch.yml`, which adds the Host entry, selects `dsh-web-search`, and disables the built-in `web-search-deepseek` Host plugin while the bundle is enabled. The plugin's internal `deepseek-official` engine option is distinct from its registered `dsh-web-search` ID. Disabling the entire bundle removes this patch layer; disabling only its Host entry does not. Without a bundle declaration, `dsh plugin add` only adds the dependency and does not mount the plugin.
|
|
230
246
|
|
|
@@ -284,7 +300,7 @@ dsh plugin --profile web install
|
|
|
284
300
|
|
|
285
301
|
`file:` is a snapshot: after source changes, copy the files again with robocopy, run `install`, and restart DSH. If you change the package's `files` field, pnpm may consider the snapshot unchanged and skip the update; remove `node_modules/dsh-web-search-plugin` before reinstalling in that case.
|
|
286
302
|
|
|
287
|
-
Use `dsh --profile web --dump-config` to verify that the composition tree includes `dsh-web-search-plugin
|
|
303
|
+
Use `dsh --profile web --dump-config` to verify that the composition tree includes `dsh-web-search-plugin`. `web.searchProvider` is `dsh-web-search` for the original engines or `deepseek-search-api` for the new API; independently verify `web.fetchProvider` is `http` or the explicitly selected Fetch provider.
|
|
288
304
|
|
|
289
305
|
### Syntax checks
|
|
290
306
|
|
|
@@ -295,7 +311,7 @@ npm test
|
|
|
295
311
|
|
|
296
312
|
The client bundle must retain the `window.__ModuleLoader__.load({ id, factory })` wire format: it is loaded by `dsh-client-modules`, not a bundler. It must export both `apply` and `inject` (`slots`, `locale`, `remote`, `remote.credentials`, `configForms`).
|
|
297
313
|
|
|
298
|
-
The configuration card is hosted in **Settings → Web search** (`settings.section`, `id: "web-search"`).
|
|
314
|
+
The configuration card is hosted in **Settings → Web search** (`settings.section`, `id: "web-search"`). It combines the public ConfigForms for `dsh-web-search-plugin`, `web`, and `web-deepseek-api`. Registration follows the plugin namespace through `configForms.whileServed([namespace], register)`; absent API configuration disables only the new choices. No Host-module imports are added to the client bundle.
|
|
299
315
|
|
|
300
316
|
The plugin does not show configuration on the plugin detail page (`plugins.bundle.config`).
|
|
301
317
|
|
package/README.zh.md
CHANGED
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[English](./README.md) | 中文
|
|
4
4
|
|
|
5
|
-
为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的 Agent 提供更多联网搜索选择,沿用 Harness 原有的 `web_search`
|
|
5
|
+
为 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(DSH)的 Agent 提供更多联网搜索选择,沿用 Harness 原有的 `web_search` 工具。在 **设置 → 网页搜索** 一个入口中,分为 **搜索引擎**(10 个选项)和 **网页抓取**(本地 HTTP 或 DeepSeek Fetch API),独立选择后统一保存。
|
|
6
6
|
|
|
7
7
|
## 为什么使用本插件?
|
|
8
8
|
|
|
9
|
-
- **减少搜索时额外的 DeepSeek 模型调用。** 8 个第三方后端直接请求搜索 API,不经过 DeepSeek 官方的模型搜索接口,因此不会产生该次搜索请求额外的 DeepSeek 模型 token 消耗。(对话本身和模型读取搜索结果仍会消耗 token,搜索服务也可能单独收取费用或扣除额度。)
|
|
9
|
+
- **减少搜索时额外的 DeepSeek 模型调用。** 新版 DeepSeek Search API 和 8 个第三方后端直接请求搜索 API,不经过 DeepSeek 官方的模型搜索接口,因此不会产生该次搜索请求额外的 DeepSeek 模型 token 消耗。(对话本身和模型读取搜索结果仍会消耗 token,搜索服务也可能单独收取费用或扣除额度。)
|
|
10
10
|
- **在设置卡片中完成配置。** 在 **设置 → 网页搜索** 中切换引擎、填写密钥、调整结果数量,保存后下一次搜索即可生效,无需重启插件或编辑 YAML。
|
|
11
11
|
- **按需求选择搜索服务。** 可以通过 Serper 获取 Google 结果,使用 Exa 进行语义搜索,或接入自建 SearXNG。Tavily 的 keyless 模式无需账号和 API key,方便先体验。
|
|
12
|
-
-
|
|
12
|
+
- **保留已有引擎与设置。** Messages 和第三方引擎继续可用,搜索与抓取独立选择;移除已保存的提供方覆盖前,请参考[停用或卸载](#停用或卸载)。
|
|
13
13
|
|
|
14
|
-
**默认引擎仍为 DeepSeek
|
|
14
|
+
**默认引擎仍为 DeepSeek Messages 搜索。** 若要避免官方搜索额外的模型调用,安装后可在设置卡片中选择 **DeepSeek Search API** 或第三方引擎并保存。选择 DeepSeek Messages 搜索时,会使用官方搜索 API,可能产生模型调用费用。
|
|
15
15
|
|
|
16
16
|
## 支持的搜索后端
|
|
17
17
|
|
|
18
|
-
- **DeepSeek
|
|
18
|
+
- **DeepSeek Search API** — 复用 DSH rc.2 的官方 `deepseek-search-api`,直接请求 `/v1/tools/search`,无辅助模型轮次。结果数使用官方 `count`(1–50,默认 10)并受调用工具上限约束,不读取本插件的 `maxResults`。
|
|
19
|
+
- **DeepSeek Messages 搜索(安装默认)** — 使用 DeepSeek 的 Anthropic 兼容 Messages API,原生搜索工具类型为 `web_search_20250305`,支持账号令牌或 `DEEPSEEK_API_KEY`。每次搜索会发起模型请求,可能产生模型调用费用。
|
|
19
20
|
- **Tavily** — `keyless`(免费、限流、无需账号)或 `keyed`(`TAVILY_API_KEY`,Bearer token)。keyed 会在设置卡显示额度进度条。
|
|
20
21
|
- **Brave Search** — `GET https://api.search.brave.com/res/v1/web/search`,请求头 `X-Subscription-Token`(凭据名 `BRAVE_API_KEY`)。一次搜索就是一次 HTTP 请求,不走模型轮次;设置卡按响应头展示 Capacity / 月配额。
|
|
21
22
|
- **Serper** — Google 结果(`POST /search`,头 `X-API-KEY`,凭据名 `SERPER_API_KEY`)。
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
|
|
30
31
|
## 运行要求
|
|
31
32
|
|
|
32
|
-
- DeepSeek Harness `0.2.
|
|
33
|
+
- 已验证 DeepSeek Harness `0.2.1-rc.2`。新版 Search / Fetch 需要 Host 提供 `web` 与 `web-deepseek-api` 配置;兼容的 `0.2.0-rc.2` Host 可继续使用原有引擎,不可用的新版 API 选项会禁用。
|
|
33
34
|
- Node.js `^22.19.0` 或 `>=24.0.0`
|
|
34
35
|
- pnpm,用于通过 `dsh plugin` 把插件装进 profile
|
|
35
36
|
|
|
@@ -44,22 +45,37 @@ dsh plugin --profile web add dsh-web-search-plugin
|
|
|
44
45
|
安装后,在 Harness Web 界面中完成配置:
|
|
45
46
|
|
|
46
47
|
1. 打开 **设置 → 网页搜索**,找到本插件的设置卡片。侧栏的 **插件** 页面负责启用或停用组合包,引擎参数在设置卡片中配置。
|
|
47
|
-
2. 选择搜索引擎。若要直接调用搜索 API、避免额外的 DeepSeek 模型调用,可选 Tavily、Brave、Serper、SerpApi、Exa、SearXNG、Scavio 或 Firecrawl。
|
|
48
|
+
2. 选择搜索引擎。若要直接调用搜索 API、避免额外的 DeepSeek 模型调用,可选 DeepSeek Search API、Tavily、Brave、Serper、SerpApi、Exa、SearXNG、Scavio 或 Firecrawl。
|
|
48
49
|
3. 按需填写所选引擎的 API key,需要密钥的引擎会显示「获取 API key ↗」,点击即可打开官方控制台。Tavily 免 key 使用时选择 `keyless`;SearXNG 填写已启用 JSON 搜索的实例地址,这两种免 key 方式不显示密钥获取链接。已有凭据可以复用,例如 Brave 的 `BRAVE_API_KEY`。
|
|
49
|
-
4.
|
|
50
|
+
4. 在 **网页抓取** 中选择本地 HTTP(默认)或 DeepSeek Fetch API。更换搜索引擎不会更改抓取方式。
|
|
51
|
+
5. 调整参数并点击页面底部的 **保存**;保存前只修改草稿,下一次操作使用已保存配置。
|
|
50
52
|
|
|
51
53
|
> 从源码仓库本地安装(含 Windows 跨盘注意事项)见 [开发 → 本地安装与验证](#本地安装与验证)。
|
|
52
54
|
|
|
53
55
|
## 配置
|
|
54
56
|
|
|
55
|
-
日常使用在 **设置 → 网页搜索**
|
|
57
|
+
日常使用在 **设置 → 网页搜索** 的卡片中配置即可。原有引擎参数保存在当前 Profile 的 `dsh-web-search-plugin`,新版 API 参数保存在 `web-deepseek-api`,提供方选择保存在 `web`。下表包含卡片中隐藏的高级字段,并非所有字段都会同时显示。
|
|
58
|
+
|
|
59
|
+
### 新版 Search API 与网页抓取
|
|
60
|
+
|
|
61
|
+
页面复用官方提供方,不重复注册 Search / Fetch。选择新版搜索会将 `web.searchProvider` 设为 `deepseek-search-api`;切回原有引擎则恢复 `dsh-web-search`,并保存本插件的 `provider`。`web.fetchProvider` 独立选择 `http` 或 `deepseek-fetch-api`。已有自定义抓取提供方会显示并保留,除非用户主动更改。
|
|
62
|
+
|
|
63
|
+
新版 Search 和 Fetch 共用 `web-deepseek-api` 命名空间中的 `apiKeyEnv`(默认 `DEEPSEEK_API_KEY`)、`baseURL`(默认 `https://api.deepseek.com/v1/tools`)和凭据。两者同时启用时只显示一份 API 配置;旧 Messages 地址、模型和密钥配置独立保留。`count` 只控制新版搜索的结果数,不是请求次数或费用上限。官方高级配置 `sendOriginalQuestion` 默认开启,搜索时会发送经规整且最多 128 字符的触发问题;可在官方配置中关闭,本页面保留该值。
|
|
64
|
+
|
|
65
|
+
推荐组合为 **DeepSeek Search API + 本地 HTTP**。Search 不发起辅助模型请求;本地 HTTP 从运行 DSH 的设备直接访问目标网站,不调用收费 Fetch API。DeepSeek Fetch 是可选的远端 Markdown 抓取,不保证能读取所有网站;本地 HTTP 不执行页面 JavaScript。工具结果交给主模型后仍占用会话 token。没有自动切换引擎或付费抓取兜底。
|
|
66
|
+
|
|
67
|
+
[官方计费说明](https://api-docs.deepseek.com/zh-cn/guides/search/#计费):Search / Fetch 均按成功且产生结果的请求收费;价格请以官方文档为准。界面不将估算金额当作实际账单。
|
|
68
|
+
|
|
69
|
+
一次保存会先写凭据,再写引擎和 API 参数,最后用一个 `web` mutation 提交本次修改的搜索/抓取选择。每个命名空间有独立 revision,跨命名空间不是事务;若后续步骤失败,已接受的写入不会自动回滚,页面会提示可能部分保存并保留草稿以便重试。保存期间锁定编辑,放弃修改不触发写入。
|
|
70
|
+
|
|
71
|
+
下面的配置表描述本插件原有九个后端;新版 Search 的配置位置如上。
|
|
56
72
|
|
|
57
73
|
### 通用配置
|
|
58
74
|
|
|
59
75
|
| 键 | 默认值 | 含义与范围 |
|
|
60
76
|
|---|---|---|
|
|
61
77
|
| `provider` | `deepseek-official` | 当前搜索引擎:`deepseek-official`、`tavily`、`brave`、`serper`、`serpapi`、`exa`、`searxng`、`scavio` 或 `firecrawl`。一次请求只使用所选引擎,不会在失败后自动切换到其他引擎;未知值会回退到 DeepSeek 官方引擎 |
|
|
62
|
-
| `maxResults` | `8` |
|
|
78
|
+
| `maxResults` | `8` | 本插件原有九个后端的返回源数量上限(不含独立的新版 Search API),范围 1–20,同时受调用方 `request.maxResults` 上限约束。SearXNG 和 Scavio 不发送请求级数量参数,只在收到响应并按 URL 去重后截取;实际可返回的数量取决于上游结果 |
|
|
63
79
|
|
|
64
80
|
### 密钥与凭据引用
|
|
65
81
|
|
|
@@ -110,7 +126,7 @@ DeepSeek 官方账号会话(provider 为 `deepseek-account`)会优先尝试
|
|
|
110
126
|
</thead>
|
|
111
127
|
<tbody>
|
|
112
128
|
<tr>
|
|
113
|
-
<td rowspan="4"><strong>DeepSeek
|
|
129
|
+
<td rowspan="4"><strong>DeepSeek Messages 搜索</strong></td>
|
|
114
130
|
<td><code>deepseekModel</code></td>
|
|
115
131
|
<td><code>deepseek-flash</code></td>
|
|
116
132
|
<td>仅 DeepSeek 搜索请求使用的模型名,不会修改会话的聊天模型;需由目标端点支持</td>
|
|
@@ -190,7 +206,7 @@ DeepSeek 官方账号会话(provider 为 `deepseek-account`)会优先尝试
|
|
|
190
206
|
|
|
191
207
|
## 额度
|
|
192
208
|
|
|
193
|
-
- **DeepSeek
|
|
209
|
+
- **DeepSeek Messages 搜索**:不展示额度条。仍会发起模型搜索请求,用量按所用账号或 API 的计费规则处理。
|
|
194
210
|
- **Tavily keyless**:不展示额度条,免费且有限流。
|
|
195
211
|
- **Tavily keyed**:搜索时请求 `include_usage`,在内存中累加当前凭据的 credits。Host 定时调用 `GET /usage`,设置卡也可手动刷新;手动刷新之间至少间隔 10 秒,自动对账不受此限制。用 `account.current_plan` / `plan_limit` 做限额,用量取当前凭据的本地累计与远端的较大值;换 key 时清空旧账户用量并立即重新对账。旧 Tavily 额度不再持久化到磁盘。
|
|
196
212
|
- **Brave**:没有 usage / 花费接口。控制台 **Capacity** 就是响应头里的每秒窗口(例如 50 次/秒)。月限额 `0` 表示不限请求次数,不是额度用完。计费 credits 只能看 [Brave API 控制台](https://api-dashboard.search.brave.com/)。
|
|
@@ -198,15 +214,15 @@ DeepSeek 官方账号会话(provider 为 `deepseek-account`)会优先尝试
|
|
|
198
214
|
|
|
199
215
|
## 停用或卸载
|
|
200
216
|
|
|
201
|
-
### 优先切换到 DeepSeek
|
|
217
|
+
### 优先切换到 DeepSeek Messages 搜索
|
|
202
218
|
|
|
203
|
-
如果只是想重新使用官方搜索,在 **设置 → 网页搜索** 中选择 **DeepSeek
|
|
219
|
+
如果只是想重新使用官方搜索,在 **设置 → 网页搜索** 中选择 **DeepSeek Messages 搜索** 并保存即可,无需关闭或卸载本插件。下一次搜索会使用本插件接入的官方搜索 API,仍可能产生模型调用费用。
|
|
204
220
|
|
|
205
221
|
### 停用并恢复内置搜索
|
|
206
222
|
|
|
207
223
|
若希望停用本插件、恢复 Harness 原装的搜索插件,再执行以下操作。切换到本插件中的 DeepSeek 引擎与恢复原装插件是两种不同操作。
|
|
208
224
|
|
|
209
|
-
打开侧栏 **插件** 页面,关闭 **整个 `dsh-web-search-plugin`
|
|
225
|
+
打开侧栏 **插件** 页面,关闭 **整个 `dsh-web-search-plugin` 组合包的开关**。这会撤销该组合层,并重新启用内置 Messages 搜索插件。本页面显式保存的提供方选择仍保留在 Profile 中:需检查 `web.searchProvider` 与 `web.fetchProvider`,移除覆盖才能完整恢复 Profile 默认值;之后也可以重新打开组合包。
|
|
210
226
|
|
|
211
227
|
请使用组合包的总开关:仅关闭包内某个组件,其他配置覆盖仍会保留。启用配置热更新的 Profile 会立即应用改动,否则需要重启 Harness。
|
|
212
228
|
|
|
@@ -220,11 +236,11 @@ DeepSeek 官方账号会话(provider 为 `deepseek-account`)会优先尝试
|
|
|
220
236
|
dsh plugin --profile web remove dsh-web-search-plugin
|
|
221
237
|
```
|
|
222
238
|
|
|
223
|
-
|
|
239
|
+
卸载后同样需要检查单独添加的覆盖。显式保存的 `web` 和 `web-deepseek-api` 设置不会随组合包停用或卸载而自动删除。若要完全恢复标准 Profile 默认值,需要检查并移除手动选择的搜索/抓取覆盖;恢复 Messages 搜索时应先重新启用内置 `web-search-deepseek`,抓取可设回 `http`。
|
|
224
240
|
|
|
225
241
|
## 工作方式
|
|
226
242
|
|
|
227
|
-
本插件通过 `ctx.web` 注册一个稳定 id 为 `dsh-web-search` 的 `WebSearchProvider`,遵循与官方 `@deepseek-ai/dsh-web-search-deepseek` 相同的提供方约定(`inject: ['web']` 和 `ctx.web.registerSearchProvider
|
|
243
|
+
本插件通过 `ctx.web` 注册一个稳定 id 为 `dsh-web-search` 的 `WebSearchProvider`,遵循与官方 `@deepseek-ai/dsh-web-search-deepseek` 相同的提供方约定(`inject: ['web']` 和 `ctx.web.registerSearchProvider`)。原有九个引擎由该提供方内部调度;选择新版 Search API 时设置卡改用官方提供方,并独立设置抓取提供方。各引擎结果规范化为 `WebSearchResult`(可选 `content` 和 `sources[]`),按 URL 去重。全部配置字段声明为 `volatile()`,保存后无需重启插件即可读取新配置。
|
|
228
244
|
|
|
229
245
|
本包是 **bundle**:`dsh.bundle.patch` 声明指向 `cordis.patch.yml`,组合包启用时会插入 Host 行、选用 `dsh-web-search`,并禁用内置 `web-search-deepseek` Host 插件。本插件的内部 `deepseek-official` 引擎选项与其注册的 `dsh-web-search` id 不同。关闭整个组合包会移除这一补丁层,仅关闭其中的 Host 行则不会。没有 bundle 声明时,`dsh plugin add` 只写入依赖,插件不会挂载。
|
|
230
246
|
|
|
@@ -284,7 +300,7 @@ dsh plugin --profile web install
|
|
|
284
300
|
|
|
285
301
|
`file:` 是快照:改完仓库后要再 robocopy + `install` 并重启 DSH。改了 `package.json` 的 `files` 字段时,pnpm 可能认为快照未变化而跳过更新,需要先删掉 `node_modules/dsh-web-search-plugin` 再装。
|
|
286
302
|
|
|
287
|
-
用 `dsh --profile web --dump-config`
|
|
303
|
+
用 `dsh --profile web --dump-config` 确认组成树中包含 `dsh-web-search-plugin`。原有引擎对应 `web.searchProvider: dsh-web-search`,新版搜索对应 `deepseek-search-api`;另行核对 `web.fetchProvider` 为 `http` 或主动选择的抓取提供方。
|
|
288
304
|
|
|
289
305
|
### 语法检查
|
|
290
306
|
|
|
@@ -295,7 +311,7 @@ npm test
|
|
|
295
311
|
|
|
296
312
|
客户端 bundle 必须保持 `window.__ModuleLoader__.load({ id, factory })` 线格式 — 由 `dsh-client-modules` 加载,不是打包器。必须同时导出 `apply` 和 `inject`(`slots`、`locale`、`remote`、`remote.credentials`、`configForms`)。
|
|
297
313
|
|
|
298
|
-
配置卡片的宿主就是**设置 → 网页搜索**(`settings.section`,`id: "web-search"
|
|
314
|
+
配置卡片的宿主就是**设置 → 网页搜索**(`settings.section`,`id: "web-search"`),组合 `dsh-web-search-plugin`、`web` 与 `web-deepseek-api` 的公共 ConfigForms。页面通过 `configForms.whileServed([namespace], register)` 跟随插件命名空间,Host 未提供新版 API 配置时只禁用对应选项;客户端不新增 Host 模块导入。
|
|
299
315
|
|
|
300
316
|
本插件不在插件详情页(`plugins.bundle.config`)显示配置。
|
|
301
317
|
|
package/cordis.patch.yml
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
# profile's own cordis.patch.yml still wins if it later overrides `web`. The
|
|
9
9
|
# seam id is `dsh-web-search`; the backend (DeepSeek / Tavily / Brave) is the
|
|
10
10
|
# plugin's own `provider` setting.
|
|
11
|
+
# The settings page can independently override searchProvider to
|
|
12
|
+
# deepseek-search-api and fetchProvider to deepseek-fetch-api on rc.2 Hosts.
|
|
13
|
+
# Keep these defaults for existing profiles; API choices are opt-in.
|
|
11
14
|
- id: web
|
|
12
15
|
name: '@deepseek-ai/dsh-web'
|
|
13
16
|
config:
|
package/lib/client.js
CHANGED
|
@@ -29,6 +29,71 @@ window.__ModuleLoader__.load({
|
|
|
29
29
|
|
|
30
30
|
/** Settings namespace of this plugin. */
|
|
31
31
|
const NS = "dsh-web-search-plugin";
|
|
32
|
+
const API_NS = "web-deepseek-api";
|
|
33
|
+
const API_SEARCH = "deepseek-search-api";
|
|
34
|
+
const API_FETCH = "deepseek-fetch-api";
|
|
35
|
+
const API_FIELDS = { webApiKey: "apiKey", webApiKeyEnv: "apiKeyEnv", webApiBaseURL: "baseURL", webApiCount: "count" };
|
|
36
|
+
/** Combine public ConfigForms; save parameters before switching providers.
|
|
37
|
+
* Each namespace has its own revision. Refusal retains the page's draft;
|
|
38
|
+
* previously accepted namespaces are not rolled back over concurrent edits.
|
|
39
|
+
*/
|
|
40
|
+
function combinedScope(forms) {
|
|
41
|
+
const plugin = forms.get(NS), web = forms.get("web"), api = forms.get(API_NS);
|
|
42
|
+
const merge = (p, w, a) => {
|
|
43
|
+
const value = { ...p, fetchProvider: w?.fetchProvider ?? "http" };
|
|
44
|
+
if (w?.searchProvider === API_SEARCH) value.provider = API_SEARCH;
|
|
45
|
+
for (const [field, key] of Object.entries(API_FIELDS)) if (a && Object.hasOwn(a, key)) value[field] = a[key];
|
|
46
|
+
return value;
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
getSnapshot() {
|
|
50
|
+
const p = plugin.getSnapshot(), w = web.getSnapshot(), a = api.getSnapshot();
|
|
51
|
+
return { ...p, value: merge(p.value, w.value, a.value), base: merge(p.base, w.base, a.base),
|
|
52
|
+
user: { ...p.user, ...Object.fromEntries(Object.entries(API_FIELDS).filter(([, key]) => Object.hasOwn(a.user ?? {}, key)).map(([field, key]) => [field, a.user[key]])), ...(Object.hasOwn(w.user ?? {}, "fetchProvider") ? { fetchProvider: w.user.fetchProvider } : {}), ...(w.user?.searchProvider === API_SEARCH ? { provider: API_SEARCH } : {}) },
|
|
53
|
+
revision: { plugin: p.revision, api: a.revision, web: w.revision },
|
|
54
|
+
apiAvailable: a.status === "ready" && w.status === "ready",
|
|
55
|
+
apiWritable: a.writable && w.writable,
|
|
56
|
+
selectionAvailable: w.status === "ready", selectionWritable: w.writable,
|
|
57
|
+
searchProvider: w.value?.searchProvider };
|
|
58
|
+
},
|
|
59
|
+
subscribe(listener) {
|
|
60
|
+
const stops = [plugin, web, api].map(scope => scope.subscribe(listener));
|
|
61
|
+
return () => stops.forEach(stop => stop());
|
|
62
|
+
},
|
|
63
|
+
async mutate(ops, revisions) {
|
|
64
|
+
const groups = { plugin: [], api: [], web: [] };
|
|
65
|
+
for (const op of ops) {
|
|
66
|
+
const field = op.path[0];
|
|
67
|
+
if (API_FIELDS[field]) groups.api.push({ ...op, path: [API_FIELDS[field]] });
|
|
68
|
+
else if (field === "fetchProvider") groups.web.push(op);
|
|
69
|
+
else if (field === "provider") {
|
|
70
|
+
if (op.op === "set" && op.value === API_SEARCH) groups.web.push({ op: "set", path: ["searchProvider"], value: API_SEARCH });
|
|
71
|
+
else {
|
|
72
|
+
groups.plugin.push(op);
|
|
73
|
+
groups.web.push({ op: "set", path: ["searchProvider"], value: "dsh-web-search" });
|
|
74
|
+
}
|
|
75
|
+
} else groups.plugin.push(op);
|
|
76
|
+
}
|
|
77
|
+
if (groups.web.some(op => op.op === "set" && [API_SEARCH, API_FETCH].includes(op.value)) && api.getSnapshot().status !== "ready") return false;
|
|
78
|
+
for (const [name, scope] of [["plugin", plugin], ["api", api], ["web", web]]) {
|
|
79
|
+
if (groups[name].length && (scope.getSnapshot().status !== "ready" || !scope.getSnapshot().writable)) return false;
|
|
80
|
+
}
|
|
81
|
+
for (const [name, scope] of [["plugin", plugin], ["api", api], ["web", web]]) {
|
|
82
|
+
if (groups[name].length && await scope.mutate(groups[name], revisions[name]) !== true) return false;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
},
|
|
86
|
+
canWrite(plan) {
|
|
87
|
+
return plan.every(item => {
|
|
88
|
+
const field = item.field;
|
|
89
|
+
if ([API_SEARCH, API_FETCH].includes(item.op?.value) && (api.getSnapshot().status !== "ready" || !api.getSnapshot().writable)) return false;
|
|
90
|
+
const scope = API_FIELDS[field] ? api : field === "fetchProvider" ? web : plugin;
|
|
91
|
+
return scope.getSnapshot().status === "ready" && scope.getSnapshot().writable
|
|
92
|
+
&& (field !== "provider" || (web.getSnapshot().status === "ready" && web.getSnapshot().writable));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
32
97
|
// Mirrors lib/config.js; this client bundle has no host-module imports.
|
|
33
98
|
const SUPPLIER_CONFIG_ALIASES = {
|
|
34
99
|
tavilyApiKey: "apiKey",
|
|
@@ -50,6 +115,7 @@ window.__ModuleLoader__.load({
|
|
|
50
115
|
scavioSearchLang: "searchLang"
|
|
51
116
|
};
|
|
52
117
|
const SUPPLIER_DEFAULTS = {
|
|
118
|
+
webApiKeyEnv: "DEEPSEEK_API_KEY", webApiBaseURL: "https://api.deepseek.com/v1/tools", webApiCount: 10, fetchProvider: "http",
|
|
53
119
|
deepseekModel: "deepseek-flash", deepseekApiVersion: "2023-06-01", deepseekMaxTokens: 4096, deepseekMaxUses: 5,
|
|
54
120
|
tavilyMode: "keyless", tavilyApiKey: "", tavilyApiKeyEnv: "TAVILY_API_KEY", tavilyBaseURL: "",
|
|
55
121
|
tavilySearchDepth: "basic", tavilyIncludeAnswer: true, tavilyTopic: "general",
|
|
@@ -126,7 +192,7 @@ window.__ModuleLoader__.load({
|
|
|
126
192
|
const DEEPSEEK_API_KEY_FIELD = "deepseekApiKey";
|
|
127
193
|
/** Form fields carrying literal API keys (write-only, staged under the credentials domain). */
|
|
128
194
|
const REST_KEY_FIELDS = BUILTIN_REST_PROVIDERS.map((entry) => entry.keyField).filter((field) => field !== "");
|
|
129
|
-
const SECRET_FIELDS = new Set([TAVILY_API_KEY_FIELD, BRAVE_API_KEY_FIELD, DEEPSEEK_API_KEY_FIELD, ...REST_KEY_FIELDS]);
|
|
195
|
+
const SECRET_FIELDS = new Set([TAVILY_API_KEY_FIELD, BRAVE_API_KEY_FIELD, DEEPSEEK_API_KEY_FIELD, "webApiKey", ...REST_KEY_FIELDS]);
|
|
130
196
|
const DRAFT_KEY = "dsh-web-search-plugin:settings-draft";
|
|
131
197
|
|
|
132
198
|
function readDraft() {
|
|
@@ -163,7 +229,29 @@ window.__ModuleLoader__.load({
|
|
|
163
229
|
provider: "Search engine",
|
|
164
230
|
providerTavily: "Tavily",
|
|
165
231
|
providerBrave: "Brave Search",
|
|
166
|
-
providerDeepseek: "DeepSeek (
|
|
232
|
+
providerDeepseek: "DeepSeek Messages search (default)",
|
|
233
|
+
providerApi: "DeepSeek Search API",
|
|
234
|
+
searchHeading: "Search engines",
|
|
235
|
+
fetchHeading: "Web retrieval",
|
|
236
|
+
fetchProvider: "Retrieval method",
|
|
237
|
+
fetchHttp: "Local HTTP (default)",
|
|
238
|
+
fetchApi: "DeepSeek Fetch API",
|
|
239
|
+
fetchOther: "Current custom provider: ",
|
|
240
|
+
fetchHttpHint: "Retrieve pages from this device. No DeepSeek Fetch API fee; returned content still uses conversation tokens.",
|
|
241
|
+
apiHint: "Direct API requests, without an auxiliary model call. Search and Fetch are billed per successful request; reading results still uses conversation tokens.",
|
|
242
|
+
messagesHint: "Uses an auxiliary Messages model request in addition to retrieval. Choose Search API to avoid that model call.",
|
|
243
|
+
apiBase: "DeepSeek Search / Fetch API base URL",
|
|
244
|
+
apiCount: "Results per search",
|
|
245
|
+
apiCountHint: "1–50 results per query; the tool's own result limit still applies. This does not limit requests or spending.",
|
|
246
|
+
apiBilling: "API guide and billing ↗",
|
|
247
|
+
credentialConflict: "Two different keys target the same credential reference. Use one key or separate references.",
|
|
248
|
+
invalidApiCount: "Enter a whole number from 1 to 50, or leave blank for the default.",
|
|
249
|
+
apiBaseHint: "Include the API prefix, e.g. https://api.deepseek.com/v1/tools. Shared by Search and Fetch; separate from the Messages endpoint.",
|
|
250
|
+
apiRefHint: "Credential shared by DeepSeek Search API and Fetch API. Account sessions may use an authorized account token.",
|
|
251
|
+
apiShared: "Uses the DeepSeek API configuration in the search section above.",
|
|
252
|
+
apiUnavailable: "The Host must serve web and web-deepseek-api to enable the new APIs (DSH 0.2.1-rc.2 or compatible).",
|
|
253
|
+
searchInactive: "Another search provider is selected in the Host. Choose an engine here to use this page's configuration.",
|
|
254
|
+
partialFailed: "Save failed; some settings may already have been saved. Your draft is retained. Review and retry.",
|
|
167
255
|
mode: "Auth mode",
|
|
168
256
|
modeKeyless: "Keyless (free, rate-limited)",
|
|
169
257
|
modeKeyed: "API key",
|
|
@@ -260,7 +348,29 @@ window.__ModuleLoader__.load({
|
|
|
260
348
|
provider: "搜索引擎",
|
|
261
349
|
providerTavily: "Tavily",
|
|
262
350
|
providerBrave: "Brave Search",
|
|
263
|
-
providerDeepseek: "DeepSeek
|
|
351
|
+
providerDeepseek: "DeepSeek Messages 搜索(默认)",
|
|
352
|
+
providerApi: "DeepSeek Search API",
|
|
353
|
+
searchHeading: "搜索引擎",
|
|
354
|
+
fetchHeading: "网页抓取",
|
|
355
|
+
fetchProvider: "抓取方式",
|
|
356
|
+
fetchHttp: "本地 HTTP(默认)",
|
|
357
|
+
fetchApi: "DeepSeek Fetch API",
|
|
358
|
+
fetchOther: "当前自定义提供方:",
|
|
359
|
+
fetchHttpHint: "由当前设备直接读取网页,无 DeepSeek Fetch 接口费;返回内容仍占用主会话 token。",
|
|
360
|
+
apiHint: "直接请求 API,不调用辅助模型。Search 与 Fetch 按成功请求计费,主模型阅读结果仍消耗 token。",
|
|
361
|
+
messagesHint: "搜索会额外发起 Messages 模型请求;选择 Search API 可省去该辅助模型调用。",
|
|
362
|
+
apiBase: "DeepSeek Search / Fetch API 基础地址",
|
|
363
|
+
apiCount: "每次搜索结果数",
|
|
364
|
+
apiCountHint: "每个查询返回 1–50 条,仍受工具自身结果上限约束;这不是请求次数或费用上限。",
|
|
365
|
+
apiBilling: "API 使用与计费说明 ↗",
|
|
366
|
+
credentialConflict: "两个不同密钥使用了同一凭据引用。请使用同一密钥,或分别设置引用名。",
|
|
367
|
+
invalidApiCount: "请输入 1–50 的整数;留空表示使用默认值。",
|
|
368
|
+
apiBaseHint: "填写含 API 前缀的地址,如 https://api.deepseek.com/v1/tools。Search 与 Fetch 共用,与 Messages 地址分别保存。",
|
|
369
|
+
apiRefHint: "DeepSeek Search API 与 Fetch API 共用的凭据;账号会话可使用经授权的账号令牌。",
|
|
370
|
+
apiShared: "使用上方搜索引擎区域中的 DeepSeek API 配置。",
|
|
371
|
+
apiUnavailable: "新版 API 需要 Host 提供 web 与 web-deepseek-api 配置(DSH 0.2.1-rc.2 或兼容版本)。",
|
|
372
|
+
searchInactive: "Host 当前选择了其他搜索提供方;请在此选择引擎以启用本页面的配置。",
|
|
373
|
+
partialFailed: "保存失败,部分设置可能已保存。草稿已保留,请核对后重试。",
|
|
264
374
|
mode: "认证模式",
|
|
265
375
|
modeKeyless: "Keyless(免费、限流)",
|
|
266
376
|
modeKeyed: "API key",
|
|
@@ -364,6 +474,7 @@ window.__ModuleLoader__.load({
|
|
|
364
474
|
if (!/^[0-9]+$/u.test(trimmed)) return void 0;
|
|
365
475
|
let parsed = Number(trimmed);
|
|
366
476
|
if (!Number.isInteger(parsed) || parsed < 1) return void 0;
|
|
477
|
+
if (bounds?.strict && ((bounds.min != null && parsed < bounds.min) || (bounds.max != null && parsed > bounds.max))) return void 0;
|
|
367
478
|
if (bounds?.min != null && parsed < bounds.min) parsed = bounds.min;
|
|
368
479
|
if (bounds?.max != null && parsed > bounds.max) parsed = bounds.max;
|
|
369
480
|
return { kind: "set", value: parsed };
|
|
@@ -419,6 +530,10 @@ window.__ModuleLoader__.load({
|
|
|
419
530
|
this.scope = scope;
|
|
420
531
|
this.remote = remote;
|
|
421
532
|
this.specs = new Map([
|
|
533
|
+
choiceField("fetchProvider"),
|
|
534
|
+
credentialField("webApiKeyEnv"),
|
|
535
|
+
textField("webApiBaseURL"),
|
|
536
|
+
numberField("webApiCount", { min: 1, max: 50, strict: true }),
|
|
422
537
|
choiceField("provider"),
|
|
423
538
|
choiceField("tavilyMode"),
|
|
424
539
|
numberField("maxResults", { min: 1, max: MAX_RESULTS_CAP }),
|
|
@@ -456,6 +571,7 @@ window.__ModuleLoader__.load({
|
|
|
456
571
|
this.saving = false;
|
|
457
572
|
this.failed = false;
|
|
458
573
|
this.credential = { ref: "", configured: false, writable: true };
|
|
574
|
+
this.apiCredential = { ref: "", configured: false, writable: true };
|
|
459
575
|
this.toastKey = null;
|
|
460
576
|
this.toastTimer = 0;
|
|
461
577
|
this.listeners = new Set();
|
|
@@ -469,7 +585,7 @@ window.__ModuleLoader__.load({
|
|
|
469
585
|
}
|
|
470
586
|
if (draft.failed === true) this.failed = true;
|
|
471
587
|
}
|
|
472
|
-
scope.subscribe(() => {
|
|
588
|
+
this.unsubscribe = scope.subscribe(() => {
|
|
473
589
|
this.publish();
|
|
474
590
|
});
|
|
475
591
|
this.readCredential();
|
|
@@ -491,6 +607,11 @@ window.__ModuleLoader__.load({
|
|
|
491
607
|
invalid: plan.some((item) => item.invalid === true),
|
|
492
608
|
saving: this.saving,
|
|
493
609
|
failed: this.failed,
|
|
610
|
+
apiAvailable: snapshot.apiAvailable,
|
|
611
|
+
apiWritable: snapshot.apiWritable,
|
|
612
|
+
selectionAvailable: snapshot.selectionAvailable,
|
|
613
|
+
selectionWritable: snapshot.selectionWritable,
|
|
614
|
+
searchInactive: snapshot.searchProvider && !["dsh-web-search", API_SEARCH].includes(snapshot.searchProvider),
|
|
494
615
|
toastKey: this.toastKey
|
|
495
616
|
};
|
|
496
617
|
}
|
|
@@ -527,7 +648,7 @@ window.__ModuleLoader__.load({
|
|
|
527
648
|
if (this.stored(field)) plan.push({ field, op: { op: "unset", path: [field] } });
|
|
528
649
|
continue;
|
|
529
650
|
}
|
|
530
|
-
if (staged.text === spec.format(this.sectionValue(field))) continue;
|
|
651
|
+
if (staged.text === spec.format(this.sectionValue(field)) && !(field === "provider" && this.snapshotOf().searchProvider && this.snapshotOf().searchProvider !== (staged.text === API_SEARCH ? API_SEARCH : "dsh-web-search"))) continue;
|
|
531
652
|
const write = spec.parse(staged.text);
|
|
532
653
|
if (write === void 0) plan.push({ field, invalid: true });
|
|
533
654
|
else if (write.kind === "clear") plan.push({ field, op: { op: "unset", path: [field] } });
|
|
@@ -556,8 +677,22 @@ window.__ModuleLoader__.load({
|
|
|
556
677
|
this.showToast("invalid");
|
|
557
678
|
return;
|
|
558
679
|
}
|
|
680
|
+
if (this.scope.canWrite && !this.scope.canWrite(plan)) {
|
|
681
|
+
this.failed = true;
|
|
682
|
+
this.showToast("failed");
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
559
685
|
const revision = this.snapshotOf().revision;
|
|
560
686
|
const credentials = plan.filter((item) => item.credential !== void 0);
|
|
687
|
+
const keysByRef = new Map();
|
|
688
|
+
for (const item of credentials) {
|
|
689
|
+
const ref = this.keyRef(item.field), value = this.staged.get(item.field).text.trim();
|
|
690
|
+
if (keysByRef.has(ref) && keysByRef.get(ref) !== value) {
|
|
691
|
+
this.showToast("credentialConflict");
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
keysByRef.set(ref, value);
|
|
695
|
+
}
|
|
561
696
|
const ops = plan.flatMap((item) => item.op === void 0 ? [] : [item.op]);
|
|
562
697
|
for (const item of plan) {
|
|
563
698
|
const legacy = SUPPLIER_CONFIG_ALIASES[item.field];
|
|
@@ -616,7 +751,7 @@ window.__ModuleLoader__.load({
|
|
|
616
751
|
this.staged.set(field, edit);
|
|
617
752
|
this.failed = false;
|
|
618
753
|
this.publish();
|
|
619
|
-
if (field === "provider" || field === "tavilyApiKeyEnv" || field === "braveApiKeyEnv" || field === "deepseekApiKeyEnv" || BUILTIN_REST_PROVIDERS.some((entry) => entry.keyEnvField === field)) this.readCredential();
|
|
754
|
+
if (field === "provider" || field === "fetchProvider" || field === "webApiKeyEnv" || field === "tavilyApiKeyEnv" || field === "braveApiKeyEnv" || field === "deepseekApiKeyEnv" || BUILTIN_REST_PROVIDERS.some((entry) => entry.keyEnvField === field)) this.readCredential();
|
|
620
755
|
}
|
|
621
756
|
snapshotOf() {
|
|
622
757
|
return this.scope.getSnapshot();
|
|
@@ -635,15 +770,14 @@ window.__ModuleLoader__.load({
|
|
|
635
770
|
return user !== void 0 && (Object.hasOwn(user, field) || Object.hasOwn(user, SUPPLIER_CONFIG_ALIASES[field]));
|
|
636
771
|
}
|
|
637
772
|
publish() {
|
|
773
|
+
if (this.disposed) return;
|
|
638
774
|
writeDraft(this);
|
|
639
775
|
for (const listener of this.listeners) listener();
|
|
640
776
|
}
|
|
641
777
|
/** Draft-aware engine: staged `provider` wins over the saved section. */
|
|
642
778
|
providerOf() {
|
|
643
|
-
const
|
|
644
|
-
if (
|
|
645
|
-
const declared = this.sectionValue("provider");
|
|
646
|
-
if (declared === "tavily" || declared === "brave" || declared === "deepseek-official" || builtinRest(declared) !== void 0) return declared;
|
|
779
|
+
const declared = this.field("provider").text;
|
|
780
|
+
if (declared === API_SEARCH || declared === "tavily" || declared === "brave" || declared === "deepseek-official" || builtinRest(declared) !== void 0) return declared;
|
|
647
781
|
return "deepseek-official";
|
|
648
782
|
}
|
|
649
783
|
credentialRef(field, fallback) {
|
|
@@ -665,6 +799,7 @@ window.__ModuleLoader__.load({
|
|
|
665
799
|
/** The credential reference the currently visible engine uses. */
|
|
666
800
|
refOf() {
|
|
667
801
|
const provider = this.providerOf();
|
|
802
|
+
if (provider === API_SEARCH) return this.credentialRef("webApiKeyEnv", DEFAULT_DEEPSEEK_KEY_REF);
|
|
668
803
|
if (provider === "brave") return this.braveRef();
|
|
669
804
|
if (provider === "deepseek-official") return this.deepseekRef();
|
|
670
805
|
const rest = builtinRest(provider);
|
|
@@ -678,39 +813,49 @@ window.__ModuleLoader__.load({
|
|
|
678
813
|
}
|
|
679
814
|
async readCredential() {
|
|
680
815
|
const ref = this.refOf();
|
|
816
|
+
const apiRef = this.credentialRef("webApiKeyEnv", DEFAULT_DEEPSEEK_KEY_REF);
|
|
817
|
+
if (this.apiCredential.ref !== apiRef) this.apiCredential = { ref: apiRef, configured: false, writable: true };
|
|
681
818
|
if (ref !== this.credential.ref) {
|
|
682
819
|
this.credential = { ref, configured: false, writable: true };
|
|
683
820
|
this.publish();
|
|
684
821
|
}
|
|
685
822
|
let response;
|
|
686
823
|
try {
|
|
687
|
-
response = await this.remote.credentials.describe([ref]);
|
|
824
|
+
response = await this.remote.credentials.describe([...new Set([ref, apiRef])]);
|
|
688
825
|
} catch (_credentialReadFailure) {
|
|
689
826
|
return;
|
|
690
827
|
}
|
|
691
828
|
if (!response.ok || ref !== this.refOf()) return;
|
|
829
|
+
if (apiRef === this.credentialRef("webApiKeyEnv", DEFAULT_DEEPSEEK_KEY_REF)) {
|
|
830
|
+
const apiView = response.value[apiRef];
|
|
831
|
+
this.apiCredential = { ref: apiRef, configured: apiView?.configured ?? false, writable: apiView?.writable ?? true };
|
|
832
|
+
}
|
|
692
833
|
const view = response.value[ref];
|
|
693
834
|
const next = {
|
|
694
835
|
ref,
|
|
695
836
|
configured: view?.configured ?? false,
|
|
696
837
|
writable: view?.writable ?? true
|
|
697
838
|
};
|
|
698
|
-
if (next.configured === this.credential.configured && next.writable === this.credential.writable) return;
|
|
699
839
|
this.credential = next;
|
|
700
840
|
this.publish();
|
|
701
841
|
}
|
|
702
842
|
refreshCredential(ref) {
|
|
703
|
-
if (ref !== this.credential.ref) return;
|
|
843
|
+
if (ref !== this.credential.ref && ref !== this.apiCredential.ref) return;
|
|
704
844
|
this.readCredential();
|
|
705
845
|
}
|
|
706
|
-
|
|
846
|
+
keyRef(field) {
|
|
707
847
|
let ref;
|
|
708
848
|
if (field === BRAVE_API_KEY_FIELD) ref = this.braveRef();
|
|
849
|
+
else if (field === "webApiKey") ref = this.credentialRef("webApiKeyEnv", DEFAULT_DEEPSEEK_KEY_REF);
|
|
709
850
|
else if (field === DEEPSEEK_API_KEY_FIELD) ref = this.deepseekRef();
|
|
710
851
|
else {
|
|
711
852
|
const rest = builtinRestByKeyField(field);
|
|
712
853
|
ref = rest !== void 0 ? this.restKeyRef(rest) : this.tavilyRef();
|
|
713
854
|
}
|
|
855
|
+
return ref;
|
|
856
|
+
}
|
|
857
|
+
async writeKey(field, value) {
|
|
858
|
+
const ref = this.keyRef(field);
|
|
714
859
|
try {
|
|
715
860
|
const response = await this.remote.credentials.set(ref, value);
|
|
716
861
|
if (!response.ok) return false;
|
|
@@ -720,6 +865,12 @@ window.__ModuleLoader__.load({
|
|
|
720
865
|
await this.readCredential();
|
|
721
866
|
return true;
|
|
722
867
|
}
|
|
868
|
+
dispose() {
|
|
869
|
+
this.disposed = true;
|
|
870
|
+
this.unsubscribe();
|
|
871
|
+
this.listeners.clear();
|
|
872
|
+
if (this.toastTimer) clearTimeout(this.toastTimer);
|
|
873
|
+
}
|
|
723
874
|
};
|
|
724
875
|
|
|
725
876
|
/** Bridges the plugin scope and the credentials domain onto the card. */
|
|
@@ -729,13 +880,20 @@ window.__ModuleLoader__.load({
|
|
|
729
880
|
this.remote = remote;
|
|
730
881
|
this.form = new SearchCardForm(scope, remote);
|
|
731
882
|
this.store = this.form.bind(() => this.projection());
|
|
732
|
-
scope.subscribe(() => {
|
|
883
|
+
this.unsubscribe = scope.subscribe(() => {
|
|
733
884
|
this.form.readCredential();
|
|
734
885
|
});
|
|
735
886
|
}
|
|
736
887
|
projection() {
|
|
737
888
|
return {
|
|
738
889
|
...this.form.shell(),
|
|
890
|
+
fetchProvider: this.form.field("fetchProvider"),
|
|
891
|
+
webApiKey: this.form.field("webApiKey"),
|
|
892
|
+
webApiKeyEnv: this.form.field("webApiKeyEnv"),
|
|
893
|
+
webApiBaseURL: this.form.field("webApiBaseURL"),
|
|
894
|
+
webApiCount: this.form.field("webApiCount"),
|
|
895
|
+
webApiKeyConfigured: this.form.apiCredential.configured,
|
|
896
|
+
webApiKeyWritable: this.form.apiCredential.writable,
|
|
739
897
|
provider: this.form.field("provider"),
|
|
740
898
|
tavilyMode: this.form.field("tavilyMode"),
|
|
741
899
|
tavilyApiKey: this.form.field(TAVILY_API_KEY_FIELD),
|
|
@@ -792,7 +950,7 @@ window.__ModuleLoader__.load({
|
|
|
792
950
|
/** Row style: one labelled field with optional override badge and restore-default. */
|
|
793
951
|
const fieldRow = (label, hint, children, meta) => react.createElement("div", { className: "dshws_field" },
|
|
794
952
|
react.createElement("div", { className: "dshws_field_head" },
|
|
795
|
-
react.createElement("label", { className: "dshws_field_label" }, label),
|
|
953
|
+
react.createElement("label", { className: "dshws_field_label", htmlFor: children?.props?.id }, label),
|
|
796
954
|
meta?.overridden ? react.createElement("span", { className: "dshws_field_badges" },
|
|
797
955
|
react.createElement("span", { className: "dshws_badge" }, meta.t("overridden")),
|
|
798
956
|
react.createElement("button", { type: "button", className: "dshws_reset", disabled: meta.disabled === true, onClick: meta.onReset }, meta.t("reset"))) : null),
|
|
@@ -861,6 +1019,7 @@ window.__ModuleLoader__.load({
|
|
|
861
1019
|
".dshws_card_desc{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}",
|
|
862
1020
|
".dshws_pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,rgba(128,128,128,0.12));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}",
|
|
863
1021
|
".dshws_form{display:flex;flex-direction:column;gap:0}",
|
|
1022
|
+
".dshws_section_title{font-size:15px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:var(--dsw-alias-label-primary)}",
|
|
864
1023
|
".dshws_field{display:flex;flex-direction:column;gap:4px;padding:10px 0;border-top:1px solid var(--dsw-alias-border-l2);min-width:0}",
|
|
865
1024
|
".dshws_field_head{display:flex;align-items:center;gap:8px}",
|
|
866
1025
|
".dshws_field_label{min-width:0;flex:1;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:500;line-height:1.5}",
|
|
@@ -869,6 +1028,7 @@ window.__ModuleLoader__.load({
|
|
|
869
1028
|
".dshws_field_error{color:var(--dsw-alias-state-error-primary,#ef4444)!important;margin:0;font-size:12px;line-height:1.45;font-weight:500}",
|
|
870
1029
|
".dshws_pair{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:12px;border-top:1px solid var(--dsw-alias-border-l2)}",
|
|
871
1030
|
".dshws_pair>.dshws_field{border-top:none;padding:10px 0}",
|
|
1031
|
+
"@media(max-width:600px){.dshws_pair{grid-template-columns:minmax(0,1fr)}.dshws_pair>.dshws_field+.dshws_field{border-top:1px solid var(--dsw-alias-border-l2)}.dshws_field_hint{overflow-wrap:anywhere}}",
|
|
872
1032
|
".dshws_badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,rgba(128,128,128,0.12));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}",
|
|
873
1033
|
".dshws_reset{appearance:none;font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:transparent;border:none;padding:0;font-size:12px;line-height:1.5}",
|
|
874
1034
|
".dshws_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}",
|
|
@@ -1059,7 +1219,8 @@ window.__ModuleLoader__.load({
|
|
|
1059
1219
|
if (key === "saved") return t("savedToast");
|
|
1060
1220
|
if (key === "nothing") return t("nothingToSave");
|
|
1061
1221
|
if (key === "invalid") return t("invalidToast");
|
|
1062
|
-
if (key === "failed") return t("
|
|
1222
|
+
if (key === "failed") return t("partialFailed");
|
|
1223
|
+
if (key === "credentialConflict") return t("credentialConflict");
|
|
1063
1224
|
return "";
|
|
1064
1225
|
}
|
|
1065
1226
|
|
|
@@ -1068,7 +1229,10 @@ window.__ModuleLoader__.load({
|
|
|
1068
1229
|
const { t, state, actions } = props;
|
|
1069
1230
|
if (!state.available) return null;
|
|
1070
1231
|
const disabled = !state.writable || state.saving;
|
|
1071
|
-
const provider = state.provider.text === "tavily" || state.provider.text === "brave" || state.provider.text === "deepseek-official" || builtinRest(state.provider.text) !== void 0 ? state.provider.text : "deepseek-official";
|
|
1232
|
+
const provider = state.provider.text === API_SEARCH || state.provider.text === "tavily" || state.provider.text === "brave" || state.provider.text === "deepseek-official" || builtinRest(state.provider.text) !== void 0 ? state.provider.text : "deepseek-official";
|
|
1233
|
+
const apiSearch = provider === API_SEARCH;
|
|
1234
|
+
const fetchProvider = state.fetchProvider.text || "http";
|
|
1235
|
+
const apiFetch = fetchProvider === API_FETCH;
|
|
1072
1236
|
const brave = provider === "brave";
|
|
1073
1237
|
const deepseek = provider === "deepseek-official";
|
|
1074
1238
|
const tavily = provider === "tavily";
|
|
@@ -1076,13 +1240,13 @@ window.__ModuleLoader__.load({
|
|
|
1076
1240
|
const keyed = state.tavilyMode.text === "keyed";
|
|
1077
1241
|
const keyHint = state.apiKeyConfigured ? t("apiKeyHint") : t("apiKeyHint") + " " + t("apiKeyUnavailableHint");
|
|
1078
1242
|
const toastText = toastCopy(t, state.toastKey);
|
|
1079
|
-
const toastTone =
|
|
1243
|
+
const toastTone = ["failed", "invalid", "credentialConflict"].includes(state.toastKey) ? "error" : state.toastKey === "nothing" ? "info" : "success";
|
|
1080
1244
|
const row = (field, label, hint, children) => fieldRow(label, hint, children, {
|
|
1081
1245
|
t,
|
|
1082
1246
|
overridden: state[field]?.overridden === true,
|
|
1083
1247
|
invalid: state[field]?.invalid === true,
|
|
1084
|
-
errorKey: field.endsWith("ApiKeyEnv") || field === "apiKeyEnv" ? "invalidCredentialRef" : "invalidNumber",
|
|
1085
|
-
disabled,
|
|
1248
|
+
errorKey: field.endsWith("ApiKeyEnv") || field === "apiKeyEnv" ? "invalidCredentialRef" : field === "webApiCount" ? "invalidApiCount" : "invalidNumber",
|
|
1249
|
+
disabled: disabled || (API_FIELDS[field] ? !state.apiWritable : field === "fetchProvider" || field === "provider" ? !state.selectionWritable : false),
|
|
1086
1250
|
onReset: () => actions.resetField(field)
|
|
1087
1251
|
});
|
|
1088
1252
|
const maxResultsWrite = numberField("maxResults", { min: 1, max: MAX_RESULTS_CAP }).parse(String(state.maxResults.text ?? "").trim());
|
|
@@ -1098,14 +1262,28 @@ window.__ModuleLoader__.load({
|
|
|
1098
1262
|
return react.createElement("option", { value: n, key: n }, n);
|
|
1099
1263
|
})
|
|
1100
1264
|
}));
|
|
1265
|
+
const apiConfig = () => react.createElement("div", { className: "dshws_form" },
|
|
1266
|
+
pair(
|
|
1267
|
+
fieldRow(t("apiKey"), t("apiKeyHint"), secretInput({ id: "ws-api-key", value: state.webApiKey.text, disabled: disabled || !state.apiWritable || !state.webApiKeyWritable, placeholder: state.webApiKeyConfigured ? t("apiKeySet") : t("apiKeyUnset"), onChange: e => actions.edit("webApiKey", e.target.value) })),
|
|
1268
|
+
row("webApiKeyEnv", t("apiKeyEnv"), t("apiRefHint"), textInput({ id: "ws-api-keyref", value: state.webApiKeyEnv.text, disabled: disabled || !state.apiWritable, onChange: e => actions.edit("webApiKeyEnv", e.target.value) }))
|
|
1269
|
+
),
|
|
1270
|
+
row("webApiBaseURL", t("apiBase"), t("apiBaseHint"), textInput({ id: "ws-api-base", value: state.webApiBaseURL.text, disabled: disabled || !state.apiWritable, onChange: e => actions.edit("webApiBaseURL", e.target.value) })),
|
|
1271
|
+
keyConsoleLink(t, "deepseek-official"),
|
|
1272
|
+
react.createElement("p", { className: "dshws_field_hint" }, t("apiHint")),
|
|
1273
|
+
react.createElement("a", { href: "https://api-docs.deepseek.com/zh-cn/guides/search/", target: "_blank", rel: "noopener noreferrer", className: "dshws_field_hint", style: { padding: "6px 0 10px" } }, t("apiBilling"))
|
|
1274
|
+
);
|
|
1101
1275
|
return react.createElement("div", { className: "dshws_form" },
|
|
1102
1276
|
react.createElement("div", { className: "dshws_card_header" },
|
|
1103
1277
|
react.createElement("div", { className: "dshws_card_headText" },
|
|
1104
1278
|
react.createElement("span", { className: "dshws_card_name" }, t("nav"))),
|
|
1105
1279
|
state.dirty || state.failed ? react.createElement("span", { className: "dshws_pending" }, t("unsaved")) : null),
|
|
1106
1280
|
!state.writable ? react.createElement("p", { className: "dshws_field_hint", style: { padding: "8px 0 0" } }, t("readOnly")) : null,
|
|
1281
|
+
react.createElement("h3", { className: "dshws_section_title" }, t("searchHeading")),
|
|
1282
|
+
state.searchInactive ? react.createElement("p", { className: "dshws_field_hint" }, t("searchInactive")) : null,
|
|
1283
|
+
!state.apiAvailable ? react.createElement("p", { className: "dshws_field_hint" }, t("apiUnavailable")) : null,
|
|
1107
1284
|
pair(
|
|
1108
|
-
row("provider", t("provider"), null, selectInput({ id: "ws-provider", value: provider, disabled, onChange: (e) => actions.edit("provider", e.target.value), children: [
|
|
1285
|
+
row("provider", t("provider"), null, selectInput({ id: "ws-provider", value: provider, disabled: disabled || !state.selectionWritable, onChange: (e) => actions.edit("provider", e.target.value), children: [
|
|
1286
|
+
react.createElement("option", { value: API_SEARCH, key: API_SEARCH, disabled: !state.apiAvailable || !state.apiWritable }, t("providerApi")),
|
|
1109
1287
|
react.createElement("option", { value: "deepseek-official", key: "deepseek-official" }, t("providerDeepseek")),
|
|
1110
1288
|
react.createElement("option", { value: "tavily", key: "tavily" }, t("providerTavily")),
|
|
1111
1289
|
react.createElement("option", { value: "brave", key: "brave" }, t("providerBrave")),
|
|
@@ -1118,6 +1296,9 @@ window.__ModuleLoader__.load({
|
|
|
1118
1296
|
react.createElement("option", { value: "keyed", key: "keyed" }, t("modeKeyed"))
|
|
1119
1297
|
] })) : null
|
|
1120
1298
|
),
|
|
1299
|
+
apiSearch ? apiConfig() : null,
|
|
1300
|
+
apiSearch ? row("webApiCount", t("apiCount"), t("apiCountHint"), numberInput({ id: "ws-api-count", value: state.webApiCount.text, min: 1, max: 50, disabled: disabled || !state.apiWritable, onChange: e => actions.edit("webApiCount", e.target.value) })) : null,
|
|
1301
|
+
deepseek ? react.createElement("p", { className: "dshws_field_hint" }, t("messagesHint")) : null,
|
|
1121
1302
|
react.createElement(QuotaCard, { t, provider, keyed }),
|
|
1122
1303
|
keyConsoleLink(t, provider, restMeta, keyed),
|
|
1123
1304
|
deepseek ? pair(
|
|
@@ -1182,6 +1363,14 @@ window.__ModuleLoader__.load({
|
|
|
1182
1363
|
row(restMeta.baseURLField, t("baseURL"), t("baseURLHint"), textInput({ id: "ws-" + restMeta.id + "-base", value: state[restMeta.baseURLField]?.text || restMeta.defaultBaseURL || "", disabled, onChange: (e) => actions.edit(restMeta.baseURLField, e.target.value) })),
|
|
1183
1364
|
maxResultsRow
|
|
1184
1365
|
) : null,
|
|
1366
|
+
react.createElement("h3", { className: "dshws_section_title", style: { borderTop: "1px solid var(--dsw-alias-border-l2)", paddingTop: "20px", marginTop: "20px" } }, t("fetchHeading")),
|
|
1367
|
+
row("fetchProvider", t("fetchProvider"), null, selectInput({ id: "ws-fetch-provider", value: fetchProvider, disabled: disabled || !state.selectionAvailable || !state.selectionWritable, onChange: e => actions.edit("fetchProvider", e.target.value), children: [
|
|
1368
|
+
react.createElement("option", { value: "http", key: "http" }, t("fetchHttp")),
|
|
1369
|
+
react.createElement("option", { value: API_FETCH, key: API_FETCH, disabled: !state.apiAvailable || !state.apiWritable }, t("fetchApi")),
|
|
1370
|
+
!["http", API_FETCH].includes(fetchProvider) ? react.createElement("option", { value: fetchProvider, key: fetchProvider }, t("fetchOther") + fetchProvider) : null
|
|
1371
|
+
] })),
|
|
1372
|
+
fetchProvider === "http" ? react.createElement("p", { className: "dshws_field_hint" }, t("fetchHttpHint")) : null,
|
|
1373
|
+
apiFetch ? (apiSearch ? react.createElement("p", { className: "dshws_field_hint" }, t("apiShared")) : apiConfig()) : null,
|
|
1185
1374
|
react.createElement("div", { style: { borderTop: "1px solid var(--dsw-alias-border-l2)", justifyContent: "flex-end", alignItems: "center", gap: "8px", padding: "12px 0 4px", display: "flex" } },
|
|
1186
1375
|
react.createElement("button", {
|
|
1187
1376
|
type: "button",
|
|
@@ -1195,7 +1384,7 @@ window.__ModuleLoader__.load({
|
|
|
1195
1384
|
react.createElement("button", {
|
|
1196
1385
|
type: "button",
|
|
1197
1386
|
className: "dshws_btn dshws_btn_primary",
|
|
1198
|
-
disabled: state.saving || !state.writable,
|
|
1387
|
+
disabled: state.saving || !state.writable || state.invalid || (!state.dirty && !state.failed),
|
|
1199
1388
|
onClick: (event) => {
|
|
1200
1389
|
event.preventDefault();
|
|
1201
1390
|
void actions.save();
|
|
@@ -1269,7 +1458,7 @@ window.__ModuleLoader__.load({
|
|
|
1269
1458
|
// One controller for the settings section, created as soon as the Host
|
|
1270
1459
|
// serves this namespace and torn down with it.
|
|
1271
1460
|
ctx.effect(() => ctx.configForms.whileServed([NS], () => {
|
|
1272
|
-
shared.controller = new SearchCardController(ctx.configForms
|
|
1461
|
+
shared.controller = new SearchCardController(combinedScope(ctx.configForms), ctx.remote);
|
|
1273
1462
|
const stopUsage = usageStore.start();
|
|
1274
1463
|
const stopCredentials = ctx.remote.$on("credentials/reference-updated", (ref) => {
|
|
1275
1464
|
shared.controller?.form.refreshCredential(ref);
|
|
@@ -1288,6 +1477,8 @@ window.__ModuleLoader__.load({
|
|
|
1288
1477
|
return stopSection;
|
|
1289
1478
|
});
|
|
1290
1479
|
return () => {
|
|
1480
|
+
shared.controller?.unsubscribe();
|
|
1481
|
+
shared.controller?.form.dispose();
|
|
1291
1482
|
shared.controller = null;
|
|
1292
1483
|
stopUsage();
|
|
1293
1484
|
stopCredentials();
|
package/lib/deepseek.js
CHANGED
|
@@ -124,7 +124,8 @@ export class DeepSeekSearchProvider {
|
|
|
124
124
|
role: "user",
|
|
125
125
|
content: [{ type: "text", text: `Perform a web search for the query: ${request.query}` }]
|
|
126
126
|
}],
|
|
127
|
-
tools: [{ type: "web_search_20250305", name: "web_search", max_uses: options.maxUses }]
|
|
127
|
+
tools: [{ type: "web_search_20250305", name: "web_search", max_uses: options.maxUses }],
|
|
128
|
+
thinking: { type: "disabled" }
|
|
128
129
|
};
|
|
129
130
|
// Record the exact secret-free request before it leaves; a throw here
|
|
130
131
|
// prevents dispatch rather than logging an unrecorded model input.
|
package/lib/shared.js
CHANGED
|
@@ -7,7 +7,7 @@ import { launchEnvironmentOf } from "@deepseek-ai/dsh-launch-environment";
|
|
|
7
7
|
import { WebError } from "@deepseek-ai/dsh-web";
|
|
8
8
|
|
|
9
9
|
/** Attribution header sent on every request. */
|
|
10
|
-
export const USER_AGENT = "dsh-web-search-plugin/0.
|
|
10
|
+
export const USER_AGENT = "dsh-web-search-plugin/0.6.0";
|
|
11
11
|
/** Shared cap: Tavily `max_results` and Brave `count` both accept 1..20. */
|
|
12
12
|
export const MAX_RESULTS_CAP = 20;
|
|
13
13
|
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Web search",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "Search engines and web retrieval in one page: DeepSeek Search API, Messages, eight third-party engines, local HTTP and optional DeepSeek Fetch API."
|
|
5
5
|
}
|
|
6
|
-
}
|
|
6
|
+
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "网页搜索",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "在一个页面独立配置搜索引擎与网页抓取:DeepSeek Search API、Messages、8 个第三方引擎、本地 HTTP 和可选 DeepSeek Fetch API。"
|
|
5
5
|
}
|
|
6
|
-
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-web-search-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Web search and retrieval settings for DeepSeek Harness: DeepSeek Search API, Messages, eight search backends, local HTTP and DeepSeek Fetch API",
|
|
5
5
|
"icon": "./assets/icon.svg",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"dsh-plugin",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"undici": "^6.21.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@deepseek-ai/dsh-web": "^0.2.0-rc.2",
|
|
67
|
-
"@deepseek-ai/dsh-credentials": "^0.2.0-rc.2",
|
|
68
|
-
"@deepseek-ai/dsh-settings": "^0.2.0-rc.2",
|
|
69
|
-
"@deepseek-ai/dsh-launch-environment": "^0.2.0-rc.2",
|
|
66
|
+
"@deepseek-ai/dsh-web": "^0.2.0-rc.2 || ^0.2.1-rc.2",
|
|
67
|
+
"@deepseek-ai/dsh-credentials": "^0.2.0-rc.2 || ^0.2.1-rc.2",
|
|
68
|
+
"@deepseek-ai/dsh-settings": "^0.2.0-rc.2 || ^0.2.1-rc.2",
|
|
69
|
+
"@deepseek-ai/dsh-launch-environment": "^0.2.0-rc.2 || ^0.2.1-rc.2",
|
|
70
70
|
"@deepseek-ai/schemastery": "~3.18.4",
|
|
71
71
|
"@deepseek-ai/cordis": "~4.0.4"
|
|
72
72
|
},
|