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
24c35c30
Commit
24c35c30
authored
Jun 02, 2024
by
Jun Siang Cheah
Browse files
fix: stream defaults to true, return request ID
parent
207e2503
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
backend/apps/ollama/main.py
backend/apps/ollama/main.py
+2
-2
No files found.
backend/apps/ollama/main.py
View file @
24c35c30
...
@@ -993,7 +993,7 @@ async def generate_chat_completion(
...
@@ -993,7 +993,7 @@ async def generate_chat_completion(
def
stream_content
():
def
stream_content
():
try
:
try
:
if
payload
.
get
(
"stream"
,
Non
e
):
if
payload
.
get
(
"stream"
,
Tru
e
):
yield
json
.
dumps
({
"id"
:
request_id
,
"done"
:
False
})
+
"
\n
"
yield
json
.
dumps
({
"id"
:
request_id
,
"done"
:
False
})
+
"
\n
"
for
chunk
in
r
.
iter_content
(
chunk_size
=
8192
):
for
chunk
in
r
.
iter_content
(
chunk_size
=
8192
):
...
@@ -1522,7 +1522,7 @@ async def deprecated_proxy(
...
@@ -1522,7 +1522,7 @@ async def deprecated_proxy(
if
path
==
"generate"
:
if
path
==
"generate"
:
data
=
json
.
loads
(
body
.
decode
(
"utf-8"
))
data
=
json
.
loads
(
body
.
decode
(
"utf-8"
))
if
not
(
"stream"
in
data
and
data
[
"stream"
]
==
Fals
e
):
if
data
.
get
(
"stream"
,
Tru
e
):
yield
json
.
dumps
({
"id"
:
request_id
,
"done"
:
False
})
+
"
\n
"
yield
json
.
dumps
({
"id"
:
request_id
,
"done"
:
False
})
+
"
\n
"
elif
path
==
"chat"
:
elif
path
==
"chat"
:
...
...
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