Dialogflow webhook 响应显示不可用

Dialogflow webhook response is showing not available

dialogflow response

原始 API 响应:

{
  "responseId": "0e78ce0c-0953-49fa-9f6d-33c34720cc6d-83ffff32",
  "queryResult": {
    "queryText": "test",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "This is a text response",
    "fulfillmentMessages": [
      {
        "linkOutSuggestion": {
          "destinationName": "ad",
          "uri": "https://www.google.be/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
        }
      }
    ],
    "intent": {
      "name": "projects/healthbot-xsvrws/agent/intents/91d019fd-7594-459a-bb41-281bea75ac1d",
      "displayName": "webhook test"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 389
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "message": "Webhook execution successful"
  }
}

履行响应:

{
  "fulfillmentText": "This is a text response",
  "fulfillmentMessages": [
    {
      "linkOutSuggestion": {
        "destinationName": "ad",
        "uri": "https://www.google.be/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
      }
    }
  ]
}

完成状态:

Webhook execution successful

我正在从 dotnet mvc api 返回 webhook 响应。我用过Google.Cloud.Dialogflow.V2

当我在 json 以下返回时,它正在工作。

        string testResponse = @"{
              ""fulfillmentText"": ""This is a text response"",
              ""fulfillmentMessages"": [
                {
                            ""card"":
                            {
                                ""title"": ""card title"",
                                ""subtitle"": ""card text"",
                                ""imageUri"": ""https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png"",
                                ""buttons"": [
                                {
                                    ""text"": ""button text"",
                                    ""postback"": ""https://assistant.google.com/""
                                }]
                            }
                }]
            }";

我想在我的项目中使用建议卡片。如有任何帮助,我们将不胜感激。

您正在向 Dialogflow 发送 linkout suggestion。 Link 建议是 Google 助手的元素,而 Dialogflow 的默认模拟器不支持这些。

如果您希望发送可以在默认模拟器中看到的建议,请查看 suggestion chip in the dialogflow fullfilment library, suggestions in the Dialogflow UI or implement a custom button via custom payloads 并将其加载到您自己的自定义聊天机器人中。