mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:30:42 +00:00
fix: install disabled external search providers
This commit is contained in:
@@ -322,4 +322,53 @@ describe("runSearchSetupFlow", () => {
|
||||
spec: "@openclaw/brave-plugin",
|
||||
});
|
||||
});
|
||||
|
||||
it("installs an external catalog search provider when web search stays disabled", async () => {
|
||||
const select = vi.fn().mockResolvedValueOnce("brave");
|
||||
const text = vi.fn().mockResolvedValue("brave-disabled-key");
|
||||
const prompter = createWizardPrompter({
|
||||
select: select as never,
|
||||
text: text as never,
|
||||
});
|
||||
|
||||
const next = await runSearchSetupFlow(
|
||||
{
|
||||
tools: {
|
||||
web: {
|
||||
search: {
|
||||
provider: "brave",
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
createNonExitingRuntime(),
|
||||
prompter,
|
||||
);
|
||||
|
||||
expect(ensureOnboardingPluginInstalled).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
entry: expect.objectContaining({
|
||||
pluginId: "brave",
|
||||
label: "Brave",
|
||||
install: expect.objectContaining({
|
||||
npmSpec: "@openclaw/brave-plugin",
|
||||
}),
|
||||
}),
|
||||
autoConfirmSingleSource: true,
|
||||
}),
|
||||
);
|
||||
expect(next.tools?.web?.search).toMatchObject({
|
||||
provider: "brave",
|
||||
enabled: false,
|
||||
});
|
||||
expect(next.plugins?.entries?.brave?.config?.webSearch).toMatchObject({
|
||||
apiKey: "brave-disabled-key",
|
||||
});
|
||||
expect(next.plugins?.entries?.brave?.enabled).toBeUndefined();
|
||||
expect(next.plugins?.installs?.brave).toMatchObject({
|
||||
source: "npm",
|
||||
spec: "@openclaw/brave-plugin",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -342,7 +342,7 @@ async function finalizeSearchProviderSetup(params: {
|
||||
prompter: WizardPrompter;
|
||||
opts?: SetupSearchOptions;
|
||||
}): Promise<OpenClawConfig> {
|
||||
let next = preserveDisabledState(params.originalConfig, params.nextConfig);
|
||||
let next = params.nextConfig;
|
||||
const installEntry = params.entry[SEARCH_INSTALL_CATALOG_ENTRY];
|
||||
if (installEntry && next.tools?.web?.search?.enabled !== false) {
|
||||
const { ensureOnboardingPluginInstalled } =
|
||||
@@ -363,6 +363,7 @@ async function finalizeSearchProviderSetup(params: {
|
||||
}
|
||||
next = installed.cfg;
|
||||
}
|
||||
next = preserveDisabledState(params.originalConfig, next);
|
||||
if (!params.entry.runSetup) {
|
||||
return next;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user