fix(clinepass): unwrap { data, success } envelope in non-streaming responses - #3387
Open
linhdmn wants to merge 1 commit into
Open
fix(clinepass): unwrap { data, success } envelope in non-streaming responses#3387linhdmn wants to merge 1 commit into
linhdmn wants to merge 1 commit into
Conversation
…sponses
api.cline.bot wraps non-streaming chat completions in { data: { ... }, success: true }.
The openai→openai non-stream path passed the raw body through, so the router's JSON
response had no top-level `choices` and model tests reported "Provider returned no
completion choices for this model". Unwrap the envelope when data.choices is present.
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.
Problem
api.cline.botwraps non-streaming chat completions in{ data: { ... }, success: true }:{ data: { choices: [...], model: deepseek/deepseek-v4-flash, ... }, success: true }The
openai → openainon-stream path passes the upstream body through untranslated (translateNonStreamingResponsereturns it as-is), so the router's JSON response has no top-levelchoices. Clients and the model test then fail withProvider returned no completion choices for this model.Fix
In
handleNonStreamingResponse, unwrap thedataenvelope when it actually containschoices. The guard only triggers when the top level has nochoicesbutdata.choicesis an array, so plain OpenAI-shaped responses are untouched.Verified
data.choices; after unwrap, top-levelchoicespresent./api/v1/chat/completions(non-stream) now returns top-levelchoices.