Я изо всех сил пытаюсь создать структуру диалога, когда мне нужно попросить пользователя заполнить слоты.
Подумайте о следующем взаимодействии.
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 []
Приведенный выше файл отлично подходит для 1-й части.Но я застрял на следующем, где пользователю нужно ввести значение между этими 3.
Intents:
- Scientific_name
- Common_name
Entities:
Я видел много статей и блогов, но они очень простые.Они используют slots
, но пользователи вводят значение в самой 1-й строке.
Любая помощь приветствуется.