为什么当用户响应一次时我的意图会重复?用户必须再次响应,然后才会有以下意图跟进

Why is my intent repeated when user responded it once? User must respond it again and then only will the following intent follow up

我目前正在使用 webhook 在用户响应我的意图流后调用每个意图。然而,我遇到了一些问题,用户必须重复 his/her 响应两次才能继续下一个意图。我没有做任何复杂的事情,我的过程是这样的

1) 创建后续意图(这将自动 link 先前的意图) intents

2) 创建一个@sys.any 供用户响应 @sys.any

3) 在训练模式下:我只需输入 'user input here' 和 link 到值 training phrases

4) 启用网络钩子 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。然后,您的意图处理程序将检查 conv.data.state 的当前值并做出适当响应,同时还将状态设置为下一个值。