@z_ai/mcp-server 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,13 +44,15 @@ export class ChatService {
|
|
|
44
44
|
async chatCompletions(url, body) {
|
|
45
45
|
const apiConfig = configurationService.getVisionConfig();
|
|
46
46
|
const apiKey = this.environmentService.getApiKey();
|
|
47
|
+
// Keys like ANTHROPIC_AUTH_TOKEN may already carry the "Bearer" prefix — don't double it
|
|
48
|
+
const authorization = /^bearer\s/i.test(apiKey) ? apiKey : `Bearer ${apiKey}`;
|
|
47
49
|
const controller = new AbortController();
|
|
48
50
|
const timeoutId = setTimeout(() => controller.abort(), apiConfig.timeout);
|
|
49
51
|
try {
|
|
50
52
|
const response = await fetch(url, {
|
|
51
53
|
method: 'POST',
|
|
52
54
|
headers: {
|
|
53
|
-
'Authorization':
|
|
55
|
+
'Authorization': authorization,
|
|
54
56
|
'Content-Type': 'application/json',
|
|
55
57
|
'X-Title': '4.5V MCP Local',
|
|
56
58
|
'Accept-Language': 'en-US,en'
|
|
@@ -106,7 +106,7 @@ export class EnvironmentService {
|
|
|
106
106
|
const config = this.getConfig();
|
|
107
107
|
return {
|
|
108
108
|
model: config.Z_AI_VISION_MODEL || 'glm-5.3-flash',
|
|
109
|
-
timeout: parseInt(config.Z_AI_TIMEOUT || '
|
|
109
|
+
timeout: parseInt(config.Z_AI_TIMEOUT || '600000'),
|
|
110
110
|
retryCount: parseInt(config.Z_AI_RETRY_COUNT || '1'),
|
|
111
111
|
url: config.Z_AI_BASE_URL + 'chat/completions',
|
|
112
112
|
temperature: parseFloat(config.Z_AI_VISION_MODEL_TEMPERATURE || '0.8'),
|