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
This commit is contained in:
Roo Code 2026-01-29 17:16:03 +00:00
parent 1379ba4cd9
commit 2c5d905aeb
3 changed files with 13 additions and 0 deletions

View file

@ -79,6 +79,7 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
// Get model-specific options for GLM models (applies Z.ai optimizations)
// This allows third-party GLM models via OpenAI-compatible endpoints to benefit
// from the same optimizations used by Z.ai
console.log(`[${this.providerName}] Using model ID: "${model}"`)
const glmOptions = getGlmModelOptions(model)
// 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>
? (metadata?.parallelToolCalls ?? false)
: (metadata?.parallelToolCalls ?? true)
console.log(`[${this.providerName}] parallel_tool_calls set to: ${parallelToolCalls}`)
// Convert messages with GLM-specific handling when applicable
// mergeToolResultText prevents GLM models from dropping reasoning_content
const convertedMessages = convertToOpenAiMessages(messages, {

View file

@ -45,6 +45,7 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
): ApiStream {
// Get model-specific options for GLM models (applies Z.ai optimizations)
const modelId = this.getModel().id
console.log(`[LM Studio] Using model ID: "${modelId}"`)
const glmOptions = getGlmModelOptions(modelId)
// Convert messages with GLM-specific handling when applicable
@ -96,6 +97,8 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
? (metadata?.parallelToolCalls ?? false)
: (metadata?.parallelToolCalls ?? true)
console.log(`[LM Studio] parallel_tool_calls set to: ${parallelToolCalls}`)
const params: OpenAI.Chat.ChatCompletionCreateParamsStreaming & { draft_model?: string } = {
model: modelId,
messages: openAiMessages,

View file

@ -72,6 +72,13 @@ export interface GlmModelOptions {
export function getGlmModelOptions(modelId: string): GlmModelOptions {
const isGlm = isGlmModel(modelId)
// Log GLM model detection result for diagnostics
if (isGlm) {
console.log(`[GLM Detection] ✓ GLM model detected: "${modelId}"`)
console.log(`[GLM Detection] - mergeToolResultText: true`)
console.log(`[GLM Detection] - disableParallelToolCalls: true`)
}
return {
mergeToolResultText: isGlm,
disableParallelToolCalls: isGlm,