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
e4fe1fff
Commit
e4fe1fff
authored
Jun 11, 2024
by
Timothy J. Baek
Browse files
feat: tool __user__ email
parent
37ed31b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
backend/main.py
backend/main.py
+1
-0
src/lib/components/workspace/Tools/CodeEditor.svelte
src/lib/components/workspace/Tools/CodeEditor.svelte
+4
-2
No files found.
backend/main.py
View file @
e4fe1fff
...
...
@@ -230,6 +230,7 @@ async def get_function_call_response(prompt, tool_id, template, task_model_id, u
**
result
[
"parameters"
],
"__user__"
:
{
"id"
:
user
.
id
,
"email"
:
user
.
email
,
"name"
:
user
.
name
,
"role"
:
user
.
role
,
},
...
...
src/lib/components/workspace/Tools/CodeEditor.svelte
View file @
e4fe1fff
...
...
@@ -20,9 +20,9 @@ class Tools:
# Use Sphinx-style docstrings to document your tools, they will be used for generating tools specifications
# Please refer to function_calling_filter_pipeline.py file from pipelines project for an example
def get_user_name_and_id(self, __user__: dict = {}) -> str:
def get_user_name_and_
email_and_
id(self, __user__: dict = {}) -> str:
"""
Get the user name and ID from the user object.
Get the user name
, Email
and ID from the user object.
"""
# Do not include :param for __user__ in the docstring as it should not be shown in the tool's documentation
...
...
@@ -35,6 +35,8 @@ class Tools:
result += f"User: {__user__['name']}"
if "id" in __user__:
result += f" (ID: {__user__['id']})"
if "email" in __user__:
result += f" (Email: {__user__['email']})"
if result == "":
result = "User: Unknown"
...
...
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