refactor(agents): remove unused image helper · openclaw/openclaw@3288291
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -60,10 +60,7 @@ export {
|
60 | 60 | downgradeOpenAIReasoningBlocks, |
61 | 61 | normalizeOpenAIResponsesToolCallIds, |
62 | 62 | } from "./embedded-agent-helpers/openai.js"; |
63 | | -export { |
64 | | -isEmptyAssistantMessageContent, |
65 | | -sanitizeSessionMessagesImages, |
66 | | -} from "./embedded-agent-helpers/images.js"; |
| 63 | +export { sanitizeSessionMessagesImages } from "./embedded-agent-helpers/images.js"; |
67 | 64 | export { |
68 | 65 | isMessagingToolDuplicate, |
69 | 66 | isMessagingToolDuplicateNormalized, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -31,29 +31,6 @@ function ensureNonEmptyContent<T>(content: T[]): T[] {
|
31 | 31 | return [{ type: "text", text: EMPTY_CONTENT_PLACEHOLDER }] as T[]; |
32 | 32 | } |
33 | 33 | |
34 | | -/** Return true when an assistant turn contains no usable content blocks. */ |
35 | | -export function isEmptyAssistantMessageContent( |
36 | | -message: Extract<AgentMessage, { role: "assistant" }>, |
37 | | -): boolean { |
38 | | -const content = message.content; |
39 | | -if (content == null) { |
40 | | -return true; |
41 | | -} |
42 | | -if (!Array.isArray(content)) { |
43 | | -return false; |
44 | | -} |
45 | | -return content.every((block) => { |
46 | | -if (!block || typeof block !== "object") { |
47 | | -return true; |
48 | | -} |
49 | | -const rec = block as { type?: unknown; text?: unknown }; |
50 | | -if (rec.type !== "text") { |
51 | | -return false; |
52 | | -} |
53 | | -return typeof rec.text !== "string" || rec.text.trim().length === 0; |
54 | | -}); |
55 | | -} |
56 | | - |
57 | 34 | /** Resize/remove unsafe image payloads while keeping transcript turns valid. */ |
58 | 35 | export async function sanitizeSessionMessagesImages( |
59 | 36 | messages: AgentMessage[], |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。