mirror of https://github.com/langgenius/dify.git
feat: if types
This commit is contained in:
parent
bc60cf0a35
commit
cffaf30760
|
|
@ -46,9 +46,9 @@ const Page: FC = () => {
|
|||
/*
|
||||
* TODO: for debug.
|
||||
* 2 directAnswer 3: llm 5: questionClassifier
|
||||
* 7 Code, 8 TemplateTransform 9 http
|
||||
* 6 if else 7 Code, 8 TemplateTransform 9 http
|
||||
*/
|
||||
selectedNodeId='9'
|
||||
selectedNodeId='6'
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
import type { IfElseType } from './types'
|
||||
import { ComparisonOperator, LogicalOperator } from './types'
|
||||
|
||||
export const mockData: IfElseType = {
|
||||
title: 'Test',
|
||||
desc: 'Test',
|
||||
type: 'Test',
|
||||
logical_operator: LogicalOperator.and,
|
||||
conditions: [
|
||||
{
|
||||
id: '1',
|
||||
variable_selector: ['aaa', 'name'],
|
||||
comparison_operator: ComparisonOperator.contains,
|
||||
value: '22',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
variable_selector: ['bbb', 'b', 'c'],
|
||||
comparison_operator: ComparisonOperator.equal,
|
||||
value: 'b',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import type { CommonNodeType, ValueSelector } from '@/app/components/workflow/types'
|
||||
|
||||
export enum LogicalOperator {
|
||||
and = 'and',
|
||||
or = 'or',
|
||||
}
|
||||
|
||||
export enum ComparisonOperator {
|
||||
contains = 'contains',
|
||||
notContains = 'not contains',
|
||||
startWith = 'start with',
|
||||
endWith = 'end with',
|
||||
is = 'is',
|
||||
isNot = 'is not',
|
||||
empty = 'empty',
|
||||
notEmpty = 'not empty',
|
||||
equal = '=',
|
||||
notEqual = '≠',
|
||||
largerThan = '>',
|
||||
lessThan = '<',
|
||||
largerThanOrEqual = '≥',
|
||||
lessThanOrEqual = '≤',
|
||||
isNull = 'is null',
|
||||
isNotNull = 'is not null',
|
||||
}
|
||||
|
||||
export type Condition = {
|
||||
id: string
|
||||
variable_selector: ValueSelector
|
||||
comparison_operator: ComparisonOperator
|
||||
value: string
|
||||
}
|
||||
|
||||
export type IfElseType = CommonNodeType & {
|
||||
logical_operator: LogicalOperator
|
||||
conditions: Condition[]
|
||||
}
|
||||
Loading…
Reference in New Issue