mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +00:00
feat: list filter type and outpt var
This commit is contained in:
@@ -27,7 +27,7 @@ const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({
|
||||
<div className='mt-2'>
|
||||
<div className='px-4 pb-4 space-y-4'>
|
||||
<Field
|
||||
title={t(`${i18nPrefix}.inputVars`)}
|
||||
title={t(`${i18nPrefix}.inputVar`)}
|
||||
>
|
||||
<VarReferencePicker
|
||||
readonly={readOnly}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { type ListFilterNodeType } from './types'
|
||||
import { isENV, isSystemVar } from '@/app/components/workflow/nodes/_base/components/variable/utils'
|
||||
import { BlockEnum, type Node, type NodeProps } from '@/app/components/workflow/types'
|
||||
|
||||
const i18nPrefix = 'workflow.nodes.assigner'
|
||||
const i18nPrefix = 'workflow.nodes.listFilter'
|
||||
|
||||
const NodeComponent: FC<NodeProps<ListFilterNodeType>> = ({
|
||||
data,
|
||||
@@ -26,7 +26,7 @@ const NodeComponent: FC<NodeProps<ListFilterNodeType>> = ({
|
||||
const varName = isSystem ? `sys.${variable[variable.length - 1]}` : variable.slice(1).join('.')
|
||||
return (
|
||||
<div className='relative px-3'>
|
||||
<div className='mb-1 system-2xs-medium-uppercase text-text-tertiary'>{t(`${i18nPrefix}.assignedVariable`)}</div>
|
||||
<div className='mb-1 system-2xs-medium-uppercase text-text-tertiary'>{t(`${i18nPrefix}.inputVar`)}</div>
|
||||
<NodeVariableItem
|
||||
node={node as Node}
|
||||
isEnv={isEnv}
|
||||
|
||||
@@ -2,12 +2,13 @@ import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import VarReferencePicker from '../_base/components/variable/var-reference-picker'
|
||||
import OutputVars, { VarItem } from '../_base/components/output-vars'
|
||||
import useConfig from './use-config'
|
||||
import type { ListFilterNodeType } from './types'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
import { type NodePanelProps } from '@/app/components/workflow/types'
|
||||
|
||||
const i18nPrefix = 'workflow.nodes.docExtractor'
|
||||
const i18nPrefix = 'workflow.nodes.listFilter'
|
||||
|
||||
const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
||||
id,
|
||||
@@ -26,7 +27,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
||||
<div className='mt-2'>
|
||||
<div className='px-4 pb-4 space-y-4'>
|
||||
<Field
|
||||
title={t(`${i18nPrefix}.assignedVariable`)}
|
||||
title={t(`${i18nPrefix}.inputVar`)}
|
||||
>
|
||||
<VarReferencePicker
|
||||
readonly={readOnly}
|
||||
@@ -38,6 +39,27 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
<div className='px-4 pt-4 pb-2'>
|
||||
<OutputVars>
|
||||
<>
|
||||
<VarItem
|
||||
name='result'
|
||||
type='Array[x]'
|
||||
description={t(`${i18nPrefix}.outputVars.result`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='first_record'
|
||||
type='x'
|
||||
description={t(`${i18nPrefix}.outputVars.first_record`)}
|
||||
/>
|
||||
<VarItem
|
||||
name='last_record'
|
||||
type='x'
|
||||
description={t(`${i18nPrefix}.outputVars.last_record`)}
|
||||
/>
|
||||
</>
|
||||
</OutputVars>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
||||
|
||||
export enum OrderBy {
|
||||
ASC = 'asc',
|
||||
DESC = 'desc',
|
||||
}
|
||||
|
||||
export type ListFilterNodeType = CommonNodeType & {
|
||||
variable: ValueSelector
|
||||
filterBy: []
|
||||
orderBy: {
|
||||
enabled: boolean
|
||||
key: ValueSelector | string
|
||||
value: OrderBy
|
||||
}
|
||||
limit: {
|
||||
enabled: boolean
|
||||
value: number
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,11 +494,19 @@ const translation = {
|
||||
},
|
||||
},
|
||||
docExtractor: {
|
||||
inputVars: 'Input Variables',
|
||||
inputVar: 'Input Variable',
|
||||
outputVars: {
|
||||
text: 'Extracted text',
|
||||
},
|
||||
},
|
||||
listFilter: {
|
||||
inputVar: 'Input Variable',
|
||||
outputVars: {
|
||||
result: 'Filter result',
|
||||
first_record: 'First record',
|
||||
last_record: 'Last record',
|
||||
},
|
||||
},
|
||||
},
|
||||
tracing: {
|
||||
stopBy: 'Stop by {{user}}',
|
||||
|
||||
@@ -494,11 +494,19 @@ const translation = {
|
||||
},
|
||||
},
|
||||
docExtractor: {
|
||||
inputVars: '输入变量',
|
||||
inputVar: '输入变量',
|
||||
outputVars: {
|
||||
text: '提取的文本',
|
||||
},
|
||||
},
|
||||
listFilter: {
|
||||
inputVar: '输入变量',
|
||||
outputVars: {
|
||||
result: '过滤结果',
|
||||
first_record: '第一条记录',
|
||||
last_record: '最后一条记录',
|
||||
},
|
||||
},
|
||||
},
|
||||
tracing: {
|
||||
stopBy: '由{{user}}终止',
|
||||
|
||||
Reference in New Issue
Block a user