feat: detect reply/forward/crosspost in message capture + inject into AI moderation
- Add is_reply, is_forward, is_crosspost, reference_message_id, reference_channel_id, reference_guild_id columns to messages table - Update MessageRecord type with reference fields - Extract reply/forward/crosspost from Discord message type/flags - Track reference.type (DEFAULT=reply, FORWARD) and CROSSPOSTED flag - Inject <reference> XML with parent content into LLM moderation prompt - Add reply/forward/crosspost rules to moderation prompt rules - Format context messages with [reply_to], [forward_from], [crosspost] - Add migration 0009 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
bigint as pgBigint,
|
||||
boolean as pgBoolean,
|
||||
foreignKey as pgForeignKey,
|
||||
index as pgIndex,
|
||||
integer as pgInteger,
|
||||
@@ -30,6 +31,12 @@ export const pgMessagesTable = pgTable(
|
||||
type: pgText("type", { enum: ["text", "edited", "deleted"] })
|
||||
.notNull()
|
||||
.default("text"),
|
||||
is_reply: pgBoolean("is_reply"),
|
||||
is_forward: pgBoolean("is_forward"),
|
||||
is_crosspost: pgBoolean("is_crosspost"),
|
||||
reference_message_id: pgText("reference_message_id"),
|
||||
reference_channel_id: pgText("reference_channel_id"),
|
||||
reference_guild_id: pgText("reference_guild_id"),
|
||||
metadata: pgText("metadata"),
|
||||
ai_status: pgText("ai_status", {
|
||||
enum: ["pending", "processing", "clean", "warn", "flagged", "error"],
|
||||
|
||||
@@ -64,6 +64,12 @@ export interface MessageRecord {
|
||||
edited_at: number | null;
|
||||
deleted_at: number | null;
|
||||
type: "text" | "edited" | "deleted";
|
||||
is_reply: boolean | null;
|
||||
is_forward: boolean | null;
|
||||
is_crosspost: boolean | null;
|
||||
reference_message_id: string | null;
|
||||
reference_channel_id: string | null;
|
||||
reference_guild_id: string | null;
|
||||
metadata: string | null;
|
||||
ai_status?: AIStatus | null;
|
||||
ai_moderation_flags?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user