Rasa story executes twice whenever one of the action in the same story takes time - chatbot

I am making a bus ticket booking chatbot through rasa open source, where there is a form to take input from the user. Chatbot shows the user's input for confirmation, and in the last action function, it fetches a ticket from the API and responds to the user.
Now the issue is that whenever the API takes much time, my entire story repeats, and it will execute each step of the story one by one again.
The chatbot works perfectly if the API returns the response quickly. The long waiting time for the action causes the issue.
Here is the story:
- story: bus path
steps:
- intent: bus
- action: action_fill_slots_if_any
- action: bus_enquiry_form
- active_loop: bus_enquiry_form
- active_loop: null
- action: action_show_fetched_bus_data
- action: action_show_bus_result

Related

Stop Dialogflow with Facebook Job Application

How can I do a takeover, or pause dialogflow when receiving an attachment via a Facebook Job Application?
Thanks!
EDIT: THIS DOES NOT WORK AFTER ALL
Ok, figured it out.
Go into the history in Dialogflow and find where someone uploaded an item and copy the url or at least the first part of the url inside messenger.
In this case, a few examples:
--https://scontent.xx.fbcdn.net/v/--
--https://scontent.xx.fbcdn.net/v/--
Actions and Parameters:
Param name: takeover
entity: sys.any
value: takeover
I also highlighted the training phrases and created sys.url parameters for them and then created another action:
Parameter name: url
entity: sys.url
value: url
Then I added a text response: "Great, we'll be in touch. Thanks."
This is my way of problem solving. I'm not a coder...so totally open for other options, especially if they're easier :)

Using slot in Watson Assistant and Node RED

I'm building a chatbot on Telegram with Watson Assistant and Node RED. I need to take a date and time from the user for booking an appointment, so I used a slot that require the insertion of the two information. Using the trial chatbot offered by Watson, I have no problem with slot; but using Node RED, I can't go beyond entering the date. Through the debug, I saw that after entering the date, then after running the first slot, this error is returned "msg.payload.content is empty". Moreover, going to see the body of the output message returned by the assistant, the msg.payload.output.generic field is empty. On the other hand, it should contain the response of the assistant who requests, after having entered the date, also to insert the time. It seems that the bot is stuck on entering the date, but in reality I don't think so, because in the trial chatbot, it works perfectly.
What could be the problem?
Neither the Assistant V1 nor the V2 set or look at msg.payload.content. On input they look at msg.payload and on exit they assign the response from Watson Assistant to msg.payload.
If you are getting a "msg.payload.content" is empty error, then that will be happening somewhere in your flow. Most likely at the end where you are trying to process the response. If msg.payload.content is empty then the assistant dialog is not returning any output. This is strange as it should be returning the prompt for the currently empty slot.
What does msg.payload look like?
Are you using the V1 or the V2 node, and which version of node-red-node-watson nodes are you using? You can tell, by going to the palette.
Both V1 and V2 nodes, however, have been tested with slots, and the response does end up on msg.payload.content. Current released version of node-red-node-watson is 0.9.0.

How to trigger a specific node in IBM Watson Assistant from URL

I have a website which links to a chatbot built on IBM Watson Assistant. There are some hyperlinks on the website that I want to trigger specific nodes/ intents the watson dialog.
Example: User clicks on "Provide feedback" link, the watson chatbot launches and based on the link the "provide_feedback" intent is recognised (thus preventing the user from needing to specify the intent after clicking the link).
Has anyone tried this before?
I also came across this requirement and want to mention another alternative here:
Instead of sending an input text that matches the intent of your desired node, you can also pass
Intents to use when evaluating the user input.doc
and tell the assistant to match it with confidence of 1.0.
I think this is a clean method, because you don't need to deal with disambiguation of your input text.
Then you don't need to send input text at all and the intent actually does not even need example phrases :-)
For example if you want to trigger a node that has the intent #provide_feedback
you can call this python example code:
send_message_to_chatbot(text="", intent="provide_feedback")
def send_message_to_chatbot(text="", intent=""):
message = assistant.message(
assistant_id=ASSISTANT_ID,
session_id=SESSION_ID,
input=MessageInput(
text=text,
intents=[RuntimeIntent(intent=intent, confidence=1.0)]
)
).get_result()
return message
Prerequisite is of course that the node is in the root branch of your dialog so it can be triggered.
The Watson Assistant service basically is used via a REST API. That API is invoked from the "Try it" pane in the workspace editor, from your dedicated application or maybe from widgets embedded into a website. The message call is used to send user input to Watson Assistant and to receive a chatbot response.
What you can do is to call the message API from your app and pass a specific term as input message. That term would match an intent and hence trigger a specific dialog node. As an example, if you have an intent "provide_feedback" defined for the phrase "user pressed feedback button" and you pass in exactly that phrase as input message, then the intent "provide_feedback" will match.

Conversation flow works in 'Try it out' but skips child node in app

I am making an app that predicts clothes the user is wearing. It uses the Visual Recognition tool, too, and for Conversation and VR to be communicating, I attach the intent 'suggestClothing' or 'clothResult' to the cloth items it found. I use an entity for Conversation to recognize the cloth items and respond accordingly.
The flow should be as follows:
User: how do I look?
-classifies clothes-
App to conversation: clothSuggest blackJacket
Conversation to user: "You picked the black jacket! Try out the green shirt with this outfit and show me how you look."
-classifies clothes-
App to conversation: clothResult blackJacket greenShirt
Conversation to user: "You look great in that outfit!"
All nodes have multiple responses as all clothes are in pairs. Either the user is wearing one or the other, and Conversation will then always suggest it's match.
Conversation flow looks like this
I also attempted this. Here sq123 is suggestClothing (first intent) and cq123 is clothResult:
This works fine in 'Try it out', too, but in the app, it immediately exits the branch on 'clothResult item1 item2' and matches with other conditions in the app.
What's the best way to optimize my flow to make it work in the app?
A typical reason why it works in "Try it out" and not in the app is that the context object is not returned properly.
When the app invokes the message method of the Watson Assistant API, a context object is passed. The calls are stateless and everything needed for Watson Assistant to continue a dialog is included in the context object. Thus, when your app retrieves the results from the message API, it needs to save the context and pass it back to Watson Assistant the next time the message method is invoked again (for that session and user).

Google Calendar API - Recurring Events - GDATA - iPhone

I am trying to build an app which shows events from a google calendar. I am using GData. Does any of you know how can I modify GDataQueryCalendar or other things such that google calendar doesn't show recently edited recurring event twice.
For Eg: If I have a recurring event called 'Breakfast' which is repeated daily at 7am. When I check the feed it shows the event only once. But, if I go back and edit the event's title to 'Breakfast1' only for today. And then when I check the feed it shows two events. One is "Breakfast" at 7am and the other one is "Breakfast1" at the same time 7am. Starttime on both the events are same.
How can I get the event only for that day (Breakfast1 as in eg)?
Finally got it working.. I am checking if a GDataEntryCalendarEvent event has an original event with it ([event originalEvent]). If an event has original event then we need to use this event instead of the duplicate event.