fix(ClaudeCodeService): update environment variables to use modelInfo provider details

This commit is contained in:
Vaayne 2025-09-30 23:53:10 +08:00
parent 538291c03f
commit 53046460ec
2 changed files with 36 additions and 5 deletions

View File

@ -84,9 +84,13 @@ class ClaudeCodeService implements AgentServiceInterface {
const env = {
...loginShellEnvWithoutProxies,
ANTHROPIC_API_KEY: apiConfig.apiKey,
ANTHROPIC_AUTH_TOKEN: apiConfig.apiKey,
ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
// TODO: fix the proxy api server
// ANTHROPIC_API_KEY: apiConfig.apiKey,
// ANTHROPIC_AUTH_TOKEN: apiConfig.apiKey,
// ANTHROPIC_BASE_URL: `http://${apiConfig.host}:${apiConfig.port}/${modelInfo.provider.id}`,
ANTHROPIC_API_KEY: modelInfo.provider.apiKey,
ANTHROPIC_AUTH_TOKEN: modelInfo.provider.apiKey,
ANTHROPIC_BASE_URL: modelInfo.provider.anthropicApiHost?.trim() || modelInfo.provider.apiHost,
ANTHROPIC_MODEL: modelInfo.modelId,
ANTHROPIC_SMALL_FAST_MODEL: modelInfo.modelId,
ELECTRON_RUN_AS_NODE: '1',

View File

@ -397,7 +397,7 @@ __metadata:
languageName: node
linkType: hard
"@anthropic-ai/claude-agent-sdk@npm:^0.1.1":
"@anthropic-ai/claude-agent-sdk@npm:0.1.1":
version: 0.1.1
resolution: "@anthropic-ai/claude-agent-sdk@npm:0.1.1"
dependencies:
@ -424,6 +424,33 @@ __metadata:
languageName: node
linkType: hard
"@anthropic-ai/claude-agent-sdk@patch:@anthropic-ai/claude-agent-sdk@npm%3A0.1.1#~/.yarn/patches/@anthropic-ai-claude-agent-sdk-npm-0.1.1-d937b73fed.patch":
version: 0.1.1
resolution: "@anthropic-ai/claude-agent-sdk@patch:@anthropic-ai/claude-agent-sdk@npm%3A0.1.1#~/.yarn/patches/@anthropic-ai-claude-agent-sdk-npm-0.1.1-d937b73fed.patch::version=0.1.1&hash=f97b6e"
dependencies:
"@img/sharp-darwin-arm64": "npm:^0.33.5"
"@img/sharp-darwin-x64": "npm:^0.33.5"
"@img/sharp-linux-arm": "npm:^0.33.5"
"@img/sharp-linux-arm64": "npm:^0.33.5"
"@img/sharp-linux-x64": "npm:^0.33.5"
"@img/sharp-win32-x64": "npm:^0.33.5"
dependenciesMeta:
"@img/sharp-darwin-arm64":
optional: true
"@img/sharp-darwin-x64":
optional: true
"@img/sharp-linux-arm":
optional: true
"@img/sharp-linux-arm64":
optional: true
"@img/sharp-linux-x64":
optional: true
"@img/sharp-win32-x64":
optional: true
checksum: 10c0/4312b2cb008a332f52d63b1b005d16482c9cbdb3377729422287506c12e9003e0b376e8b8ef3d127908238c36f799608eda85d9b760a96cd836b3a5f7752104f
languageName: node
linkType: hard
"@anthropic-ai/sdk@npm:>=0.50.3 <1":
version: 0.56.0
resolution: "@anthropic-ai/sdk@npm:0.56.0"
@ -14171,7 +14198,7 @@ __metadata:
"@ai-sdk/mistral": "npm:^2.0.14"
"@ai-sdk/perplexity": "npm:^2.0.9"
"@ant-design/v5-patch-for-react-19": "npm:^1.0.3"
"@anthropic-ai/claude-agent-sdk": "npm:^0.1.1"
"@anthropic-ai/claude-agent-sdk": "patch:@anthropic-ai/claude-agent-sdk@npm%3A0.1.1#~/.yarn/patches/@anthropic-ai-claude-agent-sdk-npm-0.1.1-d937b73fed.patch"
"@anthropic-ai/sdk": "npm:^0.41.0"
"@anthropic-ai/vertex-sdk": "patch:@anthropic-ai/vertex-sdk@npm%3A0.11.4#~/.yarn/patches/@anthropic-ai-vertex-sdk-npm-0.11.4-c19cb41edb.patch"
"@aws-sdk/client-bedrock": "npm:^3.840.0"