-
Notifications
You must be signed in to change notification settings - Fork 46
/
actions.py
executable file
·31 lines (24 loc) · 929 Bytes
/
actions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from rasa_core.actions.action import Action
from rasa_core.events import SlotSet
'''
Architecture: how do we make hierarchical conversation? For example:
I want to order a product?
bot: Which product?
A router
bot: which router?
829.
bot: Sure. Consider it done. Here is your confirmation number
'''
class ActionOrderProduct(Action):
def name(self):
return 'action_order_product'
def run(self, dispatcher, tracker, domain):
#prod = tracker.get_slot('product')
router = tracker.get_slot('router')
confirmationNumber = 123456 #later generate through some process
response = """Your product {} is ordered for you. It will be shipped to your address. Your confirmation number is {}""".format(router, confirmationNumber)
dispatcher.utter_message(response)
return [SlotSet('router',router)]