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
67cd9b76
Commit
67cd9b76
authored
Jun 11, 2024
by
Timothy J. Baek
Browse files
refac: __user__ param
parent
8a86f327
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
backend/main.py
backend/main.py
+4
-5
backend/utils/tools.py
backend/utils/tools.py
+1
-1
No files found.
backend/main.py
View file @
67cd9b76
...
...
@@ -205,7 +205,6 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u
# Parse the function response
if
content
is
not
None
:
print
(
content
)
result
=
json
.
loads
(
content
)
print
(
result
)
...
...
@@ -223,13 +222,13 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u
try
:
# Get the signature of the function
sig
=
inspect
.
signature
(
function
)
# Check if 'user' is a parameter of the function
if
"user"
in
sig
.
parameters
:
# Call the function with the 'user' parameter included
# Check if '
__
user
__
' is a parameter of the function
if
"
__
user
__
"
in
sig
.
parameters
:
# Call the function with the '
__
user
__
' parameter included
function_result
=
function
(
**
{
**
result
[
"parameters"
],
"user"
:
{
"
__
user
__
"
:
{
"id"
:
user
.
id
,
"name"
:
user
.
name
,
"role"
:
user
.
role
,
...
...
backend/utils/tools.py
View file @
67cd9b76
...
...
@@ -57,7 +57,7 @@ def get_tools_specs(tools) -> List[dict]:
for
param_name
,
param_annotation
in
get_type_hints
(
function
).
items
()
if
param_name
!=
"return"
if
param_name
!=
"return"
and
param_name
!=
"__user__"
},
"required"
:
[
name
...
...
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