You can have a majority of the voices. For example:
Bot: I have found the ABC contact with the phone number User 123456: Can you fix it? Bot: I found ABC contact with phone number 123456
I have no talent and make friends (looking for talent and talent), again.
I think I can create a “last_message” position and always fill in that position in all my custom actions. However, we can be very boring. There are no results, solutions and their work
@Tobias_Wochinger I want to repeat what has bot last said. how to achieve that in custom action.
I want to continue the active form, if small talks came in between the flow of active form.
Example:
i looking for a resutrant.
bot: may i know the cusine?
user: are you a chat bot?
bot: Yes, that is me.
bot: May I know the cusine? ## i want to get this.
User: Spanish.
the code which was shared by custodio in this post How to repeat the way say the last bot should help you out. I’d improve it a bit by not using hard-coded index, but rather going through the events in reverse order and checking if the type of the event was bot. And I’m not sure whether you need the UserUtteranceReverted because you are triggering that after the form, right?
Here is a code that repeats all the messages till the last user input without any hardcoding. This works well for text and buttons. You can do the same for images.
class ActionRepeat(Action):
def name(self):
return “action_repeat”
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
user_ignore_count = 2
count = 0
tracker_list = []
while user_ignore_count > 0:
event = tracker.events[count].get('event')
if event == 'user':
user_ignore_count = user_ignore_count - 1
if event == 'bot':
tracker_list.append(tracker.events[count])
count = count - 1
i = len(tracker_list) - 1
while i >= 0:
data = tracker_list[i].get('data')
if data:
if "buttons" in data:
dispatcher.utter_message(text=tracker_list[i].get('text'), buttons=data["buttons"])
else:
dispatcher.utter_message(text=tracker_list[i].get('text'))
i -= 1
return []