Skip to content

Commit e3daef1

Browse files
authored
chatflow/workflow add field required (#18892)
1 parent 0e0ec46 commit e3daef1

File tree

11 files changed

+26
-3
lines changed

11 files changed

+26
-3
lines changed

web/app/components/workflow/nodes/_base/components/field.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type Props = {
1717
children?: React.JSX.Element | string | null
1818
operations?: React.JSX.Element
1919
inline?: boolean
20+
required?: boolean
2021
}
2122

2223
const Field: FC<Props> = ({
@@ -28,6 +29,7 @@ const Field: FC<Props> = ({
2829
operations,
2930
inline,
3031
supportFold,
32+
required,
3133
}) => {
3234
const [fold, {
3335
toggle: toggleFold,
@@ -38,7 +40,9 @@ const Field: FC<Props> = ({
3840
onClick={() => supportFold && toggleFold()}
3941
className={cn('flex items-center justify-between', supportFold && 'cursor-pointer')}>
4042
<div className='flex h-6 items-center'>
41-
<div className={cn(isSubTitle ? 'system-xs-medium-uppercase text-text-tertiary' : 'system-sm-semibold-uppercase text-text-secondary')}>{title}</div>
43+
<div className={cn(isSubTitle ? 'system-xs-medium-uppercase text-text-tertiary' : 'system-sm-semibold-uppercase text-text-secondary')}>
44+
{title} {required && <span className='text-text-destructive'>*</span>}
45+
</div>
4246
{tooltip && (
4347
<Tooltip
4448
popupContent={tooltip}

web/app/components/workflow/nodes/agent/panel.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
8181
const resetEditor = useStore(s => s.setControlPromptEditorRerenderKey)
8282

8383
return <div className='my-2'>
84-
<Field title={t('workflow.nodes.agent.strategy.label')} className='px-4 py-2' tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
84+
<Field
85+
required
86+
title={t('workflow.nodes.agent.strategy.label')}
87+
className='px-4 py-2'
88+
tooltip={t('workflow.nodes.agent.strategy.tooltip')} >
8589
<AgentStrategy
8690
strategy={inputs.agent_strategy_name ? {
8791
agent_strategy_provider_name: inputs.agent_strategy_provider_name!,

web/app/components/workflow/nodes/code/panel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ const Panel: FC<NodePanelProps<CodeNodeType>> = ({
117117
operations={
118118
<AddButton onClick={handleAddOutputVariable} />
119119
}
120+
required
120121
>
121-
122122
<OutputVarList
123123
readonly={readOnly}
124124
outputs={inputs.outputs}

web/app/components/workflow/nodes/document-extractor/panel.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ const Panel: FC<NodePanelProps<DocExtractorNodeType>> = ({
6464
<div className='space-y-4 px-4 pb-4'>
6565
<Field
6666
title={t(`${i18nPrefix}.inputVar`)}
67+
required
6768
>
6869
<>
6970
<VarReferencePicker

web/app/components/workflow/nodes/http/panel.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const Panel: FC<NodePanelProps<HttpNodeType>> = ({
6969
<div className='space-y-4 px-4 pb-4'>
7070
<Field
7171
title={t(`${i18nPrefix}.api`)}
72+
required
7273
operations={
7374
<div className='flex'>
7475
<div
@@ -126,6 +127,7 @@ const Panel: FC<NodePanelProps<HttpNodeType>> = ({
126127
</Field>
127128
<Field
128129
title={t(`${i18nPrefix}.body`)}
130+
required
129131
>
130132
<EditBody
131133
nodeId={id}

web/app/components/workflow/nodes/iteration/panel.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const Panel: FC<NodePanelProps<IterationNodeType>> = ({
7373
<div className='space-y-4 px-4 pb-4'>
7474
<Field
7575
title={t(`${i18nPrefix}.input`)}
76+
required
7677
operations={(
7778
<div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div>
7879
)}
@@ -91,6 +92,7 @@ const Panel: FC<NodePanelProps<IterationNodeType>> = ({
9192
<div className='mt-2 space-y-4 px-4 pb-4'>
9293
<Field
9394
title={t(`${i18nPrefix}.output`)}
95+
required
9496
operations={(
9597
<div className='system-2xs-medium-uppercase flex h-[18px] items-center rounded-[5px] border border-divider-deep px-1 capitalize text-text-tertiary'>Array</div>
9698
)}

web/app/components/workflow/nodes/knowledge-retrieval/panel.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const Panel: FC<NodePanelProps<KnowledgeRetrievalNodeType>> = ({
8181
{/* {JSON.stringify(inputs, null, 2)} */}
8282
<Field
8383
title={t(`${i18nPrefix}.queryVariable`)}
84+
required
8485
>
8586
<VarReferencePicker
8687
nodeId={id}
@@ -94,6 +95,7 @@ const Panel: FC<NodePanelProps<KnowledgeRetrievalNodeType>> = ({
9495

9596
<Field
9697
title={t(`${i18nPrefix}.knowledge`)}
98+
required
9799
operations={
98100
<div className='flex items-center space-x-1'>
99101
<RetrievalConfig

web/app/components/workflow/nodes/list-operator/panel.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
4646
<div className='space-y-4 px-4'>
4747
<Field
4848
title={t(`${i18nPrefix}.inputVar`)}
49+
required
4950
>
5051
<VarReferencePicker
5152
readonly={readOnly}

web/app/components/workflow/nodes/llm/panel.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
147147
<div className='space-y-4 px-4 pb-4'>
148148
<Field
149149
title={t(`${i18nPrefix}.model`)}
150+
required
150151
>
151152
<ModelParameterModal
152153
popupClassName='!w-[387px]'

web/app/components/workflow/nodes/parameter-extractor/panel.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
115115
<div className='space-y-4 px-4'>
116116
<Field
117117
title={t(`${i18nCommonPrefix}.model`)}
118+
required
118119
>
119120
<ModelParameterModal
120121
popupClassName='!w-[387px]'
@@ -133,6 +134,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
133134
</Field>
134135
<Field
135136
title={t(`${i18nPrefix}.inputVar`)}
137+
required
136138
>
137139
<>
138140
<VarReferencePicker
@@ -157,6 +159,7 @@ const Panel: FC<NodePanelProps<ParameterExtractorNodeType>> = ({
157159
/>
158160
<Field
159161
title={t(`${i18nPrefix}.extractParameters`)}
162+
required
160163
operations={
161164
!readOnly
162165
? (

web/app/components/workflow/nodes/question-classifier/panel.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
103103
<div className='space-y-4 px-4'>
104104
<Field
105105
title={t(`${i18nPrefix}.model`)}
106+
required
106107
>
107108
<ModelParameterModal
108109
popupClassName='!w-[387px]'
@@ -121,6 +122,7 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
121122
</Field>
122123
<Field
123124
title={t(`${i18nPrefix}.inputVars`)}
125+
required
124126
>
125127
<VarReferencePicker
126128
readonly={readOnly}
@@ -143,6 +145,7 @@ const Panel: FC<NodePanelProps<QuestionClassifierNodeType>> = ({
143145
/>
144146
<Field
145147
title={t(`${i18nPrefix}.class`)}
148+
required
146149
>
147150
<ClassList
148151
nodeId={id}

0 commit comments

Comments
 (0)