Slack-App-Watson: Watson looses intent from previo

2019-04-16 02:59发布

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条回答
手持菜刀,她持情操
2楼-- · 2019-04-16 03:36

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.

查看更多
登录 后发表回答