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
4601a024
Commit
4601a024
authored
Jun 10, 2024
by
Timothy J. Baek
Browse files
fix: tool edit
parent
25c0eca4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
6 deletions
+16
-6
backend/apps/webui/routers/tools.py
backend/apps/webui/routers/tools.py
+10
-5
src/lib/components/common/CodeEditor.svelte
src/lib/components/common/CodeEditor.svelte
+4
-1
src/routes/(app)/workspace/tools/edit/+page.svelte
src/routes/(app)/workspace/tools/edit/+page.svelte
+2
-0
No files found.
backend/apps/webui/routers/tools.py
View file @
4601a024
...
...
@@ -111,7 +111,7 @@ async def create_new_toolkit(form_data: ToolForm, user=Depends(get_admin_user)):
############################
@
router
.
get
(
"/id/{id}"
,
response_model
=
Optional
[
Tool
Response
])
@
router
.
get
(
"/id/{id}"
,
response_model
=
Optional
[
Tool
Model
])
async
def
get_toolkit_by_id
(
id
:
str
,
user
=
Depends
(
get_admin_user
)):
toolkit
=
Tools
.
get_tool_by_id
(
id
)
...
...
@@ -129,7 +129,7 @@ async def get_toolkit_by_id(id: str, user=Depends(get_admin_user)):
############################
@
router
.
post
(
"/id/{id}/update"
,
response_model
=
Optional
[
Tool
Response
])
@
router
.
post
(
"/id/{id}/update"
,
response_model
=
Optional
[
Tool
Model
])
async
def
update_toolkit_by_id
(
id
:
str
,
form_data
:
ToolForm
,
user
=
Depends
(
get_admin_user
)
):
...
...
@@ -143,9 +143,14 @@ async def update_toolkit_by_id(
TOOLS
[
id
]
=
toolkit_module
specs
=
get_tools_specs
(
TOOLS
[
id
])
toolkit
=
Tools
.
update_tool_by_id
(
id
,
{
**
form_data
.
model_dump
(),
"specs"
:
specs
}
)
updated
=
{
**
form_data
.
model_dump
(),
"specs"
:
specs
,
}
print
(
updated
)
toolkit
=
Tools
.
update_tool_by_id
(
id
,
updated
)
if
toolkit
:
return
toolkit
...
...
src/lib/components/common/CodeEditor.svelte
View file @
4601a024
...
...
@@ -60,7 +60,10 @@
];
onMount(() => {
value = boilerplate;
console.log(value);
if (value === '') {
value = boilerplate;
}
// Check if html class has dark mode
isDarkMode = document.documentElement.classList.contains('dark');
...
...
src/routes/(app)/workspace/tools/edit/+page.svelte
View file @
4601a024
...
...
@@ -40,6 +40,8 @@
goto('/workspace/tools');
return null;
});
console.log(tool);
}
});
</script>
...
...
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