我正在使用webhook在用户响应我的意图流后调用每个意图。然而,我面临一些问题,用户在进行下一个意图之前必须重复他/她的响应两次。我没有做任何复杂的事情,我的流程就是这样
1)创建后续意图(这将自动链接以前的意图)qazxsw poi
2)创建一个@ sys.any供用户响应intents
3)在训练模式中:我只需在此输入“用户输入”并将其链接到值@sys.any
4)启用webhook training phrases
无论如何,我都有一些意图,用户需要重复两次。我之前的意图没有任何其他问题,只有两个问题。 webhook
我尝试删除意图并创建一个新的后续,但问题仍然存在。
//这个意图没有问题,用户回复一次,它会转到下一个
simulator example
//不确定为什么用户在转移到下一个意图之前必须重复两次响应
app.intent('questionrespond', (conv, params) => {
conv.data.positivethinking = params.questionrespond;
conv.ask(`<speak> <voice gender ="male" variant= "1"> oh <break
time="0.5s"/> so what you are trying to say is <break
time="0.5s"/> by thinking of ${conv.data.positivethinking} may
<break time="0.3s"/> and may not increase positive thinking for
you <break time="0.7s"/> <p> okay <break time="0.7s"/> <s> I am
curious <break time="0.4s"/> what concerns you most about
yourself? <break time="0.7s"/> </s> </p> </voice> </speak>`);
});
//不确定为什么用户在转移到下一个意图之前必须重复两次响应
app.intent('torespondquestion', (conv, params) => {
conv.data.toRespondQuestion = params.torespondhere;
conv.ask(`<speak> <voice gender ="male" variant= "1"> <p> <s> so you said ${conv.data.toRespondQuestion} </s> What experience have you had in that instances? <break time="0.4s"/> <break time="0.4s"/> </p> </voice> </speak>`);
});
//不确定为什么用户在转移到下一个意图之前必须重复两次响应
app.intent('torespondexperiences', (conv, params) => {
conv.data.toResondExperiences = params.experienerespond;
conv.ask(`<speak> <voice gender ="male" variant= "1"> ok <break time="0.8"/> ${conv.data.toResondExperiences} how difficult was it for you to go through it? <break time="0.8"/> </voice> </speak>`);
});
如果你所有的意图都使用app.intent('ihearyou', (conv, params) => {
conv.data.hearingYou = params.ihearu;
conv.ask(`<speak> <voice gender ="male" variant= "1"> i hear you <break time="0.8"/> listening to you describe about your experiences <break time="0.8"/> it sounds like you went through quite a journey <break time="0.8"/> in what ways could you handle the situation differently? </voice> </speak>`);
});
,我认为使用一堆嵌套的后续意图可能会在你的项目中产生不必要的复杂性。
相反,您可能想要创建单个意图来接受@sys.any
并创建会话变量@sys.any
。然后,您的意图处理程序将检查conv.data.state
的当前值并进行适当的响应,同时还将状态设置为下一个值。