| import PluginDetailPanel from '@/app/components/plugins/plugin-detail-panel' | import PluginDetailPanel from '@/app/components/plugins/plugin-detail-panel' | ||||
| import MCPList from './mcp' | import MCPList from './mcp' | ||||
| import { useAllToolProviders } from '@/service/use-tools' | import { useAllToolProviders } from '@/service/use-tools' | ||||
| import { useInstalledPluginList, useInvalidateInstalledPluginList } from '@/service/use-plugins' | |||||
| import { useCheckInstalled, useInvalidateInstalledPluginList } from '@/service/use-plugins' | |||||
| import { useGlobalPublicStore } from '@/context/global-public-context' | import { useGlobalPublicStore } from '@/context/global-public-context' | ||||
| import { ToolTypeEnum } from '../workflow/block-selector/types' | import { ToolTypeEnum } from '../workflow/block-selector/types' | ||||
| import { useMarketplace } from './marketplace/hooks' | import { useMarketplace } from './marketplace/hooks' | ||||
| const currentProvider = useMemo<Collection | undefined>(() => { | const currentProvider = useMemo<Collection | undefined>(() => { | ||||
| return filteredCollectionList.find(collection => collection.id === currentProviderId) | return filteredCollectionList.find(collection => collection.id === currentProviderId) | ||||
| }, [currentProviderId, filteredCollectionList]) | }, [currentProviderId, filteredCollectionList]) | ||||
| const { data: pluginList } = useInstalledPluginList() | |||||
| const { data: checkedInstalledData } = useCheckInstalled({ | |||||
| pluginIds: currentProvider?.plugin_id ? [currentProvider.plugin_id] : [], | |||||
| enabled: !!currentProvider?.plugin_id, | |||||
| }) | |||||
| const invalidateInstalledPluginList = useInvalidateInstalledPluginList() | const invalidateInstalledPluginList = useInvalidateInstalledPluginList() | ||||
| const currentPluginDetail = useMemo(() => { | const currentPluginDetail = useMemo(() => { | ||||
| const detail = pluginList?.plugins.find(plugin => plugin.plugin_id === currentProvider?.plugin_id) | |||||
| return detail | |||||
| }, [currentProvider?.plugin_id, pluginList?.plugins]) | |||||
| return checkedInstalledData?.plugins?.[0] | |||||
| }, [checkedInstalledData]) | |||||
| const toolListTailRef = useRef<HTMLDivElement>(null) | const toolListTailRef = useRef<HTMLDivElement>(null) | ||||
| const showMarketplacePanel = useCallback(() => { | const showMarketplacePanel = useCallback(() => { |