From e37fbd129aa30f96e30d44a402433e6c4d0cb269 Mon Sep 17 00:00:00 2001 From: hailin Date: Tue, 20 May 2025 22:34:12 +0800 Subject: [PATCH] . --- chatdesk-ui/lib/ipconfig.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chatdesk-ui/lib/ipconfig.ts b/chatdesk-ui/lib/ipconfig.ts index 094bfc7..d9f6350 100644 --- a/chatdesk-ui/lib/ipconfig.ts +++ b/chatdesk-ui/lib/ipconfig.ts @@ -10,12 +10,12 @@ let _env: Record | null = null export function getRuntimeEnv(key: string): string | undefined { - if (_env) return _env[key] - + // 强制每次从 window.RUNTIME_ENV 获取,而不依赖缓存 if (typeof window !== "undefined" && typeof window.RUNTIME_ENV !== "undefined") { - _env = window.RUNTIME_ENV + _env = window.RUNTIME_ENV // 更新 _env,确保使用最新的环境变量 return _env[key] } + // 如果没有 window.RUNTIME_ENV,回退到 process.env return process.env[key] -} \ No newline at end of file +}