dialogflow-es - 延长后续上下文的生命周期?
问题描述
如果我的意图被误导(不是双关语),请随时指出,但我试图处理一个对话流程,其中提示用户一个是/现在的问题,作为类似意图的搜索的后续行动。
如果响应与他们正在寻找的内容相匹配,他们会说是,如果不匹配,他们会说不。如果不是,我会继续跟进(一段时间)其他选项。
在上下文过期之前,后续意图会被命中几次。我在想,每次我提出新的建议时,我都会将寿命延长 1 倍。
这是一个好方法吗?如果是这样,是否有一种正确的方法来基本上做一个 context.lifespan++ 或者我是否需要查找现有的上下文并覆盖它?
谢谢!
想象一下这样的流程。第一个输入触发父意图。是/否答案应符合后续意图。
> 'Suggest food'
< 'Potato' (followup lifespan 1)
> 'No'
< 'Taco' (followup lifespan undefined)
> 'No'
< 'Pizza' (followup context gone)
> 'No'
最后一个 no 不会触发后续意图 b/c 上下文已过期。
解决方案
无需延长上下文的生命周期。在我开始使用它之前,我也为此苦苦挣扎了几个小时:
Intent: question
Trainings phrase: 'May I enter?'
Output context: 'await_olderThan21'
Response: 'Are you older than 21?'
Intent: question.yes
Training phrase: 'yes'
Input context: 'await_olderThan21'
Output context: ''
Response: 'Yes, you may enter'
Intent: question.no
Training phrase: 'no'
Input context: 'await_olderThan21'
Output context: ''
Response: 'No, you may not.'
Intent: question.invalidInput
Training phrase: @sys.any
Input context: 'await_olderThan21'
Output context: 'await_olderThan21'
Response: 'Invalid answer. Please reply with yes or no.'
我希望这是有道理的!
推荐阅读
- sass - @mixin “@mixin”后的 CSS 无效
- c# - C#:视频下载损坏?
- java - RESTful 服务客户端的并发请求是否会导致 RESTful 服务出现问题?
- swift - Swift Collection 扩展:选择其他所有项目
- javascript - 从外部 JavaScript 文件调用函数
- java - 在 maven 编译期间创建 Java 类的 shell 或 groovy 脚本
- python - xgboost.core.XGBoostError:需要预先调用 fit - 尝试通过腌制模型进行预测时
- android - 具有多个片段的 ViewModel
- c# - 将新线程注册到已定义的屏障
- python - 如何将 ipython/jupyter 设置为 vscode 的默认 python 终端?