feat(memory): add Ollama embedding provider (#26349)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: ac41386543
Co-authored-by: nico-hoff <43175972+nico-hoff@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
nico-hoff
2026-03-03 02:56:40 +01:00
committed by GitHub
parent 4ba5937ef9
commit 3eec79bd6c
17 changed files with 367 additions and 25 deletions

View File

@@ -235,6 +235,31 @@ describe("noteMemorySearchHealth", () => {
const message = String(note.mock.calls[0]?.[0] ?? "");
expect(message).toContain("openclaw configure --section model");
});
it("still warns in auto mode when only ollama credentials exist", async () => {
resolveMemorySearchConfig.mockReturnValue({
provider: "auto",
local: {},
remote: {},
});
resolveApiKeyForProvider.mockImplementation(async ({ provider }: { provider: string }) => {
if (provider === "ollama") {
return {
apiKey: "ollama-local",
source: "env: OLLAMA_API_KEY",
mode: "api-key",
};
}
throw new Error("missing key");
});
await noteMemorySearchHealth(cfg);
expect(note).toHaveBeenCalledTimes(1);
const providerCalls = resolveApiKeyForProvider.mock.calls as Array<[{ provider: string }]>;
const providersChecked = providerCalls.map(([arg]) => arg.provider);
expect(providersChecked).toEqual(["openai", "google", "voyage", "mistral"]);
});
});
describe("detectLegacyWorkspaceDirs", () => {

View File

@@ -186,7 +186,7 @@ function hasLocalEmbeddings(local: { modelPath?: string }, useDefaultFallback =
}
async function hasApiKeyForProvider(
provider: "openai" | "gemini" | "voyage" | "mistral",
provider: "openai" | "gemini" | "voyage" | "mistral" | "ollama",
cfg: OpenClawConfig,
agentDir: string,
): Promise<boolean> {