mirror of
https://github.com/open-webui/open-webui
synced 2024-11-17 22:12: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)):
|
async def get_toolkit_by_id(id: str, user=Depends(get_admin_user)):
|
||||||
toolkit = Tools.get_tool_by_id(id)
|
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(
|
async def update_toolkit_by_id(
|
||||||
id: str, form_data: ToolForm, user=Depends(get_admin_user)
|
id: str, form_data: ToolForm, user=Depends(get_admin_user)
|
||||||
):
|
):
|
||||||
@ -143,9 +143,14 @@ async def update_toolkit_by_id(
|
|||||||
TOOLS[id] = toolkit_module
|
TOOLS[id] = toolkit_module
|
||||||
|
|
||||||
specs = get_tools_specs(TOOLS[id])
|
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:
|
if toolkit:
|
||||||
return toolkit
|
return toolkit
|
||||||
|
@ -60,7 +60,10 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
console.log(value);
|
||||||
|
if (value === '') {
|
||||||
value = boilerplate;
|
value = boilerplate;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if html class has dark mode
|
// Check if html class has dark mode
|
||||||
isDarkMode = document.documentElement.classList.contains('dark');
|
isDarkMode = document.documentElement.classList.contains('dark');
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
goto('/workspace/tools');
|
goto('/workspace/tools');
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log(tool);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user