From e8a6cb4f89935692585240839d54306204c4fab9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 09:33:31 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9A=90=E8=97=8F=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E7=9A=84=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E5=90=8D=20+=20=E6=B8=85=E7=90=86=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E4=BC=98=E9=9B=85=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/576c1b97-3ce4-4c28-99f1-9374e2320212 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- server/app/modules/domestic-llm-gateway.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/app/modules/domestic-llm-gateway.js b/server/app/modules/domestic-llm-gateway.js index 3a93dc6d..e329f727 100644 --- a/server/app/modules/domestic-llm-gateway.js +++ b/server/app/modules/domestic-llm-gateway.js @@ -147,7 +147,7 @@ function callDomesticLLM(modelConfig, messages) { return new Promise((resolve, reject) => { const apiKey = process.env[modelConfig.envKey] || ''; if (!apiKey) { - return reject(new Error(`API密钥未配置: ${modelConfig.envKey}`)); + return reject(new Error('模型API密钥未配置')); } const url = new URL(modelConfig.endpoint); @@ -250,7 +250,7 @@ function getContext(userId) { } // 定期清理过期会话 -setInterval(() => { +const _cleanupTimer = setInterval(() => { const now = Date.now(); for (const [key, val] of contexts) { if (now - val.lastActive > CONTEXT_TTL_MS) { @@ -258,6 +258,8 @@ setInterval(() => { } } }, 300000); // 每5分钟清理一次 +// 允许进程优雅退出 +if (_cleanupTimer.unref) _cleanupTimer.unref(); /** * 国内模型智能对话(带自动降级)