mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 03:20:49 +00:00
17 lines
435 B
TypeScript
17 lines
435 B
TypeScript
export function collectTextContentBlocks(content: unknown): string[] {
|
|
if (!Array.isArray(content)) {
|
|
return [];
|
|
}
|
|
const parts: string[] = [];
|
|
for (const block of content) {
|
|
if (!block || typeof block !== "object") {
|
|
continue;
|
|
}
|
|
const rec = block as { type?: unknown; text?: unknown };
|
|
if (rec.type === "text" && typeof rec.text === "string") {
|
|
parts.push(rec.text);
|
|
}
|
|
}
|
|
return parts;
|
|
}
|