本文介绍了Slack-App-Watson:Watson从先前收到的消息中释放了意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个简单的Slack机器人,该机器人可以查找给定位置的天气情况.

I am writing a simple Slack bot which can look for weather conditions for a given location.

在Watson对话聊天框中,Watson做得很好:

In the Watson conversation chat box, Watson is doing good:

但是在我的node.js应用程序(连接到Slack)中,Watson似乎"不要紧记我正在为#weather_asked目的提供位置":

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":

就像通过我的NodeJS应用程序使用Watson一样,它忘记了最初的意图#weather_asked并被重置"为其主要对话框.我想念什么?

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?

我的Watson对话对话框配置的屏幕截图: http://imgur.com/a/vKo8P

Screenshot of my Watson Conversation Dialogs configuration: http://imgur.com/a/vKo8P

编辑:我发现我的应用使用新的对话ID将用户的输入发送给Watson.我将尝试设置此上下文(如果已经存在).

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.

推荐答案

我找到了解决方案!问题是我没有告诉Watson我的用户已经开始与他进行对话了(它?).

I found the solution! The problem was that I did not tell Watson my user had already started a conversation with him (it?).

我编写了一段简单的代码,存储了按Slack的user_id分组的现有上下文.如果此user_id的上下文已经存在,则我的应用程序将调用Watson API并将该上下文附加到请求中,因此Watson知道此新用户的输入遵循先前的输入.

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.

这篇关于Slack-App-Watson:Watson从先前收到的消息中释放了意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 10:05