mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-15 01:56:01 +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 { t } = useTranslation()
|
||||||
const { isCurrentWorkspaceManager } = useAppContext()
|
const { isCurrentWorkspaceManager } = useAppContext()
|
||||||
|
|
||||||
const { data: toolList = [], isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '')
|
const { data, isPending: isGettingTools } = useMCPTools(detail.is_team_authorization ? detail.id : '')
|
||||||
console.log('MCPDetailContent', detail, toolList)
|
|
||||||
const invalidateMCPTools = useInvalidateMCPTools()
|
const invalidateMCPTools = useInvalidateMCPTools()
|
||||||
const { mutateAsync: updateTools, isPending: isUpdating } = useUpdateMCPTools(detail.id)
|
const { mutateAsync: updateTools, isPending: isUpdating } = useUpdateMCPTools(detail.id)
|
||||||
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
|
const { mutateAsync: authorizeMcp, isPending: isAuthorizing } = useAuthorizeMCP()
|
||||||
|
const toolList = data?.tools || []
|
||||||
|
|
||||||
const handleUpdateTools = useCallback(async () => {
|
const handleUpdateTools = useCallback(async () => {
|
||||||
if (!detail)
|
if (!detail)
|
||||||
|
@ -157,7 +157,7 @@ export const useMCPTools = (providerID: string) => {
|
|||||||
return useQuery({
|
return useQuery({
|
||||||
enabled: !!providerID,
|
enabled: !!providerID,
|
||||||
queryKey: [NAME_SPACE, 'get-MCP-provider-tool', 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 = () => {
|
export const useInvalidateMCPTools = () => {
|
||||||
@ -172,7 +172,7 @@ export const useInvalidateMCPTools = () => {
|
|||||||
|
|
||||||
export const useUpdateMCPTools = (providerID: string) => {
|
export const useUpdateMCPTools = (providerID: string) => {
|
||||||
return useMutation({
|
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