현재 개발중인 채팅 봇입니다. 시간 초과와 같은 대화로 대화를 마무리하는 방법을 알고 싶습니다.chatbot의 시간 제한 왓슨 대화 서비스
예 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)
}
예 II :
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
}
예 III :
//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
}
그리고 대화 w 메시지가 사용자에게 전송 된 후 불완전하게 완료됩니다. 하지만 사용자가 아무 것도 입력하지 않았는지 확인하려면 어떤 방법이 필요합니다. 그리고 나는 부울 값 true
또는 false
안에 userInputText
변수를 저장하고 싶습니다.
자료 : conversation-simple.
해결 방법?
감사합니다.
네, 감사합니다. 하지만 코드를 사용하여이를 수행하는 방법을 알아야합니다. 2 가지 시나리오에서,이 경우 data.context의 값이 무엇인지 알지 못합니다. 사용자가 아무 것도 입력하지 않은 경우 유효성을 검사하는 데 사용할 수 있습니다. 대화를 끝내기 위해 코드 예제가 필요합니다. –