mirror of
https://github.com/open-webui/open-webui
synced 2024-11-26 14:02:29 +00:00
Fix OpenRouter hearbeats breaking streaming
This commit is contained in:
parent
1092ee9c1c
commit
7449634290
@ -31,6 +31,10 @@ async function* openAIStreamToIterator(
|
|||||||
console.log(line);
|
console.log(line);
|
||||||
if (line === 'data: [DONE]') {
|
if (line === 'data: [DONE]') {
|
||||||
yield { done: true, value: '' };
|
yield { done: true, value: '' };
|
||||||
|
} if (line.startsWith(':')) {
|
||||||
|
// Events starting with : are comments https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
|
||||||
|
// OpenRouter sends heartbeats like ": OPENROUTER PROCESSING"
|
||||||
|
continue
|
||||||
} else {
|
} else {
|
||||||
const data = JSON.parse(line.replace(/^data: /, ''));
|
const data = JSON.parse(line.replace(/^data: /, ''));
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user