gpt4 book ai didi

dialogflow-es - 应用程序目前没有响应。 MalformedResponse - 在平台响应中找不到 RichResponse 或 SystemIntent

转载 作者:行者123 更新时间:2023-12-02 16:55:27 24 4
gpt4 key购买 nike

我正在尝试完成 Google Actions 的代码实验室教程,但遇到了一些麻烦。我在“为助手构建操作(2 级)”。

当我尝试在模拟器中测试操作时,我得到“我的测试应用程序现在没有响应。请稍后重试。”

请求或响应选项卡中没有任何内容。这是调试选项卡输出:

{
"response": "My test app isn't responding right now. Try again soon.",
"expectUserResponse": false,
"conversationToken": "EvwCS2o5Wk...",
"audioResponse": "//NExAASeH...",
"ssmlMarkList": [],
"debugInfo": {
"sharedDebugInfoList": []
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "My test app isn't responding right now. Try again soon."
}
}
],
"suggestionsList": [],
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": true,
"clientOperationList": [],
"projectName": ""
}

我的代码:

'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {
dialogflow,
Permission,
Suggestions,
} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Handle the Dialogflow intent named 'favorite color'.
// The intent collects a parameter named 'color'.
app.intent('favorite color', (conv, {color}) => {
const luckyNumber = color.length;
// Respond with the user's lucky number and end the conversation.
if (conv.data.userName) {
conv.close(`${conv.data.userName}, your lucky number is ${luckyNumber}.`);
} else {
conv.close(`Your lucky number is ${luckyNumber}.`);
};
});

app.intent('Default Welcome Intent', (conv) => {
const options = {
context: 'Hi there, to get to know you better',
permissions: ['NAME'],
};
conv.ask(new Permission(options));
});

// Handle the Dialogflow intent named 'actions_intent_PERMISSION'. If user
// agreed to PERMISSION prompt, then boolean value 'permissionGranted' is true.
app.intent('ask permission', (conv, params, permissionGranted) => {
// If they didn't give me permission to use their name...
const options = ['Blue', 'Red', 'Green'];
if (!permissionGranted) {
conv.ask("Ok, no worries. What\'s your favorite color?");
conv.ask(new Suggestions(options));
} else {
// Otherwise, they gave me permission to use it
conv.data.userName = conv.user.name.display;
conv.ask(`Thanks, ${conv.data.userName}. What's your favorite color?`);
conv.ask(new Suggestions(options));
};
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

“错误”选项卡中也没有任何内容。我试过寻找 clientError: 0 的含义,看看是否无济于事。我也尝试查找 MalformedResponse 错误,但没有获得很多有用的信息。

我尝试了各种移动代码或重写代码,但没有任何改变错误消息。我不知道它为什么会坏。

此操作的日志(https://console.cloud.google.com)说:

MalformedResponse: ErrorId: a5421d80-def5-42ef-ba55-8ac95a879e14. Failed to parse Dialogflow response into AppResponse because of invalid platform response. : Could not find a RichResponse or SystemIntent in the platform response for agentId: 6edfe023-05da-4726-9ee7-6469f0a5fb3d and intentId: 8ad48133-dd71-496c-b5af-d4ec19e88309

我试过搜索它,但找不到太多有用的信息。

我注意到的另一件事是此功能的日志位于 https://console.firebase.google.com好像不更新了我拥有的最后一个日志是在 6 月 2 日,当函数第一次中断时。我不知道为什么它不会更新。如果我运行 firebase functions:log,我会得到更多最近的条目,如下所示:

2019-06-16T22:20:20.246Z I : 
2019-06-16T22:20:21.895Z N dialogflowFirebaseFulfillment:
2019-06-16T22:21:01.674Z N dialogflowFirebaseFulfillment:
2019-06-16T22:27:45.629Z I :
2019-06-16T22:27:47.249Z N dialogflowFirebaseFulfillment:
2019-06-16T22:28:15.351Z N dialogflowFirebaseFulfillment:
2019-06-16T22:59:06.793Z I :
2019-06-16T22:59:08.488Z N dialogflowFirebaseFulfillment:
2019-06-16T22:59:49Z N dialogflowFirebaseFulfillment:

有一次,这些日志在 dialogflowFirebaseFulfillment: 旁边显示“Undefined”,但发生了一些变化,我不知道是什么。

任何帮助将不胜感激,因为此时我已经用尽了我能想到的所有选项。

最佳答案

好吧,我终于明白了。我不确定发生了什么变化,但我认为这是 Dialog Flow 中从 V1 到 V2 的迁移(因此该教程并不真正正确)并且我在错误的 github 文档中寻找帮助。

这一行...

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

需要改为...

exports.fulfillment = functions.https.onRequest(app);

我感觉这与我在 Firebase 上的部署有关,但让我走上正轨的是查看此页面:https://github.com/actions-on-google/actions-on-google-nodejs

特别是讨论框架和导出到适当框架的部分。

希望这对处于类似情况的其他人有所帮助:)

关于dialogflow-es - 应用程序目前没有响应。 MalformedResponse - 在平台响应中找不到 RichResponse 或 SystemIntent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56623335/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com