【发布时间】:2018-11-02 06:15:07
【问题描述】:
我有一个动作是一个简单的文字游戏,完成游戏后应该退出对话。我希望该操作支持Google Assistant 和基于扬声器的设备(手机等),因此我以一般方式处理意图。
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!");
}
}
...
}
这会导致日志错误MalformedResponse: 'final_response' must be set
我也尝试了 conv api,结果同样的错误。
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);
}
}
...
}
请建议如何在游戏结束时关闭麦克风并仍然发送响应。
【问题讨论】:
标签: dialogflow-es actions-on-google fulfillment