简体   繁体   中英

IBM Watson Assistant - SpelParseException

I have generated an IBM watson assistant(chatbot) JSON and feed it to the system. Now when I type for a specific keyword the IBM chatbot should reply with the configured answer. But in the chatbot I am getting an error like

SpelParseException when evaluating dialog node ID [node_835_210152933]. Condition [@Product:505466163255] could not be parsed. Check the syntax of the expression. SpEL syntax error: Expression [@Product:505466163255] converted to [(entities['Product']?.contains(505466163255))] at position 31: EL1035E: The value '505466163255' cannot be parsed as an int (and there are 1065 more errors in the log)

Is this because IBM parsing the value '505466163255' as int. I have configured it as a string. Can anyone suggest how we can resolve this issue.

The SPEL engine does what is called Autoboxing. When it sees a variable it attempts to cast it. So the error is that it sees an entity number and attempts to cast as an int.

Even if you configure as a string it will still do this unless you force it to change to something else. For example:

"" + 505466163255

Should force it as a string (haven't confirmed).

For what you are doing it may be that there is a better way. For example, if your entity is just a list of product codes, it may be better to determine if the pattern is valid (pattern entity) and then hand off to your application to do the verification of the number itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM