fix(openai): gracefully handle stream endings
- The Responses API ends streams without a final '[DONE]' message. - This causes reqwest_eventsource to return Error::StreamEnded. - Previously, this was treated as a premature termination, triggering an error probe. - We now explicitly match and break on Err(StreamEnded) for normal completion.
This commit is contained in:
@@ -524,6 +524,7 @@ impl super::Provider for OpenAIProvider {
|
||||
}
|
||||
}
|
||||
Ok(_) => continue,
|
||||
Err(reqwest_eventsource::Error::StreamEnded) => break,
|
||||
Err(e) => {
|
||||
// Attempt to probe for the actual error body
|
||||
let probe_resp = probe_client
|
||||
@@ -887,6 +888,7 @@ impl super::Provider for OpenAIProvider {
|
||||
}
|
||||
}
|
||||
Ok(_) => continue,
|
||||
Err(reqwest_eventsource::Error::StreamEnded) => break,
|
||||
Err(e) => {
|
||||
// Attempt to probe for the actual error body
|
||||
let probe_resp = probe_client
|
||||
|
||||
Reference in New Issue
Block a user