mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:10:51 +00:00
fix: silence Ollama memory doctor key warning
This commit is contained in:
@@ -394,6 +394,37 @@ describe("noteMemorySearchHealth", () => {
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not warn for ollama when gateway probe is ready without CLI API key", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "ollama",
|
||||
local: {},
|
||||
remote: {},
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg, {
|
||||
gatewayMemoryProbe: { checked: true, ready: true },
|
||||
});
|
||||
|
||||
expect(note).not.toHaveBeenCalled();
|
||||
expect(resolveApiKeyForProvider).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("warns for ollama when gateway probe reports embeddings are not ready", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "ollama",
|
||||
local: {},
|
||||
remote: {},
|
||||
});
|
||||
|
||||
await noteMemorySearchHealth(cfg, {
|
||||
gatewayMemoryProbe: { checked: true, ready: false, error: "connection refused" },
|
||||
});
|
||||
|
||||
const message = String(note.mock.calls[0]?.[0] ?? "");
|
||||
expect(message).toContain('provider "ollama" is configured');
|
||||
expect(message).toContain("embeddings are not ready");
|
||||
});
|
||||
|
||||
it("warns when lmstudio gateway probe reports embeddings are not ready", async () => {
|
||||
resolveMemorySearchConfig.mockReturnValue({
|
||||
provider: "lmstudio",
|
||||
|
||||
@@ -128,6 +128,10 @@ function resolveSuggestedRemoteMemoryProvider(): string | undefined {
|
||||
)?.providerId;
|
||||
}
|
||||
|
||||
function isKeyOptionalMemoryProvider(providerId: string): boolean {
|
||||
return providerId === "local" || providerId === "ollama" || providerId === "lmstudio";
|
||||
}
|
||||
|
||||
async function resolveRuntimeMemoryAuditContext(
|
||||
cfg: OpenClawConfig,
|
||||
): Promise<RuntimeMemoryAuditContext | null> {
|
||||
@@ -402,7 +406,7 @@ export async function noteMemorySearchHealth(
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (resolved.provider === "lmstudio") {
|
||||
if (isKeyOptionalMemoryProvider(resolved.provider)) {
|
||||
if (opts?.gatewayMemoryProbe?.checked && opts.gatewayMemoryProbe.ready) {
|
||||
return;
|
||||
}
|
||||
@@ -410,8 +414,8 @@ export async function noteMemorySearchHealth(
|
||||
note(
|
||||
[
|
||||
gatewayProbeWarning
|
||||
? 'Memory search provider "lmstudio" is configured, but the gateway reports embeddings are not ready.'
|
||||
: 'Memory search provider "lmstudio" is configured, but the gateway could not confirm embeddings are ready.',
|
||||
? `Memory search provider "${resolved.provider}" is configured, but the gateway reports embeddings are not ready.`
|
||||
: `Memory search provider "${resolved.provider}" is configured, but the gateway could not confirm embeddings are ready.`,
|
||||
gatewayProbeWarning,
|
||||
`Verify: ${formatCliCommand("openclaw memory status --deep")}`,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user