Commit cffaf307 authored by Joel's avatar Joel

feat: if types

parent bc60cf0a
...@@ -46,9 +46,9 @@ const Page: FC = () => { ...@@ -46,9 +46,9 @@ const Page: FC = () => {
/* /*
* TODO: for debug. * TODO: for debug.
* 2 directAnswer 3: llm 5: questionClassifier * 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> </div>
) )
......
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',
},
],
}
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[]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment