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
049b3136
Commit
049b3136
authored
Jun 11, 2024
by
Timothy J. Baek
Browse files
refac
parent
3d6f5f41
Changes
1
Hide 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 @
049b3136
...
@@ -284,6 +284,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -284,6 +284,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
context
=
""
context
=
""
for
tool_id
in
data
[
"tool_ids"
]:
for
tool_id
in
data
[
"tool_ids"
]:
print
(
tool_id
)
response
=
await
get_function_call_response
(
response
=
await
get_function_call_response
(
prompt
=
prompt
,
prompt
=
prompt
,
tool_id
=
tool_id
,
tool_id
=
tool_id
,
...
@@ -291,10 +292,9 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -291,10 +292,9 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
task_model_id
=
task_model_id
,
task_model_id
=
task_model_id
,
user
=
user
,
user
=
user
,
)
)
print
(
response
)
if
response
:
if
response
:
context
=
(
"
\n
"
if
context
!=
""
else
""
)
+
response
context
+
=
(
"
\n
"
if
context
!=
""
else
""
)
+
response
if
context
!=
""
:
if
context
!=
""
:
system_prompt
=
rag_template
(
system_prompt
=
rag_template
(
...
@@ -304,7 +304,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
...
@@ -304,7 +304,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
print
(
system_prompt
)
print
(
system_prompt
)
data
[
"messages"
]
=
add_or_update_system_message
(
data
[
"messages"
]
=
add_or_update_system_message
(
f
"
\n
{
system_prompt
}
"
,
data
[
"messages"
]
f
"
\n
{
system_prompt
}
"
,
data
[
"messages"
]
)
)
del
data
[
"tool_ids"
]
del
data
[
"tool_ids"
]
...
...
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