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:
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user