chatbot Watson对话服务超时

目前,我正在开发一些聊天机器人,我想知道如何用超时的方式完成对话。

示例I:

if(callback.error){ data.output.text = "The server is offline now. Please try again later. Goodbye!"; return res.json(data); //send the message exit(); //example (I did with sucess) } 

例二:

 if(userInputText == false && data.context.time === 120){ //time = seconds data.output.text = "Are you still there?"; return res.json(data); //send the message exit(); //example if user did not type anything } 

例三:

 //intent by user #goodBye if(userSayGoodbye){ data.output.text = "Okay, goodbye!"; return res.json(data); //send the message exit(); //EXAMPLE for exit the conversation if user say goodbye } 

在消息发送给用户之后,对话将结束。 但我需要一些方法来确保用户是否不input任何内容。 我想要保存这个布尔值truefalseuserInputTextvariables中。

基地:谈话 – 简单。

如何解决这个问题?

感谢提前。

例1你几乎已经知道了。 如果应用程序从对话服务中获取错误,则只显示一些预先写好的文本。

对于超时,您的应用程序必须控制计时器。 你可以把它作为上下文发送到对话和回应,但我不知道你为什么要这样做? 我想在你的应用程序中,你有一个计时器,如果没有回应,然后发送给他们一个主动的信息“你还在吗? 或类似的东西,但林不知道你为什么要结束这样的基础上的时间的谈话。