feat: Introduce RAG tool recommendations and refactor related components for improved plugin management (#27259)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Wu Tianwei
2025-10-28 10:22:16 +08:00
committed by GitHub
parent ff32dff163
commit 0e62a66cc2
32 changed files with 490 additions and 288 deletions

View File

@@ -4,9 +4,11 @@ import type {
MCPServerDetail,
Tool,
} from '@/app/components/tools/types'
import { CollectionType } from '@/app/components/tools/types'
import type { RAGRecommendedPlugins, ToolWithProvider } from '@/app/components/workflow/types'
import type { AppIconType } from '@/types/app'
import { useInvalid } from './use-base'
import type { QueryKey } from '@tanstack/react-query'
import {
useMutation,
useQuery,
@@ -76,6 +78,16 @@ export const useInvalidateAllMCPTools = () => {
return useInvalid(useAllMCPToolsKey)
}
const useInvalidToolsKeyMap: Record<string, QueryKey> = {
[CollectionType.builtIn]: useAllBuiltInToolsKey,
[CollectionType.custom]: useAllCustomToolsKey,
[CollectionType.workflow]: useAllWorkflowToolsKey,
[CollectionType.mcp]: useAllMCPToolsKey,
}
export const useInvalidToolsByType = (type: CollectionType | string) => {
return useInvalid(useInvalidToolsKeyMap[type])
}
export const useCreateMCP = () => {
return useMutation({
mutationKey: [NAME_SPACE, 'create-mcp'],