打印原始对话流量查询结果履行消息
我有以下DialogFlow默认值和Facebook响应的意图。
我有一个简单的幻影应用程序,该应用程序在DialogFlowapi对象上调用检测符,该对象返回带有查询结果的响应。我想将原始履行消息打印到控制台上。
...
var response = await df.detectIntent(request, sessionPath);
List<GoogleCloudDialogflowV2IntentMessage> payloads = response.queryResult.fulfillmentMessages;
debugPrint("Got response length: ${payloads.length}");
payloads.forEach((element) => debugPrint(element.payload.toString()));
我得到以下控制台输出:
flutter: Got response length: 3
flutter: {text: this is some default text!, replies: [default option 1, default option 2]}
flutter: null
flutter: {replies: [default option 1, default option 2], text: this is some default text!}
有3个响应,其中2个响应正确打印。它不会打印Facebook响应的快速答复。
I have the following DialogFlow default and Facebook responses for an intent.
I have a simple Flutter app that calls detectIntent on a DialogflowAPI object that returns a response with query result. I want to print the raw fulfilment messages to console.
...
var response = await df.detectIntent(request, sessionPath);
List<GoogleCloudDialogflowV2IntentMessage> payloads = response.queryResult.fulfillmentMessages;
debugPrint("Got response length: ${payloads.length}");
payloads.forEach((element) => debugPrint(element.payload.toString()));
I get the below console output:
flutter: Got response length: 3
flutter: {text: this is some default text!, replies: [default option 1, default option 2]}
flutter: null
flutter: {replies: [default option 1, default option 2], text: this is some default text!}
There are 3 responses, of which 2 are printed correctly. It does not print the quick replies part of the facebook response.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每个
googleCloudDialogFlowV2intentMessage
具有有效载荷
成员,它是JSON的map&lt; string,object?&gt;
。您可以打印出来:或者,
还有一个
tojson()
方法,它可能会为您提供更多完整的信息。您也可以尝试打印它:注:您需要包括
导入'dart:convert';
。Each
GoogleCloudDialogflowV2IntentMessage
has apayload
member, which is a json-likeMap<String, Object?>
. You can print this out:Alternatively
There is also a
toJson()
method, which might give you more complete information. You can try printing that as well:Note: you'll need to include
import 'dart:convert';
.