fix(ai-moderation): use cached status instead of hardcoding "clean" for cache hit results

This commit is contained in:
MythEclipse
2026-06-04 17:30:37 +07:00
parent 9474d30cb7
commit b3d42118bd
2 changed files with 3 additions and 1 deletions
@@ -1687,7 +1687,7 @@ export async function runModerationAnalysis(
if (cached) {
cacheHits.push({
messageId: target.id,
status: "clean",
status: cached.status,
flags: cached.flags,
score: cached.score,
analysis: cached.analysis,
@@ -1776,6 +1776,7 @@ export async function runModerationAnalysis(
severity: result.severity ?? "none",
confidence: result.confidence ?? result.score ?? 0,
recommendedAction: result.recommendedAction ?? "none",
status: result.status === "error" ? "flagged" : result.status,
}).catch(() => {});
}
@@ -332,6 +332,7 @@ export async function setCachedUserModeration(
severity: string;
confidence: number;
recommendedAction: string;
status?: "clean" | "warn" | "flagged";
},
): Promise<void> {
const now = Date.now();