def __init__(self, dialog_id: str = None): super(IpCheckDialog, self).__init__(dialog_id or IpCheckDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.vm_step, self.subscription_step, self.result_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, conversation: ConversationState, userstate: UserState, cosdbStore: CosmosDbPartitionedStorage): self.con_statea = conversation self.userstate = userstate self.cosmodb = cosdbStore self.conprop = self.con_statea.create_property("constate") self.userprop = self.userstate.create_property("userstate") self.state_prop = self.con_statea.create_property("dialog_set") self.dialog_set = DialogSet(self.state_prop) self.dialog_set.add(TextPrompt("text_prompt")) self.dialog_set.add(NumberPrompt("number_prompt")) self.dialog_set.add( WaterfallDialog("main_dialog", [ self.Hello, self.MoodCarousel, self.NegativeMoodCarousel, self.Completed ]))
def __init__(self, dialog_id: str = None): super(SummarizeDialog, self).__init__(dialog_id or SummarizeDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) # self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.repo_name_step, self.repo_owner_step, self.summarize_issue_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(TopLevelDialog, self).__init__(dialog_id or TopLevelDialog.__name__) # Key name to store this dialogs state info in the StepContext self.USER_INFO = "value-userInfo" self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) self.add_dialog(ReviewSelectionDialog(ReviewSelectionDialog.__name__)) self.add_dialog( WaterfallDialog("WFDialog", [ self.name_step, self.age_step, self.start_selection_step, self.acknowledgement_step ])) self.initial_dialog_id = "WFDialog"
def __init__(self, dialog_id: str = None): super(RestaurantFinderDialog, self).__init__(dialog_id or RestaurantFinderDialog.__name__) self.gmaps_service = GoogleMapsService() self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.food_step, self.location_step, self.confirm_step, self.results1_step, self.results2_step, self.results3_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, luis_recognizer: FlightBookingRecognizer, booking_dialog: BookingDialog, cancel_booking_dialog: CancelBookingDialog, edit_booking_dialog: EditBookingDialog): super(MainDialog, self).__init__(MainDialog.__name__) self._luis_recognizer = luis_recognizer self._booking_dialog_id = booking_dialog.id self._edit_booking_dialog_id = edit_booking_dialog.id self._cancel_booking_dialog_id = cancel_booking_dialog.id self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(booking_dialog) self.add_dialog(cancel_booking_dialog) self.add_dialog(edit_booking_dialog) self.add_dialog( WaterfallDialog("WFDialog", [self.intro_step, self.act_step, self.final_step])) self.initial_dialog_id = "WFDialog"
def __init__( self, luis_recognizer: AreaRecognizer, area_dialog: AreaDialog ): super(MainDialog, self).__init__(MainDialog.__name__) self._firstRun = True self._luis_recognizer = luis_recognizer self._area_dialog_id = area_dialog.id self.add_dialog(ChoicePrompt("cardPrompt")) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(area_dialog) self.add_dialog( WaterfallDialog( "WFDialog", [self.intro_step, self.act_step, self.final_step] ) ) self.initial_dialog_id = "WFDialog"
def __init__(self, dialog_id: str = None): super(LehoiDialog, self).__init__(dialog_id or LehoiDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog(DateResolverDialog(DateResolverDialog.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.destination_step, # self.origin_step, # self.travel_date_step, # self.confirm_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, luis_recognizer: OrderingRecognizer, dialog_id: str = None): super(OrderTrackingDialog, self).__init__(dialog_id or OrderTrackingDialog.__name__) self._luis_recognizer = luis_recognizer self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog(DateResolverDialog(DateResolverDialog.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.email_step, self.orderid_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(TopLevelDialog, self).__init__(dialog_id or TopLevelDialog.__name__) # Key name to store this dialogs state info in the StepContext self.USER_INFO = "value-userInfo" self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) choice = ChoicePrompt(ChoicePrompt.__name__) choice.recognizer_options = FindChoicesOptions( allow_partial_matches=True) self.add_dialog(choice) self.add_dialog( SymptomsSelectionDialog(SymptomsSelectionDialog.__name__)) self.add_dialog( ContactsSelectionDialog(ContactsSelectionDialog.__name__)) self.add_dialog(PersonalDataDialog(PersonalDataDialog.__name__)) self.add_dialog( RiskCountrySelectionDialog(RiskCountrySelectionDialog.__name__)) self.add_dialog( WaterfallDialog( "WFDialog", [ self.name_step, self.age_step, self.confirm_riskcountry_step, self.start_riskcountry_selection_step, self.start_symptom_selection_step, self.temparature_step, self.start_contacts_step, self.job_claim_step, self.job_type_step, self.personal_data_step, self.acknowledgement_step, ], )) self.initial_dialog_id = "WFDialog"
def __init__(self, conversation: ConversationState): #get the state of conversation and store in a variable self.con_state = conversation #state property needs to be created from con state of conversation self.state_prop = self.con_state.create_property("dialog_set") #create dialogset - stateproperty is needed self.dialog_set = DialogSet(self.state_prop) #define dialog set, what all dialogs are going to be used self.dialog_set.add(TextPrompt("text_prompt")) self.dialog_set.add( NumberPrompt( "number_prompt", self.IsValidMobileNumber)) #Adding custom validation logic #define the steps, which question will be asked in sequence self.dialog_set.add( WaterfallDialog("main_dialog", [ self.GetUserName, self.GetMobileNumber, self.GetEmailId, self.Completed ]))
def __init__(self, dialog_id: str = None): super(ConnectivityCheckDialog, self).__init__(dialog_id or ConnectivityCheckDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.destination_step, self.source_step, self.protocol_step, self.port_step, self.confirm_step, self.result_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, luis_recognizer: DeliverySchedulingRecognizer, user_state: UserState, storage: object): super(MainDialog, self).__init__(MainDialog.__name__) self.luis_recognizer = luis_recognizer self.user_state = user_state self.did_show_entry_msg = False self.storage = storage self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog(CreateDeliveryDialog(self.user_state, self.storage)) self.add_dialog(ListDeliveriesDialog(self.user_state, self.storage)) self.add_dialog(SalutationDialog(self.user_state, self.storage)) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog( WaterfallDialog( Keys.WATER_FALL_DIALOG_ID.value, [self.intro_step, self.action_step, self.final_step], )) self.initial_dialog_id = Keys.WATER_FALL_DIALOG_ID.value
def __init__(self, dialog_id: str = None): super(RecommendDialog, self).__init__(dialog_id or RecommendDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.brand_step, self.use_step, self.cost_step, self.looking_step, self.performance_step, self.confirm_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, user_state: UserState, mongo: MongoConnection): super(UserCheckinDialog, self).__init__(UserCheckinDialog.__name__) self.user_state = user_state self.user_state.user_profile_accessor = self.user_state.create_property( "UserEmotionAtCheckIn") self.user_state.emotion_profile_accessor = self.user_state.create_property( "Emotion") self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.icon_checkin_step, self.choose_an_emotion_step, self.get_context_step, self.confirm_step, self.summary_step ], )) self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.initial_dialog_id = WaterfallDialog.__name__ self.mongo = mongo
def __init__(self, nlu_recognizer: NLU, user_state: UserState, booking_room_dialog: BookingRoomDialog): super(MainDialog, self).__init__(MainDialog.__name__) # Load the NLU module self._nlu_recognizer = nlu_recognizer # Load the sub-dialogs self._booking_dialog_id = booking_room_dialog.id # Setup the waterfall dialog self.add_dialog( WaterfallDialog(WaterfallDialog.__name__, [self.intro_step, self.act_step, self.final_step])) # Append the prompts and custom dialogs, used in the waterfall self.add_dialog(TextPrompt("ActPrompt")) self.add_dialog(booking_room_dialog) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, luis_recognizer: ShoppingRecognizer, recommend_dialog: RecommendDialog, adjust_dialog: AdjustDialog): super(MainDialog, self).__init__(MainDialog.__name__) self._luis_recognizer = luis_recognizer self._recommend_dialog_id = recommend_dialog.id self._adjust_dialog_id = adjust_dialog.id self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(recommend_dialog) self.add_dialog(adjust_dialog) self.add_dialog( WaterfallDialog("WFDialog", [ self.intro_step, self.act_step, self.adjust_step, self.final_step ])) self.add_dialog(WaterfallDialog("STARTDialog", [self.start_step])) self.initial_dialog_id = "STARTDialog" self.WF_id = "WFDialog"
def __init__(self, configuration: Dict[str, object], dialog_id: str = None, language_helper: LanguageHelper = None): super(MainDialog, self).__init__(dialog_id or MainDialog.__name__) self._configuration = configuration self._language_helper = language_helper self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(BookingDialog()) self.add_dialog( WaterfallDialog('WFDialog', [self.intro_step, self.act_step, self.final_step])) self.initial_dialog_id = 'WFDialog' # Initialize language models if we're not using service self._language_helper = LanguageHelper() if not self._configuration["USE_MODEL_RUNTIME_SERVICE"]: self._language_helper.initialize_models()
def __init__(self, dialog_id: str = None): super(PersonalDataDialog, self).__init__(dialog_id or PersonalDataDialog.__name__) # Key name to store this dialogs state info in the StepContext self.PERSONAL_DATA = "value-personalData" self.add_dialog( WaterfallDialog(WaterfallDialog.__name__, [ self.first_name_step, self.family_name_step, self.gender_step, self.street_step, self.zipcode_step, self.city_step, self.telephone_step, self.email_step, self.birthday_step, self.final_step ])) self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog(DateTimePrompt(DateTimePrompt.__name__)) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(BookingDialog, self).__init__(dialog_id or BookingDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog(DateResolverDialog(DateResolverDialog.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.destination_step, self.origin_step, self.from_date_step, self.to_date_step, self.budget_step, self.confirm_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__ self.logger = None self.stats = stats_module.stats self.view_manager = self.stats.view_manager self.stats_recorder = self.stats.stats_recorder self.bot_measure = measure_module.MeasureInt("botdefects", "number of bot defects", "botdefects") self.bot_view = view_module.View("defect view", "number of bot defects", [], self.bot_measure, aggregation_module.CountAggregation()) self.view_manager.register_view(self.bot_view) self.mmap = self.stats_recorder.new_measurement_map() self.tmap = tag_map_module.TagMap() self.metrics_exporter = None self.message_history = set()
def __init__(self, dialog_id: str = None): super(WaterfallText, self).__init__(dialog_id or WaterfallText.__name__) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.fatturatestuale_step, self.date_step, self.confirm_step, self.insertdata_step, self.summary_step, ], )) #self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog( TextPrompt(TextPrompt.__name__, WaterfallText.insertCorrectdate)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(RecommendDialog, self).__init__(dialog_id or RecommendDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.sex_step, self.age_step, self.season_step, self.typ_step, self.function_step, self.style_step, self.color_step, self.cost_step, self.confirm_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(EditBookingDialog, self).__init__(dialog_id or EditBookingDialog.__name__) self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog(DateResolverDialog(DateResolverDialog.__name__)), self.add_dialog(UserIDResolverDialog(UserIDResolverDialog.__name__)), self.add_dialog( CapcacityResolverDialog(CapcacityResolverDialog.__name__)), self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.user_id_step, self.destination_step, self.travel_date_step, self.capacity_step, self.confirm_step, self.final_step, ], )) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, dialog_id: str = None): super(WaterfallPhoto, self).__init__(dialog_id or WaterfallPhoto.__name__) #self.user_profile_accessor = user_state.create_property("UserProfile") self.add_dialog( WaterfallDialog( WaterfallDialog.__name__, [ self.picture_step, self.confirm_step, self.evaluate_data_step, ], )) self.add_dialog(TextPrompt(TextPrompt.__name__)) #self.add_dialog(TextPrompt(TextPrompt.__name__, WaterfallQuery.insertCorrectdate)) self.add_dialog(NumberPrompt(NumberPrompt.__name__)) self.add_dialog(ChoicePrompt(ChoicePrompt.__name__)) self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__)) self.add_dialog( AttachmentPrompt(AttachmentPrompt.__name__, WaterfallPhoto.picture_prompt_validator)) self.initial_dialog_id = WaterfallDialog.__name__
def __init__(self, recognizer: MusicRecognizer, recommendation_dialog: RecommendationDialog): super(MainDialog, self).__init__(MainDialog.__name__) self.recognizer = recognizer self.recommendation_dialog_id = recommendation_dialog.id self.add_dialog(TextPrompt(TextPrompt.__name__)) self.add_dialog(recommendation_dialog) self.add_dialog( WaterfallDialog("WFDialog", [self.intro_step, self.act_step])) self.songs = { 'rock': [], 'metal': [], 'classical': [], 'jazz': [], 'pop': [], 'electronic': [] } self.rock = [ [ 'Tame Impala', 'Lucidity', 'Innerspeaker', 'https://upload.wikimedia.org/wikipedia/en/d/dc/Tame_Impala_-_Innerspeaker.png' ], [ 'King Gizzard and the Lizard Wizard', 'Rattlesnake', 'Flying Microtonal Banana', 'https://img.discogs.com/Dsx2WfNSZ0G3SWPY9wduXsKblqs=/fit-in/300x300/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-9885063-1488706851-7952.jpeg.jpg' ], [ 'Temples', 'Sun Structures', 'Sun Structures', 'https://upload.wikimedia.org/wikipedia/en/5/58/Temples_-_Sun_Structures.png' ] ] self.metal = [ [ 'Megadeth', 'Lucretia', 'Rust in Peace', 'https://upload.wikimedia.org/wikipedia/en/d/dc/Megadeth-RustInPeace.jpg' ], [ 'Annihilator', 'Alison Hell', 'Alice in Hell', 'https://upload.wikimedia.org/wikipedia/en/thumb/3/3a/AnnihilatorAliceInHell.jpg/220px-AnnihilatorAliceInHell.jpg' ], [ 'Metallica', 'One', '...And Justice for All', 'https://upload.wikimedia.org/wikipedia/en/b/bd/Metallica_-_...And_Justice_for_All_cover.jpg' ] ] self.classical = [ [ 'Chopin', 'Etude Op.10 No.3 in E Major', '', 'https://m.media-amazon.com/images/I/71DCffFhbYL._SS500_.jpg' ], [ 'Antonio Vivaldi', 'Four Seasons', '', 'https://www.baroquemusic.org/19Large.jpg' ], [ 'Camille Saint-Saƫns', 'Danse Macabre', '', 'https://images-na.ssl-images-amazon.com/images/I/71C2-Lw5wUL._SX355_.jpg' ] ] self.jazz = [ [ 'McCoy Tyner', 'When Sunny Gets Blue', 'Today and Tomorrow', 'https://upload.wikimedia.org/wikipedia/en/e/ec/Today_and_Tomorrow.jpg' ], [ 'Beegie Adair', 'What A Difference A Day Makes', 'A Time For Love: Jazz Piano Romance', 'https://images-na.ssl-images-amazon.com/images/I/711WxGESziL._SX355_.jpg' ], [ 'Jack Jezzro', 'Wave', 'Cocktail Party Bossa Nova', 'https://images-na.ssl-images-amazon.com/images/I/81GP9iBusPL._SY355_.jpg' ] ] self.pop = [ [ 'Michelle Branch', 'Game of Love', 'Shaman', 'https://upload.wikimedia.org/wikipedia/en/b/b2/Santana_-_Shaman_-_CD_album_cover.jpg' ], [ 'Khriz y Angel', 'Ven Bailalo', 'Ven Bailalo (Reggaeton Mix)', 'https://m.media-amazon.com/images/I/61YsVHHg-NL._SS500_.jpg' ], [ 'Foster the People', 'Helena Beat', 'Torches', 'https://upload.wikimedia.org/wikipedia/en/d/d3/Torches_foster_the_people.jpg' ] ] self.electronic = [ [ 'Linea Aspera', 'Synapse', 'Linea Aspera', 'https://img.discogs.com/XDDumr9vpZBh1lcBmxx6BB8yetM=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-3831443-1346116401-7418.jpeg.jpg' ], [ 'New Order', 'Blue Monday', 'Substance', 'https://images-na.ssl-images-amazon.com/images/I/31RRJ84EK6L.jpg' ], [ 'Kraftwerk', 'Numbers', 'Computer World', 'https://upload.wikimedia.org/wikipedia/en/a/a6/Kraftwerk_-_Computer_World.png' ] ] # Create objects from the above lists and add them to the songs list for song in self.rock: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['rock'].append(song_obj) for song in self.metal: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['metal'].append(song_obj) for song in self.classical: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['classical'].append(song_obj) for song in self.jazz: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['jazz'].append(song_obj) for song in self.pop: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['pop'].append(song_obj) for song in self.electronic: song_obj = SongClass(song[0], song[1], song[2], song[3]) self.songs['electronic'].append(song_obj) self.initial_dialog_id = "WFDialog"
def __init__(self, user_state: UserState): super(RootDialog, self).__init__(RootDialog.__name__) self.user_state_accessor = user_state.create_property("result") # Rather than explicitly coding a Waterfall we have only to declare what properties we want collected. # In this example we will want two text prompts to run, one for the first name and one for the last fullname_slots = [ SlotDetails(name="first", dialog_id="text", prompt="Please enter your first name."), SlotDetails(name="last", dialog_id="text", prompt="Please enter your last name."), ] # This defines an address dialog that collects street, city and zip properties. address_slots = [ SlotDetails( name="street", dialog_id="text", prompt="Please enter the street address.", ), SlotDetails(name="city", dialog_id="text", prompt="Please enter the city."), SlotDetails(name="zip", dialog_id="text", prompt="Please enter the zip."), ] # Dialogs can be nested and the slot filling dialog makes use of that. In this example some of the child # dialogs are slot filling dialogs themselves. slots = [ SlotDetails( name="fullname", dialog_id="fullname", ), SlotDetails(name="age", dialog_id="number", prompt="Please enter your age."), SlotDetails( name="shoesize", dialog_id="shoesize", prompt="Please enter your shoe size.", retry_prompt= "You must enter a size between 0 and 16. Half sizes are acceptable.", ), SlotDetails(name="address", dialog_id="address"), ] # Add the various dialogs that will be used to the DialogSet. self.add_dialog(SlotFillingDialog("address", address_slots)) self.add_dialog(SlotFillingDialog("fullname", fullname_slots)) self.add_dialog(TextPrompt("text")) self.add_dialog(NumberPrompt("number", default_locale=Culture.English)) self.add_dialog( NumberPrompt( "shoesize", RootDialog.shoe_size_validator, default_locale=Culture.English, )) self.add_dialog(SlotFillingDialog("slot-dialog", slots)) # Defines a simple two step Waterfall to test the slot dialog. self.add_dialog( WaterfallDialog("waterfall", [self.start_dialog, self.process_result])) # The initial child Dialog to run. self.initial_dialog_id = "waterfall"