feat(gateway): capture NSFW/age-restricted messages but skip AI analysis + exclude from public archive
Previously isAgeRestrictedMessage() early-returned in messageCreate/messageUpdate, so NSFW-channel messages were never stored at all. Now they are captured like any message (visible in dashboard), while the existing age-restricted skip path (queueMessageAnalysis -> buildAgeRestrictedSkipResult) marks them clean with flag age_restricted WITHOUT calling the LLM. NSFW content is also deliberately kept OUT of the Qdrant public semantic-search archive (archiveMessageEmbedded skips when isAgeRestricted), so it can't be found via public web search. No schema change needed (metadata already carries channel.nsfw).
This commit is contained in:
1 parent
7dfb4035b7
commit
50967f6481
3 files changed
+65
-3
No files matched your search
@@ -16,6 +16,10 @@ export interface ArchiveMessage {
|
||||
channel_id: string;
|
||||
guild_id: string;
|
||||
created_at: number;
|
||||
/** True when the message came from an age-restricted (NSFW) channel. NSFW
|
||||
* content is deliberately NOT embedded into the public archive so it can't
|
||||
* be found via public semantic search. Defaults to false. */
|
||||
isAgeRestricted?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,8 +29,12 @@ export interface ArchiveMessage {
|
||||
* Failures are swallowed — searching is a nice-to-have, never a precondition
|
||||
* for capture or moderation. The message text is kept in the payload so the
|
||||
* search endpoint can return results even for deleted messages.
|
||||
*
|
||||
* NSFW/age-restricted messages are skipped (never embedded) — they are stored
|
||||
* in the database for the dashboard but kept out of the public search archive.
|
||||
*/
|
||||
export function archiveMessageEmbedded(message: ArchiveMessage): void {
|
||||
if (message.isAgeRestricted) return; // never surface NSFW in public archive
|
||||
if (!config.AI_LLM_EMBEDDING_MODEL) return; // embeddings disabled → skip
|
||||
const text = message.content?.trim();
|
||||
if (!text || text.length < 3) return;
|
||||
|
||||
Reference in new issue
Block a user