我有一个简单的文字游戏动作,完成游戏后应该退出对话。我想要支持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);
}
}
...
}
请建议如何在游戏结束时关闭麦克风并仍然发送响应。