|
|
|
|
@ -14,8 +14,10 @@ import CustomCreateCard from '@/app/components/tools/provider/custom-create-card
|
|
|
|
|
import WorkflowToolEmpty from '@/app/components/tools/add-tool-modal/empty'
|
|
|
|
|
import Card from '@/app/components/plugins/card'
|
|
|
|
|
import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
|
|
|
|
|
import PluginDetailPanel from '@/app/components/plugins/plugin-detail-panel'
|
|
|
|
|
import { useSelector as useAppContextSelector } from '@/context/app-context'
|
|
|
|
|
import { useAllToolProviders } from '@/service/use-tools'
|
|
|
|
|
import { useInstalledPluginList, useInvalidateInstalledPluginList } from '@/service/use-plugins'
|
|
|
|
|
|
|
|
|
|
const ProviderList = () => {
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
@ -52,8 +54,15 @@ const ProviderList = () => {
|
|
|
|
|
}, [activeTab, tagFilterValue, keywords, collectionList])
|
|
|
|
|
|
|
|
|
|
const [currentProvider, setCurrentProvider] = useState<Collection | undefined>()
|
|
|
|
|
const { data: pluginList } = useInstalledPluginList()
|
|
|
|
|
const invalidateInstalledPluginList = useInvalidateInstalledPluginList()
|
|
|
|
|
const currentPluginDetail = useMemo(() => {
|
|
|
|
|
const detail = pluginList?.plugins.find(plugin => plugin.plugin_id === currentProvider?.plugin_id)
|
|
|
|
|
return detail
|
|
|
|
|
}, [currentProvider?.plugin_id, pluginList?.plugins])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div className='relative flex overflow-hidden bg-gray-100 shrink-0 h-0 grow'>
|
|
|
|
|
<div
|
|
|
|
|
ref={containerRef}
|
|
|
|
|
@ -130,14 +139,20 @@ const ProviderList = () => {
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
{currentProvider && (
|
|
|
|
|
</div>
|
|
|
|
|
{currentProvider && !currentProvider.plugin_id && (
|
|
|
|
|
<ProviderDetail
|
|
|
|
|
collection={currentProvider}
|
|
|
|
|
onHide={() => setCurrentProvider(undefined)}
|
|
|
|
|
onRefreshData={refetch}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<PluginDetailPanel
|
|
|
|
|
detail={currentPluginDetail}
|
|
|
|
|
onUpdate={() => invalidateInstalledPluginList()}
|
|
|
|
|
onHide={() => setCurrentProvider(undefined)}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
ProviderList.displayName = 'ToolProviderList'
|
|
|
|
|
|