问题
I am writing a simple Slack bot which can look for weather conditions for a given location.
In the Watson conversation chat box, Watson is doing good:
- me: Weather please
- Watson (detected #weather_asked): Where do you want to know the weather conditions?
- me: Paris
- Watson (detected @location for intent #weather_asked): Finding weather conditions for Paris...
But in my node.js app (connected to Slack), it seems that Watson is "not keeping in mind that I am providing a location for the #weather_asked intent":
- me: Weather please
- Watson (detected #weather_asked): Where [...]?
- me: Paris
- Watson (detected only @location and intent #location_given): I am sorry, I did not understand. (fallback anything_else)
It is like Watson, when used through my NodeJS app, is forgetting the initial intent #weather_asked and is "reset" to its primary Dialogs. What am I missing?
Screenshot of my Watson Conversation Dialogs configuration: http://imgur.com/a/vKo8P
edit: I found out my app sends the user's input to Watson with a new conversation ID. I will try to set this context if it already exists.
回答1:
I found the solution! The problem was that I did not tell Watson my user had already started a conversation with him (it?).
I made a simple piece of code which stores the existing context grouped by Slack's user_id. If a context already exists for this user_id, then my app will call Watson API and append this context to the request, so Watson knows that this new User's input follows a previous one.
来源:https://stackoverflow.com/questions/42180038/slack-app-watson-watson-looses-intent-from-previous-message-received