Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 5870899

Browse files
author
nileena shaju
committed
hotel bot
1 parent 4df1dcc commit 5870899

File tree

13 files changed

+1038
-0
lines changed

13 files changed

+1038
-0
lines changed

06_hotel_bot/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Hotel Chatbot Template
2+
3+
### How to use it?
4+
Please follow the steps [as mentioned here](https://github.com/cedextech/Rasa-Chatbot-Templates/blob/master/README.md)

06_hotel_bot/compressed.zip

9.77 KB
Binary file not shown.

06_hotel_bot/screenshot01.png

286 KB
Loading

06_hotel_bot/screenshot02.png

72 KB
Loading

06_hotel_bot/screenshot03.png

299 KB
Loading

06_hotel_bot/screenshot04.png

24.8 KB
Loading

06_hotel_bot/screenshot05.png

26.2 KB
Loading

06_hotel_bot/src/actions.py

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
2+
from typing import Dict, Text, Any, List, Union, Optional
3+
4+
from rasa_sdk import Tracker
5+
from rasa_sdk.executor import CollectingDispatcher
6+
7+
from rasa_sdk import Action
8+
from rasa_sdk.forms import FormAction
9+
10+
11+
12+
class NearestAttraction(Action):
13+
def name(self):
14+
"""name of the custom action"""
15+
return "action_nearest_attractions"
16+
17+
def run(self,dispatcher,tracker,domain):
18+
gt = {
19+
"attachment": {
20+
"type": "template",
21+
"payload": {
22+
"template_type": "generic",
23+
"elements": [
24+
{
25+
"title": "Marine Drive",
26+
"image_url":"https://www.trawell.in/admin/images/upload/486072642MarineDrive_Main.jpg",
27+
"subtitle": "Marine Drive is a buzzing waterfront district known for the Marine Walkway, popular for evening strolls,..",
28+
"buttons": [
29+
{
30+
"type": "postback",
31+
"payload": "/marine_drive",
32+
"title": "Read More"
33+
},
34+
{
35+
"type": "web_url",
36+
"url": "https://www.google.com/maps/d/viewer?ie=UTF8&source=embed&oe=UTF8&msa=0&mid=1TQ2nVI6cF8LtWZxKIdXSkIJs5JI&ll=49.21193400000003%2C-123.10863&z=17",
37+
"title": "Location"
38+
},
39+
]
40+
},
41+
{
42+
"title": "Mattancherry",
43+
"image_url":"https://th.thgim.com/migration_catalog/article11297834.ece/alternates/FREE_660/MATTANCHERRY_PALACE",
44+
"subtitle": "Historic Mattancherry is known for 16th-century Mattancherry Palace, built by the Portuguese in traditional Keralan style",
45+
"buttons": [
46+
{
47+
"type": "postback",
48+
"payload": "/mattancherry",
49+
"title": "Read More"
50+
},
51+
{
52+
"type": "web_url",
53+
"url": "https://www.google.com/maps/place/Mattancherry,+Kochi,+Kerala/@9.9601158,76.2455098,15z/data=!3m1!4b1!4m5!3m4!1s0x3b086d4f2efb0045:0xbfbce1be3e2c1399!8m2!3d9.9578326!4d76.2555324",
54+
"title": "Location"
55+
},
56+
]
57+
},
58+
{
59+
"title": "Fort Kochi",
60+
"image_url":"https://monicasuricom.files.wordpress.com/2017/02/shutterstock_104171108.jpg",
61+
"subtitle": "A charming seaside area, Fort Kochi is known for its Dutch, Portuguese, and British colonial architecture",
62+
"buttons": [
63+
{
64+
"type": "postback",
65+
"payload": "/fort_kochi",
66+
"title": "Read More"
67+
},
68+
{
69+
"type": "web_url",
70+
"url": "https://www.google.com/maps/place/Fort+Kochi,+Kochi,+Kerala/@9.9624501,76.2337644,16z/data=!4m5!3m4!1s0x3b086d314f0b178d:0xc545233f390db43b!8m2!3d9.9657787!4d76.2421147",
71+
"title": "Location"
72+
},
73+
]
74+
},
75+
76+
]
77+
}
78+
}
79+
}
80+
dispatcher.utter_custom_json(gt)
81+
return []
82+
class BookRooms(Action):
83+
def name(self):
84+
"""name of the custom action"""
85+
return "action_book_rooms"
86+
87+
def run(self,dispatcher,tracker,domain):
88+
gt = {
89+
"attachment": {
90+
"type": "template",
91+
"payload": {
92+
"template_type": "generic",
93+
"elements": [
94+
{
95+
"title": "Deluxe Room",
96+
"image_url":"https://d2e5ushqwiltxm.cloudfront.net/wp-content/uploads/sites/125/2017/05/25023446/Rooms-Suites-Section-2nd-Room-Deluxe-Room.jpg",
97+
"subtitle": "These Deluxe Rooms let you relax as you admire a beautiful view of the pool. Stay connected as you enjoy our free WiFi and watch movies with our 32-inch LCD TV and DVD player.",
98+
"buttons": [
99+
{
100+
"type": "postback",
101+
"payload": "/dulex_room_details",
102+
"title": "Read More"
103+
},
104+
{
105+
"type": "postback",
106+
"payload": "/book_room_now",
107+
"title": "Book Now"
108+
},
109+
]
110+
},
111+
{
112+
"title": "Junior Suite",
113+
"image_url":"https://www.discoverysuites.com/files/2015/06/Junior-Suite-Deluxe.jpg",
114+
"subtitle": "Large bedroom with exquisitely embroidered queen or king size bed. Elegant, luxury decor with rich fabrics. Separate sitting room with sofa and armchairs.",
115+
"buttons": [
116+
{
117+
"type": "postback",
118+
"payload": "/junior_suite_details",
119+
"title": "Read More"
120+
},
121+
{
122+
"type": "postback",
123+
"payload": "/book_room_now",
124+
"title": "Book Now"
125+
},
126+
]
127+
},
128+
{
129+
"title": "Club Suite",
130+
"image_url":"https://media-cdn.tripadvisor.com/media/photo-s/12/77/d8/18/club-suite-living-room.jpg",
131+
"subtitle": "The Club Suite is the ideal choice for a comfortable and lavish stay for both small families and business travelers alike. The gently soothing views and the calming ambiance of the suite add to an enriching experience for our guests.",
132+
"buttons": [
133+
{
134+
"type": "postback",
135+
"payload": "/club_suite_details",
136+
"title": "Read More"
137+
},
138+
{
139+
"type": "postback",
140+
"payload": "/book_room_now",
141+
"title": "Book Now"
142+
},
143+
]
144+
},
145+
146+
]
147+
}
148+
}
149+
}
150+
dispatcher.utter_custom_json(gt)
151+
return []
152+
153+
class BookRoomForm(FormAction):
154+
def name(self):
155+
return "book_room_form"
156+
157+
def required_slots(self,tracker) -> List[Text]:
158+
return ["check_in","check_out","adults","child","room","name","phno","email"]
159+
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
160+
return {
161+
"check_in": [
162+
self.from_text(),
163+
],
164+
"check_out": [
165+
self.from_text(),
166+
],
167+
168+
"adults": [
169+
self.from_text(),
170+
],
171+
"child": [
172+
self.from_text(),
173+
],
174+
"room": [
175+
self.from_text(),
176+
],
177+
"name": [
178+
self.from_text(),
179+
],
180+
"phno": [
181+
self.from_text(),
182+
],
183+
"email": [
184+
self.from_text(),
185+
],
186+
}
187+
def submit(
188+
self,
189+
dispatcher: CollectingDispatcher,
190+
tracker: Tracker,
191+
domain: Dict[Text, Any],
192+
) -> List[Dict]:
193+
dispatcher.utter_message("Your booking details are here")
194+
return []
195+
class BookRoomsDetails(Action):
196+
def name(self):
197+
"""name of the custom action"""
198+
return "action_book_rooms_details"
199+
200+
def run(self,dispatcher,tracker,domain):
201+
check_in=tracker.get_slot("check_in")
202+
check_out=tracker.get_slot("check_out")
203+
adults=tracker.get_slot("adults")
204+
child=tracker.get_slot("child")
205+
room=tracker.get_slot("room")
206+
name=tracker.get_slot("name")
207+
phno=tracker.get_slot("phno")
208+
email=tracker.get_slot("email")
209+
message="BOOKING DETAILS:"+"\n\n"+"Checkin Date:"+check_in+"\n"+"Checkout Date:"+check_out+"\n"+"No. of Adults:"+adults+"\n"+"No. of Children:"+child+"\n"+"No.of Rooms:"+room+"\n"+"Phone Number:"+phno+"\n"+"Email:"+email
210+
dispatcher.utter_message(message)

06_hotel_bot/src/config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Configuration for Rasa NLU.
2+
# https://rasa.com/docs/rasa/nlu/components/
3+
language: en
4+
pipeline: supervised_embeddings
5+
6+
# Configuration for Rasa Core.
7+
# https://rasa.com/docs/rasa/core/policies/
8+
policies:
9+
- name: MemoizationPolicy
10+
- name: KerasPolicy
11+
- name: MappingPolicy
12+
- name: FormPolicy
13+

0 commit comments

Comments
 (0)