mirror of
https://github.com/langgenius/dify.git
synced 2025-12-20 06:32:45 +00:00
feat: update RAG recommended plugins hook to accept type parameter for better categorization
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
Some checks failed
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Has been cancelled
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Has been cancelled
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Has been cancelled
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Has been cancelled
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Has been cancelled
This commit is contained in:
@@ -37,7 +37,7 @@ const useRefreshPluginList = () => {
|
||||
if ((manifest && PluginCategoryEnum.tool.includes(manifest.category)) || refreshAllType) {
|
||||
invalidateAllToolProviders()
|
||||
invalidateAllBuiltInTools()
|
||||
invalidateRAGRecommendedPlugins()
|
||||
invalidateRAGRecommendedPlugins('tool')
|
||||
// TODO: update suggested tools. It's a function in hook useMarketplacePlugins,handleUpdatePlugins
|
||||
}
|
||||
|
||||
|
||||
@@ -330,15 +330,24 @@ export const useRemoveProviderCredentials = ({
|
||||
|
||||
const useRAGRecommendedPluginListKey = [NAME_SPACE, 'rag-recommended-plugins']
|
||||
|
||||
export const useRAGRecommendedPlugins = () => {
|
||||
export const useRAGRecommendedPlugins = (type: 'tool' | 'datasource' | 'all' = 'all') => {
|
||||
return useQuery<RAGRecommendedPlugins>({
|
||||
queryKey: useRAGRecommendedPluginListKey,
|
||||
queryFn: () => get<RAGRecommendedPlugins>('/rag/pipelines/recommended-plugins'),
|
||||
queryKey: [...useRAGRecommendedPluginListKey, type],
|
||||
queryFn: () => get<RAGRecommendedPlugins>('/rag/pipelines/recommended-plugins', {
|
||||
params: {
|
||||
type,
|
||||
},
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
export const useInvalidateRAGRecommendedPlugins = () => {
|
||||
return useInvalid(useRAGRecommendedPluginListKey)
|
||||
const queryClient = useQueryClient()
|
||||
return (type: 'tool' | 'datasource' | 'all' = 'all') => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...useRAGRecommendedPluginListKey, type],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// App Triggers API hooks
|
||||
|
||||
Reference in New Issue
Block a user