目前,我可以让机器人按照我想要的具体路径,即对话,使一个形式。我知道,如果您在表单激活之前设置了一个插槽,它将跳过所需插槽中的该插槽查找该插槽。
我的action.py设置为捕获姓名、食物、数量和地址,如果通知为空或没有姓名* inform{food:pizza},它将填充表单中需要的所有位置,并将姓名验证为prev_customers
prev_customers = [kevin, ...]示例(stories.md)
我们是否可以验证name:kevin插槽并检查它是否在prev_customers中,而不是跳过该插槽而不进行验证?
在进入下一个required_slot之前,是否尝试验证所有插槽,即使它已经设置?
* inform{name: kevin, food:pizza} // [pizza](food) for [kevin](name)
- action_food_form
- form{"name":"action_food_form'}
- form{"name":null}
.
.
.发布于 2019-06-19 04:55:33
这是一个Rasa开发人员:-)您可以覆盖validate function here。
可能会有这样的东西:
def validate(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
"""Extract and validate value of requested slot.
If nothing was extracted reject execution of the form action.
Subclass this method to add custom validation and rejection logic
"""
# extract other slots that were not requested
# but set by corresponding entity or trigger intent mapping
slot_values = self.extract_other_slots(dispatcher, tracker, domain)
slot_value = slot_values.get("slot_name")
events = []
if not_is_valid(slot_value):
events.append(SlotSet("slot_name", "slot_value"))
# TODO validate others
return eventshttps://stackoverflow.com/questions/56051878
复制相似问题