fix: exclude proxy environment variables from login shell environment

This commit is contained in:
Vaayne 2025-09-29 11:05:05 +08:00
parent 1616345261
commit 90242e2285

View File

@ -78,8 +78,12 @@ class ClaudeCodeService implements AgentServiceInterface {
const apiConfig = await apiConfigService.get()
const loginShellEnv = await getLoginShellEnvironment()
const loginShellEnvWithoutProxies = Object.fromEntries(
Object.entries(loginShellEnv).filter(([key]) => !key.toLowerCase().endsWith('_proxy'))
) as Record<string, string>
const env = {
...loginShellEnv,
...loginShellEnvWithoutProxies,
ANTHROPIC_API_KEY: apiConfig.apiKey,
ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
ELECTRON_RUN_AS_NODE: '1',