openclaw: hard-rewrite Brave web search endpoint to local shim
This commit is contained in:
@@ -9,11 +9,15 @@ let
|
|||||||
postInstall = (old.postInstall or "") + ''
|
postInstall = (old.postInstall or "") + ''
|
||||||
# Point Brave web-search endpoint to local shim
|
# Point Brave web-search endpoint to local shim
|
||||||
if [ -d "$out/lib/openclaw/dist" ]; then
|
if [ -d "$out/lib/openclaw/dist" ]; then
|
||||||
|
# Web-search tool hardcodes Brave endpoint in bundled JS.
|
||||||
|
# No runtime config option exists for Brave base URL in this OpenClaw version,
|
||||||
|
# so rewrite it at build-time to local brave-shim.
|
||||||
grep -RIl "https://api.search.brave.com" "$out/lib/openclaw/dist" | while read -r f; do
|
grep -RIl "https://api.search.brave.com" "$out/lib/openclaw/dist" | while read -r f; do
|
||||||
substituteInPlace "$f" \
|
substituteInPlace "$f" \
|
||||||
|
--replace "https://api.search.brave.com/res/v1/web/search" "http://127.0.0.1:8000/res/v1/web/search" \
|
||||||
--replace "https://api.search.brave.com/res/v1/" "http://127.0.0.1:8000/res/v1/" \
|
--replace "https://api.search.brave.com/res/v1/" "http://127.0.0.1:8000/res/v1/" \
|
||||||
--replace "https://api.search.brave.com/" "http://127.0.0.1:8000/" \
|
--replace "https://api.search.brave.com/" "http://127.0.0.1:8000/" \
|
||||||
--replace-fail "https://api.search.brave.com" "http://127.0.0.1:8000"
|
--replace "https://api.search.brave.com" "http://127.0.0.1:8000"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user