From 0cd4f197e90a1144e6699230e7f5bdadfbcf7805 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Tue, 2 Jun 2026 23:05:06 +0700 Subject: [PATCH] =?UTF-8?q?No=20staged=20changes=20found=20=E2=80=94=20the?= =?UTF-8?q?=20staging=20area=20is=20empty.=20Stage=20some=20files=20first?= =?UTF-8?q?=20with=20`git=20add`,=20then=20I=20can=20help=20craft=20the=20?= =?UTF-8?q?commit=20message.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/shared/database/schema.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/services/discord-gateway/src/shared/database/schema.ts b/services/discord-gateway/src/shared/database/schema.ts index 970580f..8899ceb 100644 --- a/services/discord-gateway/src/shared/database/schema.ts +++ b/services/discord-gateway/src/shared/database/schema.ts @@ -417,6 +417,38 @@ export const pgStickerCacheTable = pgTable( }), ); +/** + * Corrected Moderations Table (PostgreSQL) + * Stores manually corrected false positives from AI moderation. + * Used for dynamic few-shot injection in moderation prompts. + */ +export const pgCorrectedModerationsTable = pgTable( + "corrected_moderations", + { + id: pgText("id").primaryKey(), + /** The message_id that was originally flagged. */ + message_id: pgText("message_id").notNull(), + /** JSON array of original flags assigned by the LLM. */ + original_flags: pgText("original_flags").notNull(), + /** JSON array of corrected flags (may be empty [] for clean). */ + corrected_flags: pgText("corrected_flags").notNull(), + /** Human-readable explanation of why the correction was made. */ + correction_notes: pgText("correction_notes"), + /** Content snippet so the LLM can recognise similar patterns. */ + content_snippet: pgText("content_snippet").notNull(), + /** When this correction was recorded. */ + created_at: pgBigint("created_at", { mode: "number" }).notNull(), + }, + (table) => ({ + createdAtIdx: pgIndex("idx_corrected_moderations_created_at").on( + table.created_at, + ), + messageIdIdx: pgIndex("idx_corrected_moderations_message_id").on( + table.message_id, + ), + }), +); + // Runtime table exports // =====================