mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 00:05:54 +08:00
tool list data binding
This commit is contained in:
parent
195a349cb5
commit
598c469be2
@ -43,11 +43,11 @@ const MCPDetailContent: FC<Props> = ({
|
||||
const { t } = useTranslation()
|
||||
const { isCurrentWorkspaceManager } = useAppContext()
|
||||
|
||||
const { data: toolList = [], isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '')
|
||||
console.log('MCPDetailContent', detail, toolList)
|
||||
const { data, isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '')
|
||||
const invalidateMCPTools = useInvalidateMCPTools()
|
||||
const { mutateAsync: updateTools, isPending: isUpdating } = useUpdateMCPTools(detail.id)
|
||||
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
|
||||
const toolList = data?.tools || []
|
||||
|
||||
const handleUpdateTools = useCallback(async () => {
|
||||
if (!detail)
|
||||
|
@ -157,7 +157,7 @@ export const useMCPTools = (providerID: string) => {
|
||||
return useQuery({
|
||||
enabled: !!providerID,
|
||||
queryKey: [NAME_SPACE, 'get-MCP-provider-tool', providerID],
|
||||
queryFn: () => get<Tool[]>(`/workspaces/current/tool-provider/mcp/tools/${providerID}`),
|
||||
queryFn: () => get<{ tools: Tool[] }>(`/workspaces/current/tool-provider/mcp/tools/${providerID}`),
|
||||
})
|
||||
}
|
||||
export const useInvalidateMCPTools = () => {
|
||||
@ -172,7 +172,7 @@ export const useInvalidateMCPTools = () => {
|
||||
|
||||
export const useUpdateMCPTools = (providerID: string) => {
|
||||
return useMutation({
|
||||
mutationFn: () => get<Tool[]>(`/workspaces/current/tool-provider/mcp/update/${providerID}`),
|
||||
mutationFn: () => get<{ tools: Tool[] }>(`/workspaces/current/tool-provider/mcp/update/${providerID}`),
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user