feat: introduce trigger functionality (#27644)

Signed-off-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: Stream <Stream_2@qq.com>
Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com>
Co-authored-by: zhsama <torvalds@linux.do>
Co-authored-by: Harry <xh001x@hotmail.com>
Co-authored-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: yessenia <yessenia.contact@gmail.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: WTW0313 <twwu@dify.ai>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Yeuoly
2025-11-12 17:59:37 +08:00
committed by GitHub
parent ca7794305b
commit b76e17b25d
785 changed files with 41186 additions and 3725 deletions

View File

@@ -1,9 +1,4 @@
import {
memo,
useMemo,
useRef,
} from 'react'
import { useTranslation } from 'react-i18next'
import { memo, useMemo, useRef } from 'react'
import type { BlockEnum, ToolWithProvider } from '../types'
import IndexBar, { groupItems } from './index-bar'
import type { ToolDefaultValue, ToolValue } from './types'
@@ -16,7 +11,7 @@ import ToolListFlatView from './tool/tool-list-flat-view/list'
import classNames from '@/utils/classnames'
type ToolsProps = {
onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void
onSelect: (type: BlockEnum, tool: ToolDefaultValue) => void
canNotSelectMultiple?: boolean
onSelectMultiple?: (type: BlockEnum, tools: ToolDefaultValue[]) => void
tools: ToolWithProvider[]
@@ -28,7 +23,6 @@ type ToolsProps = {
indexBarClassName?: string
selectedTools?: ToolValue[]
canChooseMCPTool?: boolean
isShowRAGRecommendations?: boolean
}
const Tools = ({
onSelect,
@@ -43,10 +37,8 @@ const Tools = ({
indexBarClassName,
selectedTools,
canChooseMCPTool,
isShowRAGRecommendations = false,
}: ToolsProps) => {
// const tools: any = []
const { t } = useTranslation()
const language = useGetLanguage()
const isFlatView = viewType === ViewType.flat
const isShowLetterIndex = isFlatView && tools.length > 10
@@ -100,21 +92,11 @@ const Tools = ({
return (
<div className={classNames('max-w-[100%] p-1', className)}>
{
!tools.length && hasSearchText && (
<div className='mt-2 flex h-[22px] items-center px-3 text-xs font-medium text-text-secondary'>{t('workflow.tabs.noResult')}</div>
)
}
{!tools.length && !hasSearchText && (
<div className='py-10'>
<Empty type={toolType!} isAgent={isAgent} />
</div>
)}
{!!tools.length && isShowRAGRecommendations && (
<div className='system-xs-medium px-3 pb-0.5 pt-1 text-text-tertiary'>
{t('tools.allTools')}
</div>
)}
{!!tools.length && (
isFlatView ? (
<ToolListFlatView