fix(discord-gateway): require LLM API key only when AI analysis is enabled

This commit is contained in:
MythEclipse
2026-06-02 21:46:15 +07:00
parent 831bb692d9
commit 1e1fbb4583
2 changed files with 4 additions and 4 deletions
@@ -158,9 +158,9 @@ let lastError: string | null = null;
let moderationClient: Client | undefined; let moderationClient: Client | undefined;
// Batch circuit breaker // Batch circuit breaker
let consecutiveErrors = 0; const conversationConsecutiveErrors = new Map<string, number>();
const MAX_CONSECUTIVE_ERRORS = 5; const MAX_CONSECUTIVE_ERRORS = 5;
let globalCooldownUntil = 0; const CONVERSATION_CB_COOLDOWN_MS = 60000;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Individual fallback queue — runs PARALLEL to the batch pipeline. // Individual fallback queue — runs PARALLEL to the batch pipeline.
@@ -116,12 +116,12 @@ const configSchema = z
.number() .number()
.positive() .positive()
.default(120000), .default(120000),
/** Max concurrent individual-fallback LLM calls (effectively unlimited). */ /** Max concurrent individual-fallback jobs admitted by the main event loop. */
AI_ANALYSIS_INDIVIDUAL_MAX_CONCURRENT: z.coerce AI_ANALYSIS_INDIVIDUAL_MAX_CONCURRENT: z.coerce
.number() .number()
.int() .int()
.positive() .positive()
.default(1000), .default(50),
/** /**
* How many consecutive individual-fallback errors trigger the individual * How many consecutive individual-fallback errors trigger the individual
* circuit breaker (separate from the batch circuit breaker). * circuit breaker (separate from the batch circuit breaker).