diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
index 1cf9fc23ef..dddaf1fd40 100644
--- a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
+++ b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx
@@ -16,6 +16,7 @@ import type { StrategyPluginDetail } from '@/app/components/plugins/types'
import type { ToolWithProvider } from '../../../types'
import { CollectionType } from '@/app/components/tools/types'
import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon'
+import type { StrategyStatus } from '../../agent/use-config'
const ExternalNotInstallWarn = () => {
const { t } = useTranslation()
@@ -67,10 +68,11 @@ function formatStrategy(input: StrategyPluginDetail[], getIcon: (i: string) => s
export type AgentStrategySelectorProps = {
value?: Strategy,
onChange: (value?: Strategy) => void,
+ strategyStatus?: StrategyStatus
}
export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => {
- const { value, onChange } = props
+ const { value, onChange, strategyStatus } = props
const [open, setOpen] = useState(false)
const [viewType, setViewType] = useState(ViewType.flat)
const [query, setQuery] = useState('')
@@ -81,8 +83,7 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
if (!list) return []
return list.filter(tool => tool.name.toLowerCase().includes(query.toLowerCase()))
}, [query, list])
- // TODO: should be replaced by real data
- const isExternalInstalled = true
+ const isShowError = (['plugin-not-found', 'strategy-not-found'] as Array).includes(strategyStatus)
const icon = list?.find(
coll => coll.tools?.find(tool => tool.name === value?.agent_strategy_name),
)?.icon as string | undefined
@@ -104,8 +105,8 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
{value?.agent_strategy_label || t('workflow.nodes.agent.strategy.selectTip')}
{value &&
- e.stopPropagation()} size={'small'} />
- {isExternalInstalled ? : }
+ {strategyStatus === 'plugin-not-found' && e.stopPropagation()} size={'small'} />}
+ {isShowError ? : }
}
@@ -143,9 +144,6 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) =>
- {/*
- aaa
-
*/}
})
diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
index 4ec46a6d61..fdd3e4f059 100644
--- a/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
+++ b/web/app/components/workflow/nodes/_base/components/agent-strategy.tsx
@@ -19,6 +19,7 @@ import { useWorkflowStore } from '../../../store'
import { useRenderI18nObject } from '@/hooks/use-i18n'
import type { NodeOutPutVar } from '../../../types'
import type { Node } from 'reactflow'
+import type { StrategyStatus } from '../../agent/use-config'
export type Strategy = {
agent_strategy_provider_name: string
@@ -36,6 +37,7 @@ export type AgentStrategyProps = {
onFormValueChange: (value: ToolVarInputs) => void
nodeOutputVars?: NodeOutPutVar[],
availableNodes?: Node[],
+ strategyStatus: StrategyStatus
}
type CustomSchema = Omit & { type: Type } & Field
@@ -54,7 +56,7 @@ type StringSchema = CustomSchema<'string', {
type CustomField = ToolSelectorSchema | MultipleToolSelectorSchema | StringSchema
export const AgentStrategy = memo((props: AgentStrategyProps) => {
- const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeOutputVars, availableNodes } = props
+ const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeOutputVars, availableNodes, strategyStatus } = props
const { t } = useTranslation()
const defaultModel = useDefaultModel(ModelTypeEnum.textGeneration)
const renderI18nObject = useRenderI18nObject()
@@ -176,7 +178,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
}
}
return
-
+
{
strategy
?
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 1ae5fab864..992dfc05e4 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
@@ -3,14 +3,31 @@ import { RiInstallLine, RiLoader2Line } from '@remixicon/react'
import type { ComponentProps } from 'react'
import classNames from '@/utils/classnames'
import { useTranslation } from 'react-i18next'
+import { useCheckInstalled, useInstallPackageFromMarketPlace } from '@/service/use-plugins'
-type InstallPluginButtonProps = Omit
, 'children'>
+type InstallPluginButtonProps = Omit, 'children' | 'loading'> & {
+ uniqueIdentifier: string
+}
export const InstallPluginButton = (props: InstallPluginButtonProps) => {
- const { loading, className, ...rest } = props
+ const { className, uniqueIdentifier, ...rest } = props
const { t } = useTranslation()
- return