fix: reanalyze edited messages
This commit is contained in:
@@ -28,7 +28,7 @@ export async function runMigrations(): Promise<void> {
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
{ error: error instanceof Error ? error.message : String(error) },
|
||||
"Migration failed"
|
||||
"Migration failed",
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ async function processBatch(
|
||||
|
||||
// Broadcast analyzed messages
|
||||
for (const row of analyzedRows) {
|
||||
(globalThis as any).broadcastMessageAnalyzed?.(row);
|
||||
(globalThis as any).moderationBroadcaster?.messageAnalyzed(row);
|
||||
}
|
||||
|
||||
// Clear error cooldown on success
|
||||
@@ -147,7 +147,7 @@ async function processBatch(
|
||||
error: lastError,
|
||||
});
|
||||
if (row) {
|
||||
(globalThis as any).broadcastMessageAnalyzed?.(row);
|
||||
(globalThis as any).moderationBroadcaster?.messageAnalyzed(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,13 @@ export async function updateMessageAsEdited(
|
||||
edited_content: editedContent,
|
||||
edited_at: editedAt,
|
||||
type: "edited",
|
||||
ai_status: "pending",
|
||||
ai_moderation_flags: null,
|
||||
ai_moderation_score: null,
|
||||
ai_moderation_raw: null,
|
||||
ai_analysis: null,
|
||||
ai_analyzed_at: null,
|
||||
ai_error: null,
|
||||
})
|
||||
.where(eq(messagesTable.id, messageId));
|
||||
|
||||
|
||||
@@ -220,26 +220,6 @@ export async function startWebserver(
|
||||
broadcaster.userState(users);
|
||||
}
|
||||
|
||||
(global as any).broadcastMessageCreated = (data: any) => {
|
||||
broadcaster.messageCreated(data);
|
||||
};
|
||||
|
||||
(global as any).broadcastMessageUpdated = (data: any) => {
|
||||
broadcaster.messageUpdated(data);
|
||||
};
|
||||
|
||||
(global as any).broadcastMessageDeleted = (data: any) => {
|
||||
broadcaster.messageDeleted(data);
|
||||
};
|
||||
|
||||
(global as any).broadcastAttachmentUploaded = (data: any) => {
|
||||
broadcaster.attachmentCreated(data);
|
||||
};
|
||||
|
||||
(global as any).broadcastMessageAnalyzed = (data: any) => {
|
||||
broadcaster.messageAnalyzed(data);
|
||||
};
|
||||
|
||||
// --- Outbound: browser PCM (24kHz mono) → Opus → Discord ---
|
||||
const RATE = 48000;
|
||||
const CHANNELS = 2;
|
||||
|
||||
Reference in New Issue
Block a user