Improve content extraction in auto-capture logic - #1
Conversation
OpenClaw sometimes sends content as an array of blocks (e.g. `[{ type: "text", text: "..." }]`), so `.trim()` fails.
Local Testing Report & Additional FixThanks for this PR @abelkuruvilla — the We deployed this plugin against a self-hosted Mem0 v2 instance (with Qwen3.5-4B LLM + Qwen3-Embedding-4B) and found two issues that need fixing for auto-capture to work end-to-end: 1. Content extraction (this PR — confirmed with improvement suggestion)The function extractText(content: any): string {
if (typeof content === "string") return content;
if (Array.isArray(content)) {
return content
.filter((block: any) => block.type === "text")
.map((block: any) => block.text || "")
.join("\n");
}
return "";
}This helper should also be applied to the 2. API format mismatch in
|
OpenClaw sometimes sends content as an array of blocks (e.g.
[{ type: "text", text: "..." }]), so.trim()fails.