问题
I'm using slots for some situations, and for one of this I need to check if slot recognized a entity or a context variable.
To do it I wrote @myEntity || $MyVar
into the "Check" column, and put $MyVar
into "Save it as" column.
The problem is, when the WCS goes to this slot, my variable$MyVar
is being populated with ||
as a prefix, resulting in || ValueFromMyVar
.
I did not find any restrictions to use variables on slots and also did not find restrictions about operators usage '|| &&'.
Can I use these operators as a slock check condition?
If there is no restriction, Why am I getting the wrong value?
Example Screen:
回答1:
The short answer is what you have above won't work. Slots does not process conditions, as it is trying to match a value.
Also you are checking for a variable, that if it has a value will just put the value back into itself.
If that is your intended action, then you can overload the variable with multiple slots. For example.
This will take the current value if it exists and leave it in the variable. Otherwise it will see if the entity was typed in and then assign it to the variable.
This will work with intents as well, but not conditions.
Disclaimer: This is observed behaviour, but I found no documentation on it. Depending on what development come back to me on it, this may either be a side effect, or a feature.
来源:https://stackoverflow.com/questions/45843805/watson-conversation-service-using-slots-with-operators