forked from tuvn86/webapp-conversation
fix: fix option check
This commit is contained in:
parent
1249ea88c9
commit
d009b00012
1 changed files with 4 additions and 1 deletions
|
|
@ -177,7 +177,10 @@ const Welcome: FC<IWelcomeProps> = ({
|
||||||
const canChat = () => {
|
const canChat = () => {
|
||||||
const inputLens = Object.values(inputs).length
|
const inputLens = Object.values(inputs).length
|
||||||
const promptVariablesLens = promptConfig.prompt_variables.length
|
const promptVariablesLens = promptConfig.prompt_variables.length
|
||||||
const emptyInput = inputLens < promptVariablesLens || Object.values(inputs).filter(v => v === '').length > 0
|
const emptyInput = inputLens < promptVariablesLens || Object.entries(inputs).filter(([k, v]) => {
|
||||||
|
const isRequired = promptConfig.prompt_variables.find(item => item.key === k)?.required ?? true
|
||||||
|
return isRequired && v === ''
|
||||||
|
}).length > 0
|
||||||
if (emptyInput) {
|
if (emptyInput) {
|
||||||
logError(t('app.errorMessage.valueOfVarRequired'))
|
logError(t('app.errorMessage.valueOfVarRequired'))
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue