mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 16:24:58 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -11,12 +11,20 @@ export function isEmptyAssistantMessageContent(
|
||||
message: Extract<AgentMessage, { role: "assistant" }>,
|
||||
): boolean {
|
||||
const content = message.content;
|
||||
if (content == null) return true;
|
||||
if (!Array.isArray(content)) return false;
|
||||
if (content == null) {
|
||||
return true;
|
||||
}
|
||||
if (!Array.isArray(content)) {
|
||||
return false;
|
||||
}
|
||||
return content.every((block) => {
|
||||
if (!block || typeof block !== "object") return true;
|
||||
if (!block || typeof block !== "object") {
|
||||
return true;
|
||||
}
|
||||
const rec = block as { type?: unknown; text?: unknown };
|
||||
if (rec.type !== "text") return false;
|
||||
if (rec.type !== "text") {
|
||||
return false;
|
||||
}
|
||||
return typeof rec.text !== "string" || rec.text.trim().length === 0;
|
||||
});
|
||||
}
|
||||
@@ -110,9 +118,13 @@ export async function sanitizeSessionMessagesImages(
|
||||
: stripThoughtSignatures(content, options?.sanitizeThoughtSignatures); // Strip for Gemini
|
||||
|
||||
const filteredContent = strippedContent.filter((block) => {
|
||||
if (!block || typeof block !== "object") return true;
|
||||
if (!block || typeof block !== "object") {
|
||||
return true;
|
||||
}
|
||||
const rec = block as { type?: unknown; text?: unknown };
|
||||
if (rec.type !== "text" || typeof rec.text !== "string") return true;
|
||||
if (rec.type !== "text" || typeof rec.text !== "string") {
|
||||
return true;
|
||||
}
|
||||
return rec.text.trim().length > 0;
|
||||
});
|
||||
const finalContent = (await sanitizeContentBlocksImages(
|
||||
|
||||
Reference in New Issue
Block a user