Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
74496342
"src/vscode:/vscode.git/clone" did not exist on "c62cb43f7eeec690ea8f08bbf92f07d3c0744238"
Commit
74496342
authored
Apr 26, 2024
by
Arman Ordookhani
Browse files
Fix OpenRouter hearbeats breaking streaming
parent
1092ee9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
src/lib/apis/streaming/index.ts
src/lib/apis/streaming/index.ts
+4
-0
No files found.
src/lib/apis/streaming/index.ts
View file @
74496342
...
...
@@ -31,6 +31,10 @@ async function* openAIStreamToIterator(
console
.
log
(
line
);
if
(
line
===
'
data: [DONE]
'
)
{
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
{
const
data
=
JSON
.
parse
(
line
.
replace
(
/^data: /
,
''
));
console
.
log
(
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment