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
7d7a29cf
Commit
7d7a29cf
authored
Jul 11, 2024
by
Timothy J. Baek
Browse files
fix
parent
f462744f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
backend/main.py
backend/main.py
+9
-7
No files found.
backend/main.py
View file @
7d7a29cf
...
@@ -618,12 +618,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -618,12 +618,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
content
=
{
"detail"
:
str
(
e
)},
content
=
{
"detail"
:
str
(
e
)},
)
)
# `task` field is used to determine the type of the request, e.g. `title_generation`, `query_generation`, etc.
task
=
None
if
"task"
in
body
:
task
=
body
[
"task"
]
del
body
[
"task"
]
# Extract session_id, chat_id and message_id from the request body
# Extract session_id, chat_id and message_id from the request body
session_id
=
None
session_id
=
None
if
"session_id"
in
body
:
if
"session_id"
in
body
:
...
@@ -703,7 +697,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -703,7 +697,6 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
"session_id"
:
session_id
,
"session_id"
:
session_id
,
"chat_id"
:
chat_id
,
"chat_id"
:
chat_id
,
"message_id"
:
message_id
,
"message_id"
:
message_id
,
"task"
:
task
,
}
}
modified_body_bytes
=
json
.
dumps
(
body
).
encode
(
"utf-8"
)
modified_body_bytes
=
json
.
dumps
(
body
).
encode
(
"utf-8"
)
...
@@ -1038,6 +1031,15 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
...
@@ -1038,6 +1031,15 @@ async def generate_chat_completions(form_data: dict, user=Depends(get_verified_u
)
)
model
=
app
.
state
.
MODELS
[
model_id
]
model
=
app
.
state
.
MODELS
[
model_id
]
# `task` field is used to determine the type of the request, e.g. `title_generation`, `query_generation`, etc.
task
=
None
if
"task"
in
form_data
:
task
=
form_data
[
"task"
]
del
form_data
[
"task"
]
if
"metadata"
in
form_data
:
form_data
[
"metadata"
][
'task'
]
=
task
if
model
.
get
(
"pipe"
):
if
model
.
get
(
"pipe"
):
return
await
generate_function_chat_completion
(
form_data
,
user
=
user
)
return
await
generate_function_chat_completion
(
form_data
,
user
=
user
)
if
model
[
"owned_by"
]
==
"ollama"
:
if
model
[
"owned_by"
]
==
"ollama"
:
...
...
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