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

@@ -2,7 +2,7 @@ import { useModelList } from '@/app/components/header/account-setting/model-prov
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import { useProviderContext } from '@/context/provider-context'
import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders } from '@/service/use-tools'
import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders, useInvalidateRAGRecommendedPlugins } from '@/service/use-tools'
import { useInvalidateStrategyProviders } from '@/service/use-strategy'
import type { Plugin, PluginDeclaration, PluginManifestInMarket } from '../../types'
import { PluginType } from '../../types'
@@ -23,6 +23,8 @@ const useRefreshPluginList = () => {
const invalidateDataSourceListAuth = useInvalidDataSourceListAuth()
const invalidateStrategyProviders = useInvalidateStrategyProviders()
const invalidateRAGRecommendedPlugins = useInvalidateRAGRecommendedPlugins()
return {
refreshPluginList: (manifest?: PluginManifestInMarket | Plugin | PluginDeclaration | null, refreshAllType?: boolean) => {
// installed list
@@ -32,6 +34,7 @@ const useRefreshPluginList = () => {
if ((manifest && PluginType.tool.includes(manifest.category)) || refreshAllType) {
invalidateAllToolProviders()
invalidateAllBuiltInTools()
invalidateRAGRecommendedPlugins()
// TODO: update suggested tools. It's a function in hook useMarketplacePlugins,handleUpdatePlugins
}

View File

@@ -15,6 +15,7 @@ import {
import { useGetApi } from './use-get-api'
import type { PluginPayload } from '../types'
import type { CredentialTypeEnum } from '../types'
import { useInvalidToolsByType } from '@/service/use-tools'
export const useGetPluginCredentialInfoHook = (pluginPayload: PluginPayload, enable?: boolean) => {
const apiMap = useGetApi(pluginPayload)
@@ -29,8 +30,14 @@ export const useDeletePluginCredentialHook = (pluginPayload: PluginPayload) => {
export const useInvalidPluginCredentialInfoHook = (pluginPayload: PluginPayload) => {
const apiMap = useGetApi(pluginPayload)
const invalidPluginCredentialInfo = useInvalidPluginCredentialInfo(apiMap.getCredentialInfo)
const providerType = pluginPayload.providerType
const invalidToolsByType = useInvalidToolsByType(providerType)
return useInvalidPluginCredentialInfo(apiMap.getCredentialInfo)
return () => {
invalidPluginCredentialInfo()
invalidToolsByType()
}
}
export const useSetPluginDefaultCredentialHook = (pluginPayload: PluginPayload) => {

View File

@@ -1,3 +1,5 @@
import type { CollectionType } from '../../tools/types'
export type { AddApiKeyButtonProps } from './authorize/add-api-key-button'
export type { AddOAuthButtonProps } from './authorize/add-oauth-button'
@@ -10,6 +12,7 @@ export enum AuthCategory {
export type PluginPayload = {
category: AuthCategory
provider: string
providerType: CollectionType | string
}
export enum CredentialTypeEnum {