mirror of
https://github.com/open-webui/open-webui
synced 2024-11-17 14:02:51 +00:00
fix: tool edit
This commit is contained in:
parent
25c0eca414
commit
4601a0246f
@ -111,7 +111,7 @@ async def create_new_toolkit(form_data: ToolForm, user=Depends(get_admin_user)):
|
||||
############################
|
||||
|
||||
|
||||
@router.get("/id/{id}", response_model=Optional[ToolResponse])
|
||||
@router.get("/id/{id}", response_model=Optional[ToolModel])
|
||||
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[ToolResponse])
|
||||
@router.post("/id/{id}/update", response_model=Optional[ToolModel])
|
||||
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
|
||||
|
@ -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');
|
||||
|
@ -40,6 +40,8 @@
|
||||
goto('/workspace/tools');
|
||||
return null;
|
||||
});
|
||||
|
||||
console.log(tool);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user