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
de367e48
"test/config/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "0fb78620ff668dac3a686d88ee961048e32d40f9"
Commit
de367e48
authored
Jun 22, 2024
by
Timothy J. Baek
Browse files
fix
parent
df71d7c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
backend/main.py
backend/main.py
+14
-14
No files found.
backend/main.py
View file @
de367e48
...
@@ -399,7 +399,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -399,7 +399,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
# Get the signature of the function
# Get the signature of the function
sig
=
inspect
.
signature
(
inlet
)
sig
=
inspect
.
signature
(
inlet
)
param
=
{
"body"
:
data
}
param
s
=
{
"body"
:
data
}
if
"__user__"
in
sig
.
parameters
:
if
"__user__"
in
sig
.
parameters
:
__user__
=
{
__user__
=
{
...
@@ -424,15 +424,15 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -424,15 +424,15 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
params
=
{
**
params
,
"__user__"
:
__user__
}
params
=
{
**
params
,
"__user__"
:
__user__
}
if
"__id__"
in
sig
.
parameters
:
if
"__id__"
in
sig
.
parameters
:
param
=
{
param
s
=
{
**
param
,
**
param
s
,
"__id__"
:
filter_id
,
"__id__"
:
filter_id
,
}
}
if
inspect
.
iscoroutinefunction
(
inlet
):
if
inspect
.
iscoroutinefunction
(
inlet
):
data
=
await
inlet
(
**
param
)
data
=
await
inlet
(
**
param
s
)
else
:
else
:
data
=
inlet
(
**
param
)
data
=
inlet
(
**
param
s
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"Error:
{
e
}
"
)
print
(
f
"Error:
{
e
}
"
)
...
@@ -962,17 +962,17 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
...
@@ -962,17 +962,17 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
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
}
"
)
return
{
"error"
:
{
"detail"
:
str
(
e
)}}
return
{
"error"
:
{
"detail"
:
str
(
e
)}}
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
)
if
isinstance
(
res
,
dict
):
if
isinstance
(
res
,
dict
):
return
res
return
res
...
@@ -1104,7 +1104,7 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
...
@@ -1104,7 +1104,7 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
# Get the signature of the function
# Get the signature of the function
sig
=
inspect
.
signature
(
outlet
)
sig
=
inspect
.
signature
(
outlet
)
param
=
{
"body"
:
data
}
param
s
=
{
"body"
:
data
}
if
"__user__"
in
sig
.
parameters
:
if
"__user__"
in
sig
.
parameters
:
__user__
=
{
__user__
=
{
...
@@ -1127,15 +1127,15 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
...
@@ -1127,15 +1127,15 @@ async def chat_completed(form_data: dict, user=Depends(get_verified_user)):
params
=
{
**
params
,
"__user__"
:
__user__
}
params
=
{
**
params
,
"__user__"
:
__user__
}
if
"__id__"
in
sig
.
parameters
:
if
"__id__"
in
sig
.
parameters
:
param
=
{
param
s
=
{
**
param
,
**
param
s
,
"__id__"
:
filter_id
,
"__id__"
:
filter_id
,
}
}
if
inspect
.
iscoroutinefunction
(
outlet
):
if
inspect
.
iscoroutinefunction
(
outlet
):
data
=
await
outlet
(
**
param
)
data
=
await
outlet
(
**
param
s
)
else
:
else
:
data
=
outlet
(
**
param
)
data
=
outlet
(
**
param
s
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
f
"Error:
{
e
}
"
)
print
(
f
"Error:
{
e
}
"
)
...
...
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