diff options
| author | Fuwn <[email protected]> | 2025-09-25 16:04:16 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-25 16:04:16 -0700 |
| commit | c213fff8a3f3e6bbb85cfe55385c38cf15074ba1 (patch) | |
| tree | f1abf1f28698fcfff48e57f80047f35671f09e26 /packages/gateway | |
| parent | fix(gateway:aiModeration): Improve adult content analysis in NSFW channels (diff) | |
| download | umabotdiscord-c213fff8a3f3e6bbb85cfe55385c38cf15074ba1.tar.xz umabotdiscord-c213fff8a3f3e6bbb85cfe55385c38cf15074ba1.zip | |
fix(gateway:aiModeration): Improve analysis context
Diffstat (limited to 'packages/gateway')
| -rw-r--r-- | packages/gateway/src/listeners/aiModeration.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/gateway/src/listeners/aiModeration.ts b/packages/gateway/src/listeners/aiModeration.ts index 475140a..2714966 100644 --- a/packages/gateway/src/listeners/aiModeration.ts +++ b/packages/gateway/src/listeners/aiModeration.ts @@ -99,14 +99,14 @@ You are an AI moderator for a Discord server. Analyze the following message for SERVER RULES: ${SERVER_RULES} -CURRENT MESSAGE TO ANALYZE: +CURRENT MESSAGE TO ANALYZE (THIS IS THE ONLY MESSAGE YOU SHOULD CHECK FOR VIOLATIONS): Author: ${message.author.username} (${message.author.id}) Channel: ${"name" in message.channel ? message.channel.name : "Unknown"} (${message.channelId}) -Channel is NSFW: ${'nsfw' in message.channel ? message.channel.nsfw : false} -Content: ${message.content || "[No text content]"} +Channel is NSFW: ${"nsfw" in message.channel ? message.channel.nsfw : false} +Content: "${message.content || "[No text content]"}" Attachments: ${message.attachments.size > 0 ? message.attachments.map((a) => a.name).join(", ") : "None"} -MESSAGE CONTEXT (recent messages in this channel): +CHAT HISTORY (FOR CONTEXT ONLY - DO NOT FLAG MESSAGES BASED ON THIS): ${context} Please analyze THIS SPECIFIC MESSAGE for any rule violations. Consider: @@ -139,6 +139,8 @@ Respond with a JSON object containing: } If no violation is found, set "violation" to false and provide a brief explanation of why the message is acceptable. + +CRITICAL: Only analyze the content in quotes above (the current message). Ignore all content in the chat history section. If the current message is innocent (like "true", "yes", "no", etc.) but appears after inappropriate content in the chat history, do NOT flag it. `; const response = await fetch("https://api.openai.com/v1/chat/completions", { method: "POST", |