Add tool duplication functionality and enhance ComponentsToolsPage

- Implement a new API endpoint for duplicating tools in the backend.
- Add a duplicate_tool function in ComponentsToolsPage to handle tool duplication requests.
- Update the UI to include a dropdown menu option for duplicating tools, improving user experience.
- Refactor the remove function to accept a resource object instead of an ID for better clarity and maintainability.
This commit is contained in:
Xin Wang
2026-07-10 16:45:51 +08:00
parent ba59ea447c
commit 8c0358ad91
4 changed files with 70 additions and 4 deletions

View File

@@ -314,6 +314,8 @@ export const toolsApi = {
}),
remove: (id: string) =>
request<{ ok: boolean }>(`/api/tools/${id}`, { method: "DELETE" }),
duplicate: (id: string) =>
request<Tool>(`/api/tools/${id}/duplicate`, { method: "POST" }),
};
// ---------- 知识库 ----------