Fix multi choices in OpenAI response with different types of content(…#81
Merged
ericc-ch merged 3 commits intoericc-ch:masterfrom Aug 10, 2025
Merged
Fix multi choices in OpenAI response with different types of content(…#81ericc-ch merged 3 commits intoericc-ch:masterfrom
ericc-ch merged 3 commits intoericc-ch:masterfrom
Conversation
…some with text content, some with tool calls), the translation only picked up the text content from the first choice and missing the tool calls from the seconed choice. The code was written by Copilot.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in OpenAI response translation where only the first choice's content was being processed, causing tool calls from subsequent choices to be missed. The fix ensures all choices are processed and their content is properly merged.
Key Changes
- Modified the translation logic to iterate through all choices instead of only processing the first one
- Added logic to merge text blocks and tool use blocks from all choices
- Implemented stop reason prioritization logic to handle multiple choices appropriately
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
This fixes timeout issues for me when using claude-code with copilot-api. Thanks! |
Owner
|
Ah well haven't had the chance to properly review this. I'll merge this once I'm home Thanks! |
hao1939
pushed a commit
to hao1939/copilot-api
that referenced
this pull request
Nov 22, 2025
Fix multi choices in OpenAI response with different types of content(…
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.
…some with text content, some with tool calls), the translation only picked up the text content from the first choice and missing the tool calls from the seconed choice. The code was written by Copilot.