mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
🔧 fix: Add missing finish_reason to stream chunks (#5563)
This commit is contained in:
parent
85c6a706c3
commit
1226f56d0c
1 changed files with 8 additions and 0 deletions
|
|
@ -1364,6 +1364,14 @@ ${convo}
|
||||||
}
|
}
|
||||||
|
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
|
// Add finish_reason: null if missing in any choice
|
||||||
|
if (chunk.choices) {
|
||||||
|
chunk.choices.forEach(choice => {
|
||||||
|
if (!('finish_reason' in choice)) {
|
||||||
|
choice.finish_reason = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.streamHandler.handle(chunk);
|
this.streamHandler.handle(chunk);
|
||||||
if (abortController.signal.aborted) {
|
if (abortController.signal.aborted) {
|
||||||
stream.controller.abort();
|
stream.controller.abort();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue