feat(config): add AI analysis tuning parameters and update related logic

This commit is contained in:
MythEclipse
2026-05-21 01:55:50 +07:00
parent 5fb7b2ce24
commit 3d64228d6a
19 changed files with 644 additions and 293 deletions
+3 -4
View File
@@ -1,4 +1,5 @@
import { parentPort } from "node:worker_threads";
import { config } from "../config.ts";
import { initializeDatabase } from "../database/drizzle.ts";
import { buildConversationPromptMessages } from "./conversationContext.ts";
import { runModerationAnalysis } from "./llmModerationClient.ts";
@@ -9,8 +10,6 @@ import {
} from "./messageStore.ts";
import type { MessageRecord } from "./types";
const MAX_CONTEXT_TOKENS = 8000;
let dbInitialized = false;
interface AnalysisWorkerRequest {
@@ -58,13 +57,13 @@ async function processAnalysisRequest({
channelId: firstMessage.channel_id,
threadId: firstMessage.thread_id,
beforeCreatedAt: firstMessage.created_at,
limit: 20,
limit: config.AI_ANALYSIS_CONTEXT_MESSAGE_LIMIT,
});
const promptMessages = buildConversationPromptMessages({
contextBefore,
targets: messages,
maxTokens: MAX_CONTEXT_TOKENS,
maxTokens: config.AI_ANALYSIS_MAX_CONTEXT_TOKENS,
});
const targetIds = messages.map((m) => m.id);