Skip to content

GLM 4.7 thinking process not properly formatted - missing leading tags #7779

@ukyonagata0105

Description

@ukyonagata0105

Description

When using GLM 4.7 model, the thinking process is not being properly formatted. The opening tag (e.g., <think>) at the beginning of the thinking content is missing, causing all reasoning output to appear as plain text in the UI.

Expected Behavior

The thinking process should be wrapped with proper tags like:

<think>
[reasoning content]
</think>

This allows the UI to properly hide/display the thinking content.

Actual Behavior

Only the closing tag is present, or the entire reasoning appears as plain text without any formatting. The opening <think> tag is missing from the beginning of the thinking process.

Steps to Reproduce

  1. Configure opencode to use GLM 4.7 model (Zhipu AI)
  2. Ask a question that triggers tool usage or complex reasoning
  3. Observe the output - the thinking process appears as plain text instead of being properly formatted

Environment

  • Model: Zhipu GLM-4.7
  • Provider: Custom/Local LLM provider using vLLM or similar

Additional Context

This may be related to how the streaming response is parsed for GLM 4.7, specifically in the JSON parsing logic that handles reasoning_content fields.

Plugins

No response

OpenCode version

1.1.13

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions