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
db5c4be6
Unverified
Commit
db5c4be6
authored
Apr 27, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Apr 27, 2024
Browse files
Merge pull request #1795 from cheahjs/fix/openai-handle-carriage-returns
fix: handle carriage returns in OpenAI streams
parents
6fbddb07
be038ab8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/lib/apis/streaming/index.ts
src/lib/apis/streaming/index.ts
+5
-1
No files found.
src/lib/apis/streaming/index.ts
View file @
db5c4be6
...
@@ -26,7 +26,11 @@ async function* openAIStreamToIterator(
...
@@ -26,7 +26,11 @@ async function* openAIStreamToIterator(
break
;
break
;
}
}
const
lines
=
value
.
split
(
'
\n
'
);
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
!==
''
)
{
if
(
line
!==
''
)
{
console
.
log
(
line
);
console
.
log
(
line
);
if
(
line
===
'
data: [DONE]
'
)
{
if
(
line
===
'
data: [DONE]
'
)
{
...
...
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