mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 18:27:15 +08:00
fix: node selector
This commit is contained in:
parent
66176c4d71
commit
e7e12c1d2e
@ -47,7 +47,7 @@ const VariableOrConstantInputField = ({
|
|||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
className='mr-1 shrink-0'
|
className='mr-1 shrink-0'
|
||||||
value={variableType}
|
value={variableType}
|
||||||
onChange={handleVariableOrConstantChange}
|
onChange={handleVariableOrConstantChange as any}
|
||||||
options={options as any}
|
options={options as any}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -29,8 +29,8 @@ const Blocks = ({
|
|||||||
|
|
||||||
const groups = useMemo(() => {
|
const groups = useMemo(() => {
|
||||||
return BLOCK_CLASSIFICATIONS.reduce((acc, classification) => {
|
return BLOCK_CLASSIFICATIONS.reduce((acc, classification) => {
|
||||||
const list = groupBy(blocks, 'classification')[classification].filter((block) => {
|
const list = groupBy(blocks, 'metaData.classification')[classification].filter((block) => {
|
||||||
return block.title.toLowerCase().includes(searchText.toLowerCase()) && availableBlocksTypes.includes(block.type)
|
return block.metaData.title.toLowerCase().includes(searchText.toLowerCase()) && availableBlocksTypes.includes(block.metaData.type)
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -42,7 +42,7 @@ const Blocks = ({
|
|||||||
const isEmpty = Object.values(groups).every(list => !list.length)
|
const isEmpty = Object.values(groups).every(list => !list.length)
|
||||||
|
|
||||||
const renderGroup = useCallback((classification: string) => {
|
const renderGroup = useCallback((classification: string) => {
|
||||||
const list = groups[classification].sort((a, b) => a.sort - b.sort)
|
const list = groups[classification].sort((a, b) => a.metaData.sort - b.metaData.sort)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -59,7 +59,7 @@ const Blocks = ({
|
|||||||
{
|
{
|
||||||
list.map(block => (
|
list.map(block => (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
key={block.type}
|
key={block.metaData.type}
|
||||||
position='right'
|
position='right'
|
||||||
popupClassName='w-[200px]'
|
popupClassName='w-[200px]'
|
||||||
popupContent={(
|
popupContent={(
|
||||||
@ -67,25 +67,25 @@ const Blocks = ({
|
|||||||
<BlockIcon
|
<BlockIcon
|
||||||
size='md'
|
size='md'
|
||||||
className='mb-2'
|
className='mb-2'
|
||||||
type={block.type}
|
type={block.metaData.type}
|
||||||
/>
|
/>
|
||||||
<div className='system-md-medium mb-1 text-text-primary'>{block.title}</div>
|
<div className='system-md-medium mb-1 text-text-primary'>{block.metaData.title}</div>
|
||||||
<div className='system-xs-regular text-text-tertiary'>{block.description}</div>
|
<div className='system-xs-regular text-text-tertiary'>{block.metaData.description}</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
key={block.type}
|
key={block.metaData.type}
|
||||||
className='flex h-8 w-full cursor-pointer items-center rounded-lg px-3 hover:bg-state-base-hover'
|
className='flex h-8 w-full cursor-pointer items-center rounded-lg px-3 hover:bg-state-base-hover'
|
||||||
onClick={() => onSelect(block.type)}
|
onClick={() => onSelect(block.metaData.type)}
|
||||||
>
|
>
|
||||||
<BlockIcon
|
<BlockIcon
|
||||||
className='mr-2 shrink-0'
|
className='mr-2 shrink-0'
|
||||||
type={block.type}
|
type={block.metaData.type}
|
||||||
/>
|
/>
|
||||||
<div className='grow text-sm text-text-secondary'>{block.title}</div>
|
<div className='grow text-sm text-text-secondary'>{block.metaData.title}</div>
|
||||||
{
|
{
|
||||||
block.type === BlockEnum.LoopEnd && (
|
block.metaData.type === BlockEnum.LoopEnd && (
|
||||||
<Badge
|
<Badge
|
||||||
text={t('workflow.nodes.loop.loopNode')}
|
text={t('workflow.nodes.loop.loopNode')}
|
||||||
className='ml-2 shrink-0'
|
className='ml-2 shrink-0'
|
||||||
|
|||||||
@ -11,13 +11,16 @@ const NodeSelectorWrapper = (props: NodeSelectorProps) => {
|
|||||||
const result = availableNodesMetaData?.nodes || []
|
const result = availableNodesMetaData?.nodes || []
|
||||||
|
|
||||||
return result.filter((block) => {
|
return result.filter((block) => {
|
||||||
if (block.type === BlockEnum.Start)
|
if (block.metaData.type === BlockEnum.Start)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (block.type === BlockEnum.IterationStart)
|
if (block.metaData.type === BlockEnum.DataSource)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (block.type === BlockEnum.LoopStart)
|
if (block.metaData.type === BlockEnum.IterationStart)
|
||||||
|
return false
|
||||||
|
|
||||||
|
if (block.metaData.type === BlockEnum.LoopStart)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user