fix: append DONE message to chat stream (#2221)
* fix: append DONE message to chat stream * fix: update completions endpoint
This commit is contained in:
parent
cb150eb295
commit
d789de329a
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue