mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 18:18:43 +00:00
fix(glmt): respect user-configured model instead of hardcoding glm-4.6
Root cause: execClaudeWithProxy() was ignoring ANTHROPIC_MODEL from user settings and always using hardcoded 'glm-4.6'. Changes: - Read model from user's settings file in GLMT proxy flow - Update default model to glm-4.7 in base configs (matches presets) - Update fallback models in transformer/response-builder Closes #358 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,9 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||||
"ANTHROPIC_MODEL": "glm-4.6",
|
"ANTHROPIC_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6",
|
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
|
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.6"
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/coding/paas/v4/chat/completions",
|
||||||
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
"ANTHROPIC_AUTH_TOKEN": "YOUR_GLM_API_KEY_HERE",
|
||||||
"ANTHROPIC_MODEL": "glm-4.6",
|
"ANTHROPIC_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6",
|
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
|
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.6",
|
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7",
|
||||||
"ANTHROPIC_TEMPERATURE": "0.2",
|
"ANTHROPIC_TEMPERATURE": "0.2",
|
||||||
"ANTHROPIC_MAX_TOKENS": "65536",
|
"ANTHROPIC_MAX_TOKENS": "65536",
|
||||||
"MAX_THINKING_TOKENS": "32768",
|
"MAX_THINKING_TOKENS": "32768",
|
||||||
|
|||||||
+3
-1
@@ -153,10 +153,12 @@ async function execClaudeWithProxy(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. Spawn Claude CLI with proxy URL
|
// 4. Spawn Claude CLI with proxy URL
|
||||||
|
// Use model from user's settings (not hardcoded) - fixes issue #358
|
||||||
|
const configuredModel = envData['ANTHROPIC_MODEL'] || 'glm-4.7';
|
||||||
const envVars: NodeJS.ProcessEnv = {
|
const envVars: NodeJS.ProcessEnv = {
|
||||||
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
ANTHROPIC_BASE_URL: `http://127.0.0.1:${port}`,
|
||||||
ANTHROPIC_AUTH_TOKEN: apiKey,
|
ANTHROPIC_AUTH_TOKEN: apiKey,
|
||||||
ANTHROPIC_MODEL: 'glm-4.6',
|
ANTHROPIC_MODEL: configuredModel,
|
||||||
};
|
};
|
||||||
|
|
||||||
const isWindows = process.platform === 'win32';
|
const isWindows = process.platform === 'win32';
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export class GlmtTransformer {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content,
|
content,
|
||||||
model: openaiResponse.model || 'glm-4.6',
|
model: openaiResponse.model || 'glm-4.7',
|
||||||
stop_reason: this.responseBuilder.mapStopReason(choice.finish_reason || 'stop'),
|
stop_reason: this.responseBuilder.mapStopReason(choice.finish_reason || 'stop'),
|
||||||
usage: {
|
usage: {
|
||||||
input_tokens: openaiResponse.usage?.prompt_tokens || 0,
|
input_tokens: openaiResponse.usage?.prompt_tokens || 0,
|
||||||
@@ -131,7 +131,7 @@ export class GlmtTransformer {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: [{ type: 'text', text: '[Transformation Error] ' + err.message }],
|
content: [{ type: 'text', text: '[Transformation Error] ' + err.message }],
|
||||||
model: 'glm-4.6',
|
model: 'glm-4.7',
|
||||||
stop_reason: 'end_turn',
|
stop_reason: 'end_turn',
|
||||||
usage: { input_tokens: 0, output_tokens: 0 },
|
usage: { input_tokens: 0, output_tokens: 0 },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class ResponseBuilder {
|
|||||||
type: 'message',
|
type: 'message',
|
||||||
role: accumulator.getRole(),
|
role: accumulator.getRole(),
|
||||||
content: [],
|
content: [],
|
||||||
model: accumulator.getModel() || 'glm-4.6',
|
model: accumulator.getModel() || 'glm-4.7',
|
||||||
stop_reason: null,
|
stop_reason: null,
|
||||||
usage: {
|
usage: {
|
||||||
input_tokens: accumulator.getInputTokens(),
|
input_tokens: accumulator.getInputTokens(),
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ module.exports = {
|
|||||||
env: {
|
env: {
|
||||||
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
ANTHROPIC_BASE_URL: "https://api.z.ai/api/anthropic",
|
||||||
ANTHROPIC_AUTH_TOKEN: "your_api_key_here",
|
ANTHROPIC_AUTH_TOKEN: "your_api_key_here",
|
||||||
ANTHROPIC_MODEL: "glm-4.6",
|
ANTHROPIC_MODEL: "glm-4.7",
|
||||||
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-4.6",
|
ANTHROPIC_DEFAULT_OPUS_MODEL: "glm-4.7",
|
||||||
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.6",
|
ANTHROPIC_DEFAULT_SONNET_MODEL: "glm-4.7",
|
||||||
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.6"
|
ANTHROPIC_DEFAULT_HAIKU_MODEL: "glm-4.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user