@@ -329,6 +328,7 @@ function Form<
scope={scope}
disabled={readonly}
value={value[variable]}
+ // selectedTools={value[variable] ? [value[variable]] : []}
onSelect={item => handleFormChange(variable, item as any)}
onDelete={() => handleFormChange(variable, null as any)}
/>
diff --git a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
index 33375e60ec..4374f5cdca 100644
--- a/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/multiple-tool-selector/index.tsx
@@ -9,7 +9,7 @@ import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-sele
import ActionButton from '@/app/components/base/action-button'
import Tooltip from '@/app/components/base/tooltip'
import Divider from '@/app/components/base/divider'
-import type { ToolValue } from '@/app/components/plugins/plugin-detail-panel/tool-selector'
+import type { ToolValue } from '@/app/components/workflow/block-selector/types'
import cn from '@/utils/classnames'
type Props = {
@@ -85,7 +85,7 @@ const MultipleToolSelector = ({
popupContent={tooltip}
needsDelay
>
-
+
)}
{supportCollapse && (
@@ -119,6 +119,7 @@ const MultipleToolSelector = ({
handleConfigure(item, index)}
onDelete={() => handleDelete(index)}
supportEnableSwitch
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
index 8e9966e8b8..b7773b2a6b 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx
@@ -35,7 +35,7 @@ import {
import { useInvalidateInstalledPluginList } from '@/service/use-plugins'
import { usePluginInstalledCheck } from '@/app/components/plugins/plugin-detail-panel/tool-selector/hooks'
import { CollectionType } from '@/app/components/tools/types'
-import type { ToolDefaultValue } from '@/app/components/workflow/block-selector/types'
+import type { ToolDefaultValue, ToolValue } from '@/app/components/workflow/block-selector/types'
import type {
OffsetOptions,
Placement,
@@ -43,20 +43,13 @@ import type {
import { MARKETPLACE_API_PREFIX } from '@/config'
import cn from '@/utils/classnames'
-export type ToolValue = {
- provider_name: string
- tool_name: string
- parameters?: Record
- enabled?: boolean
- extra?: Record
-}
-
type Props = {
disabled?: boolean
placement?: Placement
offset?: OffsetOptions
scope?: string
value?: ToolValue
+ selectedTools?: ToolValue[]
onSelect: (tool: {
provider_name: string
tool_name: string
@@ -72,6 +65,7 @@ type Props = {
}
const ToolSelector: FC = ({
value,
+ selectedTools,
disabled,
placement = 'left',
offset = 4,
@@ -113,6 +107,7 @@ const ToolSelector: FC = ({
provider_name: tool.provider_id,
type: tool.provider_type,
tool_name: tool.tool_name,
+ tool_label: tool.tool_label,
parameters: paramValues,
enabled: tool.is_team_authorization,
extra: {
@@ -215,7 +210,7 @@ const ToolSelector: FC = ({
open={isShow}
icon={currentProvider?.icon || manifestIcon}
providerName={value.provider_name}
- toolName={value.tool_name}
+ toolLabel={value.tool_label || value.tool_name}
showSwitch={supportEnableSwitch}
switchValue={value.enabled}
onSwitchChange={handleEnabledChange}
@@ -264,6 +259,7 @@ const ToolSelector: FC = ({
supportAddCustomTool
onSelect={handleSelectTool}
scope={scope}
+ selectedTools={selectedTools}
/>
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx
index 3e32e66929..e99d06508d 100644
--- a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx
@@ -21,7 +21,7 @@ import cn from '@/utils/classnames'
type Props = {
icon?: any
providerName?: string
- toolName?: string
+ toolLabel?: string
showSwitch?: boolean
switchValue?: boolean
onSwitchChange?: (value: boolean) => void
@@ -41,7 +41,7 @@ const ToolItem = ({
open,
icon,
providerName,
- toolName,
+ toolLabel,
showSwitch,
switchValue,
onSwitchChange,
@@ -83,7 +83,7 @@ const ToolItem = ({
)}
{providerNameText}
-
{toolName}
+
{toolLabel}
{!noAuth && !isError && !uninstalled && !versionMismatch && (
diff --git a/web/app/components/workflow/block-selector/all-tools.tsx b/web/app/components/workflow/block-selector/all-tools.tsx
index 909a350a9f..6f287e2f4f 100644
--- a/web/app/components/workflow/block-selector/all-tools.tsx
+++ b/web/app/components/workflow/block-selector/all-tools.tsx
@@ -8,6 +8,7 @@ import type {
OnSelectBlock,
ToolWithProvider,
} from '../types'
+import type { ToolValue } from './types'
import { ToolTypeEnum } from './types'
import Tools from './tools'
import { useToolTabs } from './hooks'
@@ -32,6 +33,7 @@ type AllToolsProps = {
supportAddCustomTool?: boolean
onAddedCustomTool?: () => void
onShowAddCustomCollectionModal?: () => void
+ selectedTools?: ToolValue[]
}
const AllTools = ({
className,
@@ -44,6 +46,7 @@ const AllTools = ({
customTools,
supportAddCustomTool,
onShowAddCustomCollectionModal,
+ selectedTools,
}: AllToolsProps) => {
const language = useGetLanguage()
const tabs = useToolTabs()
@@ -138,6 +141,7 @@ const AllTools = ({
onSelect={onSelect}
viewType={activeView}
hasSearchText={!!searchText}
+ selectedTools={selectedTools}
/>
{/* Plugins from marketplace */}
void
supportAddCustomTool?: boolean
scope?: string
+ selectedTools?: ToolValue[]
}
const ToolPicker: FC = ({
@@ -47,6 +48,7 @@ const ToolPicker: FC = ({
onSelect,
supportAddCustomTool,
scope = 'all',
+ selectedTools,
}) => {
const { t } = useTranslation()
const [searchText, setSearchText] = useState('')
@@ -160,6 +162,7 @@ const ToolPicker: FC = ({
supportAddCustomTool={supportAddCustomTool}
onAddedCustomTool={handleAddedCustomTool}
onShowAddCustomCollectionModal={showEditCustomCollectionModal}
+ selectedTools={selectedTools}
/>
diff --git a/web/app/components/workflow/block-selector/tool/action-item.tsx b/web/app/components/workflow/block-selector/tool/action-item.tsx
index 8b8e76c69b..411faccb3a 100644
--- a/web/app/components/workflow/block-selector/tool/action-item.tsx
+++ b/web/app/components/workflow/block-selector/tool/action-item.tsx
@@ -8,10 +8,15 @@ import Tooltip from '@/app/components/base/tooltip'
import type { Tool } from '@/app/components/tools/types'
import { useGetLanguage } from '@/context/i18n'
import BlockIcon from '../../block-icon'
+import cn from '@/utils/classnames'
+import { useTranslation } from 'react-i18next'
+import { RiCheckLine } from '@remixicon/react'
+import Badge from '@/app/components/base/badge'
type Props = {
provider: ToolWithProvider
payload: Tool
+ disabled?: boolean
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
}
@@ -19,7 +24,10 @@ const ToolItem: FC
= ({
provider,
payload,
onSelect,
+ disabled,
}) => {
+ const { t } = useTranslation()
+
const language = useGetLanguage()
return (
@@ -42,8 +50,9 @@ const ToolItem: FC = ({
>
{
+ if (disabled) return
const params: Record
= {}
if (payload.parameters) {
payload.parameters.forEach((item) => {
@@ -64,7 +73,15 @@ const ToolItem: FC = ({
})
}}
>
- {payload.label[language]}
+ {payload.label[language]}
+ {disabled &&
+
+ {t('tools.addToolModal.added')}
+
+ }
)
diff --git a/web/app/components/workflow/block-selector/tool/tool-list-flat-view/list.tsx b/web/app/components/workflow/block-selector/tool/tool-list-flat-view/list.tsx
index 04622cabff..ef671ca1f8 100644
--- a/web/app/components/workflow/block-selector/tool/tool-list-flat-view/list.tsx
+++ b/web/app/components/workflow/block-selector/tool/tool-list-flat-view/list.tsx
@@ -3,7 +3,7 @@ import type { FC } from 'react'
import React from 'react'
import type { ToolWithProvider } from '../../../types'
import type { BlockEnum } from '../../../types'
-import type { ToolDefaultValue } from '../../types'
+import type { ToolDefaultValue, ToolValue } from '../../types'
import Tool from '../tool'
import { ViewType } from '../../view-type-select'
import { useMemo } from 'react'
@@ -15,6 +15,7 @@ type Props = {
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
letters: string[]
toolRefs: any
+ selectedTools?: ToolValue[]
}
const ToolViewFlatView: FC = ({
@@ -24,6 +25,7 @@ const ToolViewFlatView: FC = ({
hasSearchText,
onSelect,
toolRefs,
+ selectedTools,
}) => {
const firstLetterToolIds = useMemo(() => {
const res: Record = {}
@@ -51,6 +53,7 @@ const ToolViewFlatView: FC = ({
isShowLetterIndex={isShowLetterIndex}
hasSearchText={hasSearchText}
onSelect={onSelect}
+ selectedTools={selectedTools}
/>
))}
diff --git a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx
index af75754190..65afef8ba9 100644
--- a/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx
+++ b/web/app/components/workflow/block-selector/tool/tool-list-tree-view/item.tsx
@@ -5,13 +5,14 @@ import type { ToolWithProvider } from '../../../types'
import Tool from '../tool'
import type { BlockEnum } from '../../../types'
import { ViewType } from '../../view-type-select'
-import type { ToolDefaultValue } from '../../types'
+import type { ToolDefaultValue, ToolValue } from '../../types'
type Props = {
groupName: string
toolList: ToolWithProvider[]
hasSearchText: boolean
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
+ selectedTools?: ToolValue[]
}
const Item: FC