mirror of
https://github.com/open-webui/open-webui
synced 2025-01-30 22:39:03 +00:00
fix: handle carriage returns in OpenAI streams
This commit is contained in:
parent
f8f9f27ae8
commit
be038ab878
@ -26,7 +26,11 @@ async function* openAIStreamToIterator(
|
||||
break;
|
||||
}
|
||||
const lines = value.split('\n');
|
||||
for (const line of lines) {
|
||||
for (let line of lines) {
|
||||
if (line.endsWith('\r')) {
|
||||
// Remove trailing \r
|
||||
line = line.slice(0, -1);
|
||||
}
|
||||
if (line !== '') {
|
||||
console.log(line);
|
||||
if (line === 'data: [DONE]') {
|
||||
|
Loading…
Reference in New Issue
Block a user