Dialogflow天气Webhook连接错误

时间:2018-10-31 06:19:07

标签: python flask google-cloud-platform wsgi dialogflow

fullfillment page出于我的个人兴趣,我想使用weather api创建一个天气聊天机器人。为此,我使用dialogflow但当我按照Dialogflow github进行webhook连接时却得到了错误。 intenta single intent 根据我的api响应生成此json

{
 "responseId": "e37136ba-270b-435d-bfd6-61d83e286d96",
  "queryResult": {
    "queryText": "weather in delhi",
    "action": "weather",
    "parameters": {
      "address": {
        "city": "Delhi"
      },
      "unit": "",
      "date-time": "",
      "date-period": ""
    },
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/plunesweather-a4aa6/agent/sessions/4c9e41c9-a732-b2fd-f311-cdb0b03d8c3b/contexts/weather",
        "lifespanCount": 2,
        "parameters": {
          "date-period": "",
          "address": {
            "city.object": {},
            "city.original": "delhi",
            "city": "Delhi"
          },
          "date-period.original": "",
          "unit": "",
          "unit.original": "",
          "address.original": "delhi",
          "date-time.original": ""
        }
      }
    ],
    "intent": {
      "name": "projects/plunesweather-a4aa6/agent/intents/f1b75ecb-a35f-4a26-88fb-5a8049b92b02",
      "displayName": "weather"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 538
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "code": 13,
    "message": "Webhook call failed. Error: 500 INTERNAL SERVER ERROR"
  }
}

填充请求生成此json

{
  "responseId": "e37136ba-270b-435d-bfd6-61d83e286d96",
  "queryResult": {
    "queryText": "weather in delhi",
    "action": "weather",
    "parameters": {
      "address": {
        "city": "Delhi"
      },
      "unit": "",
      "date-time": "",
      "date-period": ""
    },
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/plunesweather-a4aa6/agent/sessions/4c9e41c9-a732-b2fd-f311-cdb0b03d8c3b/contexts/weather",
        "lifespanCount": 2,
        "parameters": {
          "date-period": "",
          "address": {
            "city.object": {},
            "city.original": "delhi",
            "city": "Delhi"
          },
          "date-period.original": "",
          "unit": "",
          "unit.original": "",
          "address.original": "delhi",
          "date-time.original": ""
        }
      }
    ],
    "intent": {
      "name": "projects/plunesweather-a4aa6/agent/intents/f1b75ecb-a35f-4a26-88fb-5a8049b92b02",
      "displayName": "weather"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 538
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "code": 13,
    "message": "Webhook call failed. Error: 500 INTERNAL SERVER ERROR"
  }
}

实现响应image 最后几个应用程序日志显示错误。由于我是新手,所以我没有得到如何消除这些错误的信息。谢谢。 command line app logs

编辑:当我浏览堆栈驱动器错误报告时,我发现this 寻找这个问题,我发现this

1 个答案:

答案 0 :(得分:0)

该示例中有一个错误,您需要在forecast.py中更改此行:

-        furthest_date_requested = dt.combine(date_start,
-                                             timedelta(days=forecast_length))
+        furthest_date_requested = date_start + timedelta(days=forecast_length)

This has been updated in the source repository,,因此您也可以只提取该存储库。