@@ -126,22 +126,10 @@ export const ExternalVariableInputItem = ({
126
126
const { t } = useTranslation ( ) ;
127
127
const { register, control } = variablesForm ;
128
128
129
- return (
130
- < Box key = { item . id } mb = { 4 } pl = { 1 } >
131
- < Box
132
- as = { 'label' }
133
- display = { 'flex' }
134
- position = { 'relative' }
135
- mb = { 1 }
136
- alignItems = { 'center' }
137
- w = { 'full' }
138
- >
129
+ const Label = useMemo ( ( ) => {
130
+ return (
131
+ < Box display = { 'flex' } position = { 'relative' } mb = { 1 } alignItems = { 'center' } w = { 'full' } >
139
132
{ item . label }
140
- { item . required && (
141
- < Box position = { 'absolute' } top = { '-2px' } left = { '-8px' } color = { 'red.500' } >
142
- *
143
- </ Box >
144
- ) }
145
133
{ item . description && < QuestionTip ml = { 1 } label = { item . description } /> }
146
134
{ showTag && (
147
135
< Flex
@@ -155,22 +143,19 @@ export const ExternalVariableInputItem = ({
155
143
rounded = { 'sm' }
156
144
>
157
145
< MyIcon name = { 'common/info' } color = { 'primary.600' } w = { 4 } />
158
- { t ( 'common:core. chat.Variable_Visiable_in_test ' ) }
146
+ { t ( 'chat:variable_invisable_in_share ' ) }
159
147
</ Flex >
160
148
) }
161
149
</ Box >
150
+ ) ;
151
+ } , [ item . description , item . label , showTag , t ] ) ;
152
+
153
+ return (
154
+ < Box key = { item . id } mb = { 4 } pl = { 1 } >
155
+ { Label }
162
156
< Controller
163
157
control = { control }
164
158
name = { `variables.${ item . key } ` }
165
- rules = { {
166
- required : item . required ,
167
- validate : ( value ) => {
168
- if ( item . valueType === WorkflowIOValueTypeEnum . boolean ) {
169
- return value !== undefined ;
170
- }
171
- return ! ! value ;
172
- }
173
- } }
174
159
render = { ( { field : { onChange, value } } ) => {
175
160
if ( item . valueType === WorkflowIOValueTypeEnum . string ) {
176
161
return (
@@ -179,9 +164,7 @@ export const ExternalVariableInputItem = ({
179
164
minH = { 40 }
180
165
maxH = { 160 }
181
166
bg = { 'myGray.50' }
182
- { ...register ( `variables.${ item . key } ` , {
183
- required : item . required
184
- } ) }
167
+ { ...register ( `variables.${ item . key } ` ) }
185
168
/>
186
169
) ;
187
170
}
@@ -231,7 +214,7 @@ const VariableInput = ({
231
214
setValue ( `variables.${ item . key } ` , item . defaultValue ) ;
232
215
}
233
216
} ) ;
234
- } , [ variableList ] ) ;
217
+ } , [ allVariableList , getValues , setValue , variableList ] ) ;
235
218
236
219
return (
237
220
< Box py = { 3 } >
@@ -257,7 +240,7 @@ const VariableInput = ({
257
240
rounded = { 'sm' }
258
241
>
259
242
< MyIcon name = { 'common/info' } color = { 'primary.600' } w = { 4 } />
260
- { t ( 'common:core. chat.Visiable_in_test ' ) }
243
+ { t ( 'chat:variable_invisable_in_share ' ) }
261
244
</ Flex >
262
245
{ externalVariableList . map ( ( item ) => (
263
246
< ExternalVariableInputItem key = { item . id } item = { item } variablesForm = { variablesForm } />
0 commit comments