= ({
})
}
- const handleInstall = async (pluginInfo: PluginInfoFromMarketPlace) => {
- setLoading(true)
- try {
- const { all_installed } = await installPackageFromMarketPlace(pluginInfo.latest_package_identifier)
- if (all_installed) {
- [
- ModelTypeEnum.textGeneration,
- ModelTypeEnum.textEmbedding,
- ModelTypeEnum.rerank,
- ModelTypeEnum.moderation,
- ModelTypeEnum.speech2text,
- ModelTypeEnum.tts,
- ].forEach((type: ModelTypeEnum) => {
- if (scope?.includes(type))
- updateModelList(type)
- })
- updateModelProviders()
- setInstalled(true)
- }
- }
- catch (error) {
- console.error('Installation failed:', error)
- }
- finally {
- setLoading(false)
- }
- }
-
return (
= ({
t={t}
/>
{!installed && !modelProvider && pluginInfo && (
- {
- e.stopPropagation()
- handleInstall(pluginInfo)
+ e.stopPropagation()}
+ size={'small'}
+ uniqueIdentifier={pluginInfo.latest_package_identifier}
+ onSuccess={() => {
+ [
+ ModelTypeEnum.textGeneration,
+ ModelTypeEnum.textEmbedding,
+ ModelTypeEnum.rerank,
+ ModelTypeEnum.moderation,
+ ModelTypeEnum.speech2text,
+ ModelTypeEnum.tts,
+ ].forEach((type: ModelTypeEnum) => {
+ if (scope?.includes(type))
+ updateModelList(type)
+ },
+ )
+ updateModelProviders()
+ invalidateInstalledPluginList()
+ setInstalled(true)
}}
- t={t}
/>
)}
{modelProvider && !disabled && !needsConfiguration && (
diff --git a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
index bdbcdfde5a..bf4073358f 100644
--- a/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
+++ b/web/app/components/workflow/nodes/_base/components/install-plugin-button.tsx
@@ -38,6 +38,6 @@ export const InstallPluginButton = (props: InstallPluginButtonProps) => {
className={classNames('flex items-center', className)}
>
{!isLoading ? t('workflow.nodes.agent.pluginInstaller.install') : t('workflow.nodes.agent.pluginInstaller.installing')}
- {!isLoading ? : }
+ {!isLoading ? : }
}