fix: handle ThinkingPart in OpenCode and OpenAI API converters (#174) - #418
Closed
Million-mo wants to merge 1 commit into
Closed
fix: handle ThinkingPart in OpenCode and OpenAI API converters (#174)#418Million-mo wants to merge 1 commit into
Million-mo wants to merge 1 commit into
Conversation
ThinkingPart (LLM reasoning content) was silently dropped in two areas: 1. OpenCode server session restore: chat_message_to_opencode() had no case for ThinkingPart in either the pydantic match/case or the dict path. opencode_to_chat_message() had no case for ReasoningPart. 2. OpenAI API server: all paths (streaming, non-streaming, responses) ignored thinking content. OpenAIMessage lacked reasoning_content field. Fixes: - converters.py: Add ThinkingPart case in chat_message_to_opencode() (both pydantic and dict paths), creating ReasoningPart with metadata preserving id/provider_name/signature/provider_details. Add ReasoningPart case in opencode_to_chat_message() restoring full ThinkingPart fields. - message.py: Add add_reasoning_part() method to MessageWithParts - completions/models.py: Add reasoning_content field to OpenAIMessage - completions/helpers.py: Add ThinkingPartDelta match arm in stream_response() emitting reasoning_content delta - server.py: Extract ThinkingPart content in non-streaming path - responses/helpers.py + models.py: Add ResponseReasoning output type and include reasoning content in responses API
Owner
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #174
ThinkingPart (LLM reasoning content) was silently dropped in two protocol server areas:
Changes
OpenCode converters (converters.py + message.py)
OpenAI API server (4 files)
Test Plan
Relationship to #155 and #156
Three independent fixes covering the full chain. No overlap in changed files.