当我需要要求用户填补空位时,我正在努力创建一个对话结构。
考虑以下交互。
User: What is the scientific name of Eagles?
Bot: There are 3 eagles. Choose one.
 - greater spotted eagle
 - tawny eagle
 - indian spotted eagle
User: tawny eagle
Bot: Scientific name of Tawny Eagle is Clanga clanga
Stories.md如果只有一个值,这是我的文件。
## Story1
* Scientific_name{'common_name': 'eagles'}
  - action_sci_name
和我的action.py
class ActionSciName(Action):
    def name(self):
        return "action_sci_name"
    def run(self, dispatcher, tracker, domain):
         # below line gives 'Eagles`
         name = tracker.latest_message['entities'][0]['value']
         ## I fetch the value from DB for eagles if they are more than 1
         ## More code here
         response = """There are 3 eagles. Choose one 
                       1. greater spotted eagle
                       2. tawny eagle
                       3. indian spotted eagle"""
         dispatcher.utter_message(response)
         return []
上面的文件可以很好地完成第一部分。但我被困在下一个用户需要输入这 3 个值之间的地方。
意图:
- 科学名称
- Common_name
实体:
- common_name
- sci_name
我看过很多文章和博客,但它们都是非常基础的。他们使用slots但用户在第一行本身输入值。
任何帮助表示赞赏。