Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 2c5d905

Browse files
committed
feat: add diagnostic logging for GLM model detection
- Add console logging in getGlmModelOptions() to show when a GLM model is detected - Log model ID being used in LM Studio and OpenAI-compatible providers - Log parallel_tool_calls value being applied - Helps users verify GLM detection is working correctly Addresses issue #11071 where users cannot verify if GLM detection is functioning
1 parent 1379ba4 commit 2c5d905

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/api/providers/base-openai-compatible-provider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
7979
// Get model-specific options for GLM models (applies Z.ai optimizations)
8080
// This allows third-party GLM models via OpenAI-compatible endpoints to benefit
8181
// from the same optimizations used by Z.ai
82+
console.log(`[${this.providerName}] Using model ID: "${model}"`)
8283
const glmOptions = getGlmModelOptions(model)
8384

8485
// Centralized cap: clamp to 20% of the context window (unless provider-specific exceptions apply)
@@ -98,6 +99,8 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
9899
? (metadata?.parallelToolCalls ?? false)
99100
: (metadata?.parallelToolCalls ?? true)
100101

102+
console.log(`[${this.providerName}] parallel_tool_calls set to: ${parallelToolCalls}`)
103+
101104
// Convert messages with GLM-specific handling when applicable
102105
// mergeToolResultText prevents GLM models from dropping reasoning_content
103106
const convertedMessages = convertToOpenAiMessages(messages, {

src/api/providers/lm-studio.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
4545
): ApiStream {
4646
// Get model-specific options for GLM models (applies Z.ai optimizations)
4747
const modelId = this.getModel().id
48+
console.log(`[LM Studio] Using model ID: "${modelId}"`)
4849
const glmOptions = getGlmModelOptions(modelId)
4950

5051
// Convert messages with GLM-specific handling when applicable
@@ -96,6 +97,8 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
9697
? (metadata?.parallelToolCalls ?? false)
9798
: (metadata?.parallelToolCalls ?? true)
9899

100+
console.log(`[LM Studio] parallel_tool_calls set to: ${parallelToolCalls}`)
101+
99102
const params: OpenAI.Chat.ChatCompletionCreateParamsStreaming & { draft_model?: string } = {
100103
model: modelId,
101104
messages: openAiMessages,

src/api/providers/utils/model-detection.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export interface GlmModelOptions {
7272
export function getGlmModelOptions(modelId: string): GlmModelOptions {
7373
const isGlm = isGlmModel(modelId)
7474

75+
// Log GLM model detection result for diagnostics
76+
if (isGlm) {
77+
console.log(`[GLM Detection] ✓ GLM model detected: "${modelId}"`)
78+
console.log(`[GLM Detection] - mergeToolResultText: true`)
79+
console.log(`[GLM Detection] - disableParallelToolCalls: true`)
80+
}
81+
7582
return {
7683
mergeToolResultText: isGlm,
7784
disableParallelToolCalls: isGlm,

0 commit comments

Comments
 (0)