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
add5269b
Unverified
Commit
add5269b
authored
Apr 26, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Apr 26, 2024
Browse files
Merge pull request #1773 from Rmaan/fix-openrouter-streaming
Fixed OpenRouter heart beats breaking streaming
parents
e9ba8d74
4ad7ef84
Changes
1
Show 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 @
add5269b
...
@@ -31,6 +31,10 @@ async function* openAIStreamToIterator(
...
@@ -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
:
''
};
}
else
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
);
...
...
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