feat: enforce strict AI env validation and force close

This commit is contained in:
MythEclipse
2026-05-26 00:59:32 +07:00
parent 7126959548
commit c1c149855a
2 changed files with 15 additions and 0 deletions
+10
View File
@@ -44,6 +44,16 @@ export default async function processAnalysisRequest({
conversationKey,
messages,
}: AnalysisWorkerRequest): Promise<AnalysisWorkerResponse> {
if (!config.AI_LLM_API_KEY) {
console.error(JSON.stringify({
level: "FATAL",
context: "aiAnalysisWorker",
error: "AI_LLM_API_KEY is missing from environment. Force closing worker operation.",
timestamp: new Date().toISOString(),
}));
process.exit(1);
}
try {
try {
await ensureDb();