我的意图是询问是/否问题。如果用户说“不”,他们会接受一系列问题,最后一个问题再次是肯定/否定问题。在回答“否”时,我希望循环重新开始。我已经尝试了here提供的解决方案,但它没有用。
答案 0 :(得分:1)
在该链接上给出的上下文技巧应该有效,你只需要正确处理上下文和响应,考虑下面的示例系列意图
- intent that asks yes/no question (say 'question X') <--[set the output context (say 'loop-back')]
|
|--- intent that accepts 'no' as user input <--[set 'loop-back' context as input context for this]
|
|--- chain of questions...
|
|--- last yes/no question
|
|--- intent that accepts 'no' as user input <--[set the output context 'loop-back']
[response from agent should be the same yes/no question 'questionX']
|
|--- [if user replies 'no' the loop continues...]
确保设置上下文的生命周期&#39; loop-back&#39;正确(可能是1/2)因此它不会存储更长时间。
我们从 questionX &#39;开始最后一个意图是回复&#39; questionX &#39;。实际上,起始(是/否问题X)的意图永远不会被再次触发,但之后的意图是接受“不”#39;由于上下文而被触发,这会产生正确的循环:)
看看这个例子是否有帮助,
- [start intent fires]
{intent A}
Agent("are you afraid to talk to me ?") <--[set the output context (say 'loop-back')]
|
|{intent B}
|--- User("no")
Agent("What are you afraid of then ?") <--[set 'loop-back' context as input context for this]
|
|{intent C}
|--- User("nothing")
Agent("more questions")
|
|{intent D}
|--- User("more answers")
Agent("are you afraid to talk to daemons ?")
|
|{intent E}
|--- User("no")
Agent("and are you afraid to talk to me ?") <--[set the output context 'loop-back']
|
|{intent B}
|--- User("no")
Agent("What are you afraid of then ?")
[and the loop continues...]
看看两个[set output context](意图A&amp; E)行,两者都有相同的Agent响应,这会创建一个循环......