Skip to content

Commit

Permalink
fix: Handle case were finish_reason is not sent but server sends [DON…
Browse files Browse the repository at this point in the history
…E] event.
  • Loading branch information
Hugoch committed Oct 10, 2024
1 parent 63da39f commit 72673e6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ impl TextGenerationBackend for OpenAITextGenerationBackend {
Ok(Event::Open) => trace!("SSE connection opened"),
Ok(Event::Message(message)) => {
if message.data == "\n" || message.data == "[DONE]" {
aggregated_response.stop();
continue;
}
if message.data.starts_with("{\"error\":") {
Expand Down

0 comments on commit 72673e6

Please sign in to comment.