feat(tools): add DeepSeek Search as a web_search provider

Add a standalone `deepseek` search backend that calls the DeepSeek Search
API (POST https://api.deepseek.com/v1/tools/search), following the
provider layout used by AnySearch (#5607) and Bocha (#4182).

This is a search-only integration. It does not touch the DeepSeek LLM
provider, does not inject a `web_search` tool into model requests, and
does not implement the Fetch endpoint.

- Trim and truncate queries to the API's 128 Unicode-character limit
  locally, rejecting whitespace-only queries without a network call.
- Clamp `count` to the API's 1-50 range and always send
  `need_content: false` so page bodies stay out of the model context.
- Format results from `summary`, falling back to `snippet` when a summary
  is missing or blank, and include `date` when present. Cap each result's
  text at 500 characters: live responses reach ~4,500 characters, so ten
  uncapped results cost roughly 10k tokens per call.
- Return actionable 401 and 402 messages; retry 408/429/5xx once after
  1.0s like the Brave provider; surface `error.message` for other 4xx,
  tag-stripped because the upstream body is untrusted. Unexpected
  transport errors report the exception type only, with the detail
  logged when tool log content is allowed.
- Read the key from `tools.web.search.apiKey` or `DEEPSEEK_API_KEY` and
  fall back to DuckDuckGo when neither is set, like other keyed
  providers. The key is never logged or echoed in errors.
- Register the provider for the CLI wizard and WebUI settings, and reuse
  the bundled DeepSeek brand asset.
This commit is contained in:
moran authored and chengyongru committed 2026-10-19 16:50:17 +08:00
1 parent 5d886fbb20
commit e5b469ebd4
5 files changed
+759 -2

No files matched your search

+5
View File
@@ -128,6 +128,11 @@ describe("provider brand logos", () => {
expect(providerBrand("bocha")?.initials).toBe("B");
});
it("reuses the bundled DeepSeek brand for DeepSeek web search settings", () => {
expect(providerBrand("deepseek")?.logoUrl).toMatch(/^\/src\/assets\/providers\/.*\.svg$/);
expect(providerBrand("deepseek")?.initials).toBe("DS");
});
it("keeps Keenable web search settings on the first-party brand domain", () => {
expect(providerBrand("keenable")?.logoUrls).toContain("https://keenable.ai/favicon.ico");
expect(providerBrand("keenable")?.initials).toBe("K");