From 96cd0cfc627228d900922196b34a10e32f17454a Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Sun, 31 May 2026 22:05:50 +0700 Subject: [PATCH] refactor(moderation): clean up code formatting for improved readability --- src/moderation/llmModerationClient.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/moderation/llmModerationClient.ts b/src/moderation/llmModerationClient.ts index 5037c47..61ff64d 100644 --- a/src/moderation/llmModerationClient.ts +++ b/src/moderation/llmModerationClient.ts @@ -481,8 +481,7 @@ function hasMediaContent( ): boolean { if (target.metadata) { const evidence = extractMessageMediaEvidence(target.metadata); - if (evidence.stickers.length > 0 || evidence.embeds.length > 0) - return true; + if (evidence.stickers.length > 0 || evidence.embeds.length > 0) return true; } if (attachments?.some((a) => a.message_id === target.id)) return true; return false; @@ -832,7 +831,8 @@ async function runTextOnlyBatch( const correction = lastParseError ? { error: lastParseError, - preview: (lastInvalidContent as string | null)?.slice(0, 800) ?? "", + preview: + (lastInvalidContent as string | null)?.slice(0, 800) ?? "", } : undefined; @@ -1061,10 +1061,7 @@ async function runSingleMediaAnalysis( ), ]; - const remainingSlots = Math.max( - 0, - 8 - (imageMap.get(targetId)?.length ?? 0), - ); + const remainingSlots = Math.max(0, 8 - (imageMap.get(targetId)?.length ?? 0)); await Promise.all( mediaCandidates.slice(0, remainingSlots).map(async (candidate) => { @@ -1146,13 +1143,11 @@ async function runSingleMediaAnalysis( ); // ── 5. Build single-message prompt ── - const textEvidence = - await formatModerationTextEvidenceForPrompt(content); + const textEvidence = await formatModerationTextEvidenceForPrompt(content); const webTexts = webTextMap.get(targetId) ?? []; const mediaAnalyses = mediaAnalysisMap.get(targetId) ?? []; - const webContext = - webTexts.length > 0 ? `\n${webTexts.join("\n")}` : ""; + const webContext = webTexts.length > 0 ? `\n${webTexts.join("\n")}` : ""; const textContext = textEvidence ? `\n${textEvidence}` : ""; const mediaAnalysisContext = mediaAnalyses.length > 0 ? `\n${mediaAnalyses.join("\n")}` : "";