mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 18:01:23 +00:00
Gateway: eager-init QMD backend on startup
This commit is contained in:
committed by
Vignesh
parent
ef4a0e92b7
commit
efc79f69a2
24
src/gateway/server-startup-memory.ts
Normal file
24
src/gateway/server-startup-memory.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { resolveDefaultAgentId } from "../agents/agent-scope.js";
|
||||
import { resolveMemoryBackendConfig } from "../memory/backend-config.js";
|
||||
import { getMemorySearchManager } from "../memory/index.js";
|
||||
|
||||
export async function startGatewayMemoryBackend(params: {
|
||||
cfg: OpenClawConfig;
|
||||
log: { info?: (msg: string) => void; warn: (msg: string) => void };
|
||||
}): Promise<void> {
|
||||
const agentId = resolveDefaultAgentId(params.cfg);
|
||||
const resolved = resolveMemoryBackendConfig({ cfg: params.cfg, agentId });
|
||||
if (resolved.backend !== "qmd" || !resolved.qmd) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { manager, error } = await getMemorySearchManager({ cfg: params.cfg, agentId });
|
||||
if (!manager) {
|
||||
params.log.warn(
|
||||
`qmd memory startup initialization failed for agent "${agentId}": ${error ?? "unknown error"}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
params.log.info?.(`qmd memory startup initialization armed for agent "${agentId}"`);
|
||||
}
|
||||
Reference in New Issue
Block a user