【问题标题】:timeout for chatbot Watson Conversation Service聊天机器人 Watson 对话服务超时
【发布时间】:2017-04-24 19:25:26
【问题描述】:

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

示例一:

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
}

在消息发送给用户后,对话将结束。 但我需要采取一些方法来确定用户是否没有输入任何内容。我想用布尔值truefalseuserInputText 变量中保存它。

基础: 对话简单。

如何解决这个问题?

提前感谢。

【问题讨论】:

    标签: javascript node.js ibm-watson watson-conversation


    【解决方案1】:

    Example 1 你已经明白了。如果应用程序从对话服务返回错误,您只需显示一些预先编写的文本。

    对于超时,您的应用必须控制计时器。您可以将其作为上下文发送到对话并以这种方式响应,但我不确定您为什么要这样做?我想在您的应用程序中,您有一个计时器,如果没有响应,则向他们发送主动消息“您还在吗?”或类似的东西,但我不确定你为什么要根据时间结束这样的对话。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-13
      • 1970-01-01
      • 1970-01-01
      • 2017-12-01
      • 2020-06-16
      • 1970-01-01
      相关资源
      最近更新 更多