Dialogflow es 如何在DialogFlow Fullfilment中为操作退出对话
我有一个动作,这是一个简单的文字游戏,完成游戏后应该退出对话。我希望该操作支持Dialogflow es 如何在DialogFlow Fullfilment中为操作退出对话,dialogflow-es,actions-on-google,fulfillment,Dialogflow Es,Actions On Google,Fulfillment,我有一个动作,这是一个简单的文字游戏,完成游戏后应该退出对话。我希望该操作支持谷歌助手和基于扬声器的设备(移动电话等),因此我将以一种通用方式处理该意图 const {WebhookClient} = require('dialogflow-fulfillment'); ... exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { ... function
谷歌助手
和基于扬声器的设备(移动电话等),因此我将以一种通用方式处理该意图
const {WebhookClient} = require('dialogflow-fulfillment');
...
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
...
function answerIntent(agent) {
if (gameShouldEnd) {
agent.end("Your score is 3/5. Cheers! GoodBye!");
}
}
...
}
这将导致日志错误格式错误响应:必须设置“最终\u响应”
我也尝试了convapi,结果也是一样的错误
const {WebhookClient} = require('dialogflow-fulfillment');
...
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
...
function answerIntent(agent) {
if (gameShouldEnd) {
let conv = agent.conv();
conv.tell("Your score is 3/5. Cheers! GoodBye!");
agent.add(conv);
}
}
...
}
请建议如何在游戏结束并仍发送响应时关闭麦克风。根据记录的问题,
对话框Flow fullfillment
包的0.5.0
版本似乎存在问题
我尝试更新到
0.6.0
,该更新具有突破性的更改,解决了我发布的当前问题,但产生了与上下文相关的问题。您是否尝试过close
方法:
conv.close("Your score is 3/5. Cheers! GoodBye!");
请检查您意图的生命周期是否为1。之后,您可以使用以下命令:
代理。结束(“再见”) 这是正确的做法,但我遇到了问题,因为我的
dialogflow fullfilment
version版本有什么最好的方法来清除意图的寿命?在调用agent.end()之前,我尝试执行agent.clearOutgoingContexts(),但它仍然让麦克风打开等待响应。