Skip to content

Commit

Permalink
fix: append DONE message to chat stream (#2221)
Browse files Browse the repository at this point in the history
* fix: append DONE message to chat stream

* fix: update completions endpoint
  • Loading branch information
drbh authored Jul 11, 2024
1 parent cb150eb commit d789de3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions router/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,10 @@ async fn completions(
}
};

let stream = stream.chain(futures::stream::once(async {
Ok(Event::default().data("[DONE]"))
}));

let sse = Sse::new(stream).keep_alive(KeepAlive::default());
Ok((headers, sse).into_response())
} else {
Expand Down Expand Up @@ -1171,6 +1175,11 @@ async fn chat_completions(
span,
)
.await;

let response_stream = response_stream.chain(futures::stream::once(async {
Ok(Event::default().data("[DONE]"))
}));

let sse = Sse::new(response_stream).keep_alive(KeepAlive::default());
Ok((headers, sse).into_response())
} else {
Expand Down

0 comments on commit d789de3

Please sign in to comment.