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
df71d7c6
Commit
df71d7c6
authored
Jun 22, 2024
by
Timothy J. Baek
Browse files
fix
parent
5b64c28f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
backend/main.py
backend/main.py
+3
-3
No files found.
backend/main.py
View file @
df71d7c6
...
@@ -881,7 +881,7 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
...
@@ -881,7 +881,7 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
# Get the signature of the function
# Get the signature of the function
sig
=
inspect
.
signature
(
pipe
)
sig
=
inspect
.
signature
(
pipe
)
param
=
{
"body"
:
form_data
}
param
s
=
{
"body"
:
form_data
}
if
"__user__"
in
sig
.
parameters
:
if
"__user__"
in
sig
.
parameters
:
__user__
=
{
__user__
=
{
...
@@ -908,9 +908,9 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
...
@@ -908,9 +908,9 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
async
def
stream_content
():
async
def
stream_content
():
try
:
try
:
if
inspect
.
iscoroutinefunction
(
pipe
):
if
inspect
.
iscoroutinefunction
(
pipe
):
res
=
await
pipe
(
**
param
)
res
=
await
pipe
(
**
param
s
)
else
:
else
:
res
=
pipe
(
**
param
)
res
=
pipe
(
**
param
s
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"Error:
{
e
}
"
)
print
(
f
"Error:
{
e
}
"
)
yield
f
"data:
{
json
.
dumps
(
{
'error'
:
{
'detail'
:
str
(
e
)
}}
)
}
\n\n
"
yield
f
"data:
{
json
.
dumps
(
{
'error'
:
{
'detail'
:
str
(
e
)
}}
)
}
\n\n
"
...
...
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