Error executing validation "inline-vld-8ba292d8e1.js" [Error, Cannot read properties of undefined (reading 'trim')]
По моему мнению, botpress назвал функцию проверки до того, как ввод получил значение , что привело к этой ошибке.
код проверки (javaScript):
Код: Выделить всё
function validate(input: { value: string }): boolean {
const normalizedInput = input.value.trim().toLowerCase();
return ["buy", "rent", "offplan"].includes(normalizedInput);
}
журналы (7 элементов - 1 ошибка):
Код: Выделить всё
[Capture] User clicked on a button, so we are skipping the cognitive extraction
Executing capture card custom validation
Error executing validation "inline-vld-8ba292d8e1.js"
[Capture] Field validation failed. Extracted: "Buy". Input: Buy
[Capture] Extraction failed (2/2 attempts)
[Capture] Prompt failed. Maximum number of retries reached.
[Capture] Prompt failed
- Код проверки и информационная карта захвата
- Debugger
[*]
[*]
[*] Я изменил код следующим образом, но проблема сохраняется: < /p>
Код: Выделить всё
const normalizedInput = input?.value?.trim().toLowerCase() || "";
Alternatively, using an Expression Card after each Capture Information Card allows validation without an undefined error, but an invalid value still forces the user to re-enter the information from the start of the Узел .
связанный скриншот:
- карта экспрессии
Подробнее здесь: https://stackoverflow.com/questions/795 ... ned-readin