Skip to content

feat(web-search): make Brave Search base URL configurable#1

Open
tim-srp wants to merge 3 commits intomainfrom
feat/brave-configurable-base-url
Open

feat(web-search): make Brave Search base URL configurable#1
tim-srp wants to merge 3 commits intomainfrom
feat/brave-configurable-base-url

Conversation

@tim-srp
Copy link
Copy Markdown

@tim-srp tim-srp commented Mar 11, 2026

将 Brave Search API base URL 改为可配置,支持指向反向代理或内部镜像。

改动

  • tools.web.search.brave.baseUrl 配置字段(替换 origin https://api.search.brave.com
  • BRAVE_BASE_URL 环境变量支持(config 优先级更高)
  • llm-context 和 web 两个模式的 cache key 都包含 braveBaseUrl,避免跨 origin 缓存命中

对应 upstream PR: openclaw#42882

Tim-shiqi added 3 commits March 11, 2026 07:15
Add support for a custom base URL for Brave Search API requests, useful
for pointing at a reverse proxy or internal mirror.

Changes:
- tools.web.search.brave.baseUrl config field (replaces the origin
  https://api.search.brave.com, path segments are preserved)
- BRAVE_BASE_URL env var as an alternative (config takes precedence)
- resolveBraveBaseUrl() helper following the same pattern as
  resolveKimiBaseUrl()
- braveBaseUrl threaded through runWebSearch / runBraveLlmContextSearch
- Cache key updated to include braveBaseUrl to avoid cross-origin hits

Default behaviour is unchanged when neither config nor env var is set.
… remove dead constants

- Add providerSpecificKey to the llm-context cache key branch so that
  requests with different braveBaseUrl values no longer collide.
- Remove the now-unused BRAVE_SEARCH_ENDPOINT and BRAVE_LLM_CONTEXT_ENDPOINT
  constants (dead code since the URL construction switched to path+base form).
Cover config baseUrl, env var fallback, priority (config > env > default),
whitespace trimming, and empty env var fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant