e.stopPropagation()}>
- {(activeTab === TabsEnum.Start || activeTab === TabsEnum.Blocks) && (
+ {activeTab === TabsEnum.Start && (
+
+ )}
+ {activeTab === TabsEnum.Blocks && (
= ({
tags={tags}
onTagsChange={setTags}
size='small'
- placeholder={t('plugin.searchTools')!}
+ placeholder={searchPlaceholder}
inputClassName='grow'
/>
)}
diff --git a/web/app/components/workflow/block-selector/start-blocks.tsx b/web/app/components/workflow/block-selector/start-blocks.tsx
index 35d6aefeb7..8cbbb110a0 100644
--- a/web/app/components/workflow/block-selector/start-blocks.tsx
+++ b/web/app/components/workflow/block-selector/start-blocks.tsx
@@ -1,6 +1,7 @@
import {
memo,
useCallback,
+ useEffect,
useMemo,
} from 'react'
import { useNodes } from 'reactflow'
@@ -17,12 +18,14 @@ type StartBlocksProps = {
searchText: string
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
availableBlocksTypes?: BlockEnum[]
+ onContentStateChange?: (hasContent: boolean) => void
}
const StartBlocks = ({
searchText,
onSelect,
availableBlocksTypes = [],
+ onContentStateChange,
}: StartBlocksProps) => {
const { t } = useTranslation()
const nodes = useNodes()
@@ -48,6 +51,10 @@ const StartBlocks = ({
const isEmpty = filteredBlocks.length === 0
+ useEffect(() => {
+ onContentStateChange?.(!isEmpty)
+ }, [isEmpty, onContentStateChange])
+
const renderBlock = useCallback((block: typeof START_BLOCKS[0]) => (
), [nodesExtraData, onSelect, t])
+ if (isEmpty)
+ return null
+
return (
-
- {isEmpty && (
-
- {t('workflow.tabs.noResult')}
-
- )}
- {!isEmpty && (
-
- {filteredBlocks.map((block, index) => (
-
- {renderBlock(block)}
- {block.type === BlockEnumValues.Start && index < filteredBlocks.length - 1 && (
-
- )}
-
- ))}
-
- )}
+
+
+ {filteredBlocks.map((block, index) => (
+
+ {renderBlock(block)}
+ {block.type === BlockEnumValues.Start && index < filteredBlocks.length - 1 && (
+
+ )}
+
+ ))}
+
)
}
diff --git a/web/app/components/workflow/block-selector/tabs.tsx b/web/app/components/workflow/block-selector/tabs.tsx
index 3d628688c4..3842dfa6c2 100644
--- a/web/app/components/workflow/block-selector/tabs.tsx
+++ b/web/app/components/workflow/block-selector/tabs.tsx
@@ -72,6 +72,7 @@ const Tabs: FC
= ({
searchText={searchText}
onSelect={onSelect}
availableBlocksTypes={availableBlocksTypes}
+ tags={tags}
/>
)
diff --git a/web/app/components/workflow/block-selector/trigger-plugin-selector.tsx b/web/app/components/workflow/block-selector/trigger-plugin-selector.tsx
index bdb96da55a..141bf318ec 100644
--- a/web/app/components/workflow/block-selector/trigger-plugin-selector.tsx
+++ b/web/app/components/workflow/block-selector/trigger-plugin-selector.tsx
@@ -7,16 +7,22 @@ import type { ToolDefaultValue } from './types'
type TriggerPluginSelectorProps = {
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
searchText: string
+ onContentStateChange?: (hasContent: boolean) => void
+ tags?: string[]
}
const TriggerPluginSelector = ({
onSelect,
searchText,
+ onContentStateChange,
+ tags = [],
}: TriggerPluginSelectorProps) => {
return (
)
}
diff --git a/web/app/components/workflow/block-selector/trigger-plugin/list.tsx b/web/app/components/workflow/block-selector/trigger-plugin/list.tsx
index 293a516f3f..4bcb93a6aa 100644
--- a/web/app/components/workflow/block-selector/trigger-plugin/list.tsx
+++ b/web/app/components/workflow/block-selector/trigger-plugin/list.tsx
@@ -1,5 +1,5 @@
'use client'
-import { memo, useMemo } from 'react'
+import { memo, useEffect, useMemo } from 'react'
import { useAllBuiltInTools } from '@/service/use-tools'
import TriggerPluginItem from './item'
import type { BlockEnum } from '../../types'
@@ -9,11 +9,15 @@ import { useGetLanguage } from '@/context/i18n'
type TriggerPluginListProps = {
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
searchText: string
+ onContentStateChange?: (hasContent: boolean) => void
+ tags?: string[]
}
const TriggerPluginList = ({
onSelect,
searchText,
+ onContentStateChange,
+ tags = [],
}: TriggerPluginListProps) => {
const { data: buildInTools = [] } = useAllBuiltInTools()
const language = useGetLanguage()
@@ -22,16 +26,26 @@ const TriggerPluginList = ({
return buildInTools.filter((toolWithProvider) => {
if (toolWithProvider.tools.length === 0) return false
- if (!searchText) return true
+ // Filter by search text
+ if (searchText) {
+ const matchesSearch = toolWithProvider.name.toLowerCase().includes(searchText.toLowerCase())
+ || toolWithProvider.tools.some(tool =>
+ tool.label[language].toLowerCase().includes(searchText.toLowerCase()),
+ )
+ if (!matchesSearch) return false
+ }
- return toolWithProvider.name.toLowerCase().includes(searchText.toLowerCase())
- || toolWithProvider.tools.some(tool =>
- tool.label[language].toLowerCase().includes(searchText.toLowerCase()),
- )
+ return true
})
}, [buildInTools, searchText, language])
- if (!triggerPlugins.length)
+ const hasContent = triggerPlugins.length > 0
+
+ useEffect(() => {
+ onContentStateChange?.(hasContent)
+ }, [hasContent, onContentStateChange])
+
+ if (!hasContent)
return null
return (
diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts
index 6683496578..8e0e0c55e6 100644
--- a/web/i18n/en-US/workflow.ts
+++ b/web/i18n/en-US/workflow.ts
@@ -246,6 +246,8 @@ const translation = {
'transform': 'Transform',
'utilities': 'Utilities',
'noResult': 'No match found',
+ 'noPluginsFound': 'No plugins were found',
+ 'requestToCommunity': 'Requests to the community',
'agent': 'Agent Strategy',
'allAdded': 'All added',
'addAll': 'Add all',
diff --git a/web/i18n/ja-JP/workflow.ts b/web/i18n/ja-JP/workflow.ts
index 93d2e2bf01..28a29dc610 100644
--- a/web/i18n/ja-JP/workflow.ts
+++ b/web/i18n/ja-JP/workflow.ts
@@ -244,6 +244,8 @@ const translation = {
'transform': '変換',
'utilities': 'ツール',
'noResult': '該当なし',
+ 'noPluginsFound': 'プラグインが見つかりません',
+ 'requestToCommunity': 'コミュニティにリクエスト',
'plugin': 'プラグイン',
'agent': 'エージェント戦略',
'addAll': 'すべてを追加する',
diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts
index b49af48482..16c5347c82 100644
--- a/web/i18n/zh-Hans/workflow.ts
+++ b/web/i18n/zh-Hans/workflow.ts
@@ -245,6 +245,8 @@ const translation = {
'transform': '转换',
'utilities': '工具',
'noResult': '未找到匹配项',
+ 'noPluginsFound': '未找到插件',
+ 'requestToCommunity': '向社区反馈',
'agent': 'Agent 策略',
'allAdded': '已添加全部',
'addAll': '添加全部',