Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions scripts/generate-openclaw-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ def _placeholder(channel: str, env_key: str) -> str:
},
"models": {"mode": "merge", "providers": providers},
"channels": {"defaults": {}, **_ch_cfg},
"tools": {"toolSearch": True},
"update": {"checkOnStart": False},
# Disable bundled plugins/channels that hit the L7 proxy at startup
# and either crash or hang the gateway:
Expand Down Expand Up @@ -733,15 +734,13 @@ def _placeholder(channel: str, env_key: str) -> str:
}

if env.get("NEMOCLAW_WEB_SEARCH_ENABLED", "") == "1":
config["tools"] = {
"web": {
"search": {
"enabled": True,
"provider": "brave",
"apiKey": "openshell:resolve:env:BRAVE_API_KEY",
},
"fetch": {"enabled": True},
}
config.setdefault("tools", {})["web"] = {
"search": {
"enabled": True,
"provider": "brave",
"apiKey": "openshell:resolve:env:BRAVE_API_KEY",
},
"fetch": {"enabled": True},
}

return config
Expand Down
14 changes: 13 additions & 1 deletion test/generate-openclaw-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,25 @@ describe("generate-openclaw-config.py: config generation", () => {
});
});

it("enables native OpenClaw Tool Search by default", () => {
const config = runConfigScript();
expect(config.tools?.toolSearch).toBe(true);
});

it("enables web search when env is '1'", () => {
const config = runConfigScript({ NEMOCLAW_WEB_SEARCH_ENABLED: "1" });
expect(config.tools?.web?.search?.enabled).toBe(true);
expect(config.tools?.toolSearch).toBe(true);
expect(config.tools?.web?.search).toEqual({
enabled: true,
provider: "brave",
apiKey: "openshell:resolve:env:BRAVE_API_KEY",
});
expect(config.tools?.web?.fetch?.enabled).toBe(true);
});

it("omits web search when env is not set", () => {
const config = runConfigScript();
expect(config.tools?.toolSearch).toBe(true);
expect(config.tools?.web).toBeUndefined();
});

Expand Down
Loading