WeKnora/internal
Fei.Chen 15727591a7
feat(web-search): add Bocha AI Search provider (#3036)
* feat(web-search): add Bocha AI Search provider

Add a Bocha (bochaai.com) web search provider following the Metaso
adapter pattern: hardcoded official endpoint (SSRF-safe), Bearer auth,
4MB response cap, error-detail extraction, and RFC3339 date parsing
(datePublished preferred, dateLastCrawled fallback).

Tenant-facing config fields:
- freshness: noLimit/oneDay/oneWeek/oneMonth/oneYear (default noLimit)
- summary: request long text summaries, preferred as snippets (default on)

Wiring: registry factory in container, provider type enum + /types
metadata (dynamic form fields), frontend provider union type, and
swagger docs enum entries.

* fix(web-search): match Bocha's real wire format for codes and error messages

Live endpoint probing showed errors return {"message": .., "code": "401"}
(string code, message field) instead of the documented {msg, code:int}.
Parse the code tolerantly (string or number) and extract the detail from
message/msg so auth and rate-limit failures surface their reason.

* fix(web-search): allow Bocha in provider CRUD validation

In-service integration testing caught a fourth wiring point the adapter,
registry, /types metadata and frontend covered but CRUD did not: the
service-layer whitelist (isValidProviderType) and parameter validation
switches rejected provider type 'bocha', so providers could be tested
via POST /web-search-providers/test but never created or updated.

Add Bocha to both switches (delegating to ValidateBochaParameters like
Metaso/Zhipu) with service-level test coverage.

* fix(web-search): correct Bocha legacy timestamp timezone

---------

Co-authored-by: vicfei <vicfei@users.noreply.github.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 20:06:26 +08:00
..
agent fix(chat): send one completion-token field per provider (#3082) 2026-09-07 19:16:27 +08:00
application feat(web-search): add Bocha AI Search provider (#3036) 2026-09-07 20:06:26 +08:00
assets feat(assets): add ASR test audio file and embed it in the application 2026-04-02 21:27:27 +08:00
common fix(markdown): sanitize invalid UTF-8 and NUL bytes 2026-08-31 12:24:35 +08:00
config feat: support complex password (#2929) 2026-09-01 11:50:10 +08:00
container feat(web-search): add Bocha AI Search provider (#3036) 2026-09-07 20:06:26 +08:00
database feat(mcp): add per-tool enable toggle (#2989) 2026-09-05 17:19:20 +08:00
datasource feat(datasource): persist source created time; Feishu uses content edit time for source_updated_at (#3083) 2026-09-07 19:39:01 +08:00
errors feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files 2026-09-02 22:09:09 +08:00
event feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files 2026-09-02 22:09:09 +08:00
handler refactor(system): drop idempotent flag from create-user response body 2026-09-07 17:30:47 +08:00
im fix(feishu): preserve images embedded in post messages 2026-09-05 16:48:16 +08:00
infrastructure feat(web-search): add Bocha AI Search provider (#3036) 2026-09-07 20:06:26 +08:00
ipclass fix: share IP classification between SSRF and sandbox URL guards 2026-09-01 15:35:14 +08:00
logger fix(sandbox): record product-level Langfuse spans and detach idle sweeps 2026-08-31 19:42:32 +08:00
mcp fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
middleware fix(models): show usage details when deletion is blocked (#2975) 2026-09-02 17:20:37 +08:00
modelcontext feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
models fix(chat): send one completion-token field per provider (#3082) 2026-09-07 19:16:27 +08:00
ratelimit feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +08:00
router fix(session): serve org-shared KB images through the message file proxy (#3069) 2026-09-07 15:43:09 +08:00
runtime fix(redis): harden TLS tests and surface TLS config at startup 2026-07-06 23:04:52 +08:00
sandbox feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
searchutil fix(chat): keep OCR/caption text of scanned-page image hits in merge (#3064) 2026-09-07 11:38:47 +08:00
storageallowlist fix(storage): align default provider fallback with STORAGE_ALLOW_LIST 2026-07-15 11:05:00 +08:00
storageurl fix(api): address resource_urls review follow-ups 2026-08-05 14:42:51 +08:00
stream feat(redis): support TLS for Redis connections (#1930) 2026-07-06 23:02:02 +08:00
tracing/langfuse fix(observability): nest follow-up completions under the chat trace 2026-08-31 19:42:32 +08:00
types feat(web-search): add Bocha AI Search provider (#3036) 2026-09-07 20:06:26 +08:00
utils fix(security): reject traversal in local prefixes, task IDs, and wiki sort 2026-09-07 11:23:45 +08:00