Repository: FlowiseAI/Flowise
File: packages/ui/src/ui-component/dialog/AgentflowGeneratorDialog.jsx (JavaScript)

Code before:
            if (inputParam.type === 'credential') {
                updatedData.credential = newValue
                updatedData.inputs = { ...updatedData.inputs, [FLOWISE_CREDENTIAL_ID]: newValue }
            } else {
                updatedData.inputs = { ...updatedData.inputs, [inputParam.name]: newValue }
            }
            updatedData.inputParams = showHideInputParams(updatedData)
            return updatedData
        })
    }

    // Check if all mandatory fields are filled for the selected chat model
    const isMissingRequiredValue = (value) => {
        if (value === undefined || value === null) return true

        // Empty / whitespace-only string should be treated as missing
        if (typeof value === 'string') return value.trim() === ''

        // Empty array should be treated as missing (common for multi-select inputs)
        if (Array.isArray(value)) return value.length === 0

        // IMPORTANT: boolean false and number 0 are valid values, so not missing
        return false
    }

    // Returns { isValid: boolean, missingFields: string[] }
    const checkMandatoryFields = useCallback(() => {
        if (!selectedChatModel || Object.keys(selectedChatModel).length === 0) {
            return { isValid: false, missingFields: [] }
        }

        const inputParams = showHideInputParams(selectedChatModel).filter(
            (inputParam) => !inputParam.hidden && inputParam.display !== false
        )

        const missingFields = []

        for (const inputParam of inputParams) {
            if (!inputParam.optional) {
                if (inputParam.type === 'credential') {
                    // Check for credential in both possible locations
                    const credential = selectedChatModel.credential || selectedChatModel.inputs?.[FLOWISE_CREDENTIAL_ID]
                    if (!credential) {
                        missingFields.push(inputParam.label || 'Credential')
                    }
                } else if (isMissingRequiredValue(selectedChatModel.inputs?.[inputParam.name])) {
                    missingFields.push(inputParam.label || inputParam.name)
                }
            }
        }


Review comment (suggestion):
Use JSDoc format
```suggestion
    /**
     * Check Mandatory Fields
     * @returns { isValid: boolean, missingFields: string[] }
     */
```

Code after:
            if (inputParam.type === 'credential') {
                updatedData.credential = newValue
                updatedData.inputs = { ...updatedData.inputs, [FLOWISE_CREDENTIAL_ID]: newValue }
            } else {
                updatedData.inputs = { ...updatedData.inputs, [inputParam.name]: newValue }
            }
            updatedData.inputParams = showHideInputParams(updatedData)
            return updatedData
        })
    }

    /**
     * Check if all mandatory fields are filled for the selected chat model.
     *
     * @param value
     * @returns {boolean}
     */
    const isMissingRequiredValue = (value) => {
        if (value === undefined || value === null) return true

        // Empty / whitespace-only string should be treated as missing
        if (typeof value === 'string') return value.trim() === ''

        // Empty array should be treated as missing (common for multi-select inputs)
        if (Array.isArray(value)) return value.length === 0

        // IMPORTANT: boolean false and number 0 are valid values, so not missing
        return false
    }

    /**
     * Check Mandatory Fields
     * @returns { isValid: boolean, missingFields: string[] }
     */
    const checkMandatoryFields = useCallback(() => {
        if (!selectedChatModel || Object.keys(selectedChatModel).length === 0) {
            return { isValid: false, missingFields: [] }
        }

        const inputParams = showHideInputParams(selectedChatModel).filter(
            (inputParam) => !inputParam.hidden && inputParam.display !== false
        )

        const missingFields = []

        for (const inputParam of inputParams) {
            if (!inputParam.optional) {
                if (inputParam.type === 'credential') {
                    // Check for credential in both possible locations
                    const credential = selectedChatModel.credential || selectedChatModel.inputs?.[FLOWISE_CREDENTIAL_ID]
                    if (!credential) {