feat: add multimodal analysis support to LLM moderation client by processing image attachments

This commit is contained in:
MythEclipse
2026-05-17 23:56:04 +07:00
parent 059d569566
commit 51dc1f8869
21 changed files with 443 additions and 83 deletions
+7
View File
@@ -3,6 +3,7 @@ import { initializeDatabase } from "../database/drizzle.ts";
import { buildConversationPromptMessages } from "./conversationContext.ts";
import { runModerationAnalysis } from "./llmModerationClient.ts";
import {
getAttachmentsForMessages,
getConversationContextBefore,
updateMessageAIAnalysis,
} from "./messageStore.ts";
@@ -66,9 +67,15 @@ async function processAnalysisRequest({
maxTokens: MAX_CONTEXT_TOKENS,
});
const targetIds = messages.map((m) => m.id);
const contextIds = contextBefore.map((m) => m.id);
const allMessageIds = [...targetIds, ...contextIds];
const attachments = await getAttachmentsForMessages(allMessageIds);
const result = await runModerationAnalysis({
targets: messages,
contextText: promptMessages.join("\n"),
attachments,
});
const rows: MessageRecord[] = [];