test: simplify manual compaction text extraction · openclaw/openclaw@47099da
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
File tree
src/agents/pi-embedded-runner
| Original file line number | Diff line number | Diff line change |
|---|
@@ -58,14 +58,13 @@ function messageText(message: AgentMessage): string {
|
58 | 58 | if (!Array.isArray(content)) { |
59 | 59 | return ""; |
60 | 60 | } |
61 | | -return content |
62 | | -.map((block) => |
63 | | -block && typeof block === "object" && "text" in block && typeof block.text === "string" |
64 | | - ? block.text |
65 | | - : "", |
66 | | -) |
67 | | -.filter(Boolean) |
68 | | -.join(" "); |
| 61 | +const textBlocks: string[] = []; |
| 62 | +for (const block of content) { |
| 63 | +if (block && typeof block === "object" && "text" in block && typeof block.text === "string") { |
| 64 | +textBlocks.push(block.text); |
| 65 | +} |
| 66 | +} |
| 67 | +return textBlocks.join(" "); |
69 | 68 | } |
70 | 69 | |
71 | 70 | function requireString(value: string | undefined, label: string): string { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。