fix: tool icon not show

pull/21369/head
Joel 11 months ago
parent 37c6bdec3d
commit 90e689d282

@ -41,6 +41,7 @@ const useSetWorkflowVarsWithValue = () => {
}) })
const nodeWithVar = { const nodeWithVar = {
nodeId, nodeId,
nodePayload: node.data,
nodeType: node.data.type, nodeType: node.data.type,
title: node.data.title, title: node.data.title,
vars: varsUnderTheNode, vars: varsUnderTheNode,

@ -492,6 +492,8 @@ export const useToolIcon = (data: Node['data']) => {
const customTools = useStore(s => s.customTools) const customTools = useStore(s => s.customTools)
const workflowTools = useStore(s => s.workflowTools) const workflowTools = useStore(s => s.workflowTools)
const toolIcon = useMemo(() => { const toolIcon = useMemo(() => {
if(!data)
return ''
if (data.type === BlockEnum.Tool) { if (data.type === BlockEnum.Tool) {
let targetTools = buildInTools let targetTools = buildInTools
if (data.provider_type === CollectionType.builtIn) if (data.provider_type === CollectionType.builtIn)

@ -20,6 +20,7 @@ import type { currentVarType } from './panel'
import { VarInInspectType } from '@/types/workflow' import { VarInInspectType } from '@/types/workflow'
import type { NodeWithVar, VarInInspect } from '@/types/workflow' import type { NodeWithVar, VarInInspect } from '@/types/workflow'
import cn from '@/utils/classnames' import cn from '@/utils/classnames'
import { useToolIcon } from '../hooks'
type Props = { type Props = {
nodeData?: NodeWithVar nodeData?: NodeWithVar
@ -43,6 +44,8 @@ const Group = ({
const { t } = useTranslation() const { t } = useTranslation()
const [isCollapsed, setIsCollapsed] = useState(false) const [isCollapsed, setIsCollapsed] = useState(false)
const toolIcon = useToolIcon(nodeData?.nodePayload as any)
const isEnv = varType === VarInInspectType.environment const isEnv = varType === VarInInspectType.environment
const isChatVar = varType === VarInInspectType.conversation const isChatVar = varType === VarInInspectType.conversation
const isSystem = varType === VarInInspectType.system const isSystem = varType === VarInInspectType.system
@ -114,6 +117,7 @@ const Group = ({
<BlockIcon <BlockIcon
className='shrink-0' className='shrink-0'
type={nodeData.nodeType} type={nodeData.nodeType}
toolIcon={toolIcon || ''}
size='xs' size='xs'
/> />
<div className='system-xs-medium-uppercase truncate text-text-tertiary'>{nodeData.title}</div> <div className='system-xs-medium-uppercase truncate text-text-tertiary'>{nodeData.title}</div>

@ -1,5 +1,5 @@
import type { Viewport } from 'reactflow' import type { Viewport } from 'reactflow'
import type { BlockEnum, ConversationVariable, Edge, EnvironmentVariable, InputVar, Node, ValueSelector, VarType, Variable } from '@/app/components/workflow/types' import type { BlockEnum, CommonNodeType, ConversationVariable, Edge, EnvironmentVariable, InputVar, Node, ValueSelector, VarType, Variable } from '@/app/components/workflow/types'
import type { TransferMethod } from '@/types/app' import type { TransferMethod } from '@/types/app'
import type { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/components/error-handle/types' import type { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/components/error-handle/types'
import type { BeforeRunFormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form' import type { BeforeRunFormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form'
@ -394,6 +394,7 @@ export type VarInInspect = {
export type NodeWithVar = { export type NodeWithVar = {
nodeId: string nodeId: string
nodePayload: CommonNodeType
nodeType: BlockEnum nodeType: BlockEnum
title: string title: string
vars: VarInInspect[] vars: VarInInspect[]

Loading…
Cancel
Save