DialogFlow ES对接Google Assistant故障求助:Webhook无法正常工作
问题描述
我在DialogFlow ES上搭建了可正常运行的Webhook,通过HTTP请求调用Solar Edge API获取太阳能发电量数据。该Webhook在DialogFlow控制台中运行完全正常,但无法在Google Assistant中正常工作,寻求技术支持。
相关日志
Webhook执行成功响应日志
{ "responseId": "057d13b6-22c7-4951-94be-28d6f5c5ab34-3a30f4d6", "queryResult": { "queryText": "Quelle est ma production actuelle?", "parameters": { "geo-city": "", "location": "", "date-time": { "date_time": "2023-10-17T10:54:01+02:00" } }, "allRequiredParamsPresent": true, "fulfillmentText": "La production d'énergie actuelle est de 1001.6812 watts.", "fulfillmentMessages": [ { "text": { "text": [ "La production d'énergie actuelle est de 1001.6812 watts." ] } } ], "intent": { "name": "projects/solar-edge-notifications/locations/europe-west1/agent/intents/22fc96c5-68ed-4d07-83ac-30af0a34e5da", "displayName": "getSolarData" }, "intentDetectionConfidence": 0.68192226, "diagnosticInfo": { "webhook_latency_ms": 2921 }, "languageCode": "fr", "sentimentAnalysisResult": { "queryTextSentiment": {} } }, "webhookStatus": { "message": "Webhook执行成功" }, "agentId": "c5fdd86d-6185-4de0-b77c-ce1394edc722" }
DialogFlow控制台请求日志
{ "responseId": "057d13b6-22c7-4951-94be-28d6f5c5ab34-3a30f4d6", "queryResult": { "queryText": "Quelle est ma production actuelle?", "parameters": { "date-time": { "date_time": "2023-10-17T10:54:01+02:00" }, "location": "", "geo-city": "" }, "allRequiredParamsPresent": true, "fulfillmentMessages": [ { "text": { "text": [ "" ] } } ], "outputContexts": [ { "name": "projects/solar-edge-notifications/locations/europe-west1/agent/sessions/f2156d38-71ad-b60f-1cb2-cf98d20d5d05/contexts/__system_counters__", "parameters": { "no-input": 0, "no-match": 0, "date-time": { "date_time": "2023-10-17T10:54:01+02:00" }, "date-time.original": "actuelle", "location": "", "location.original": "", "geo-city": "", "geo-city.original": "" } } ], "intent": { "name": "projects/solar-edge-notifications/locations/europe-west1/agent/intents/22fc96c5-68ed-4d07-83ac-30af0a34e5da", "displayName": "getSolarData" }, "intentDetectionConfidence": 0.68192226, "languageCode": "fr" }, "originalDetectIntentRequest": { "source": "DIALOGFLOW_CONSOLE", "payload": {} }, "session": "projects/solar-edge-notifications/locations/europe-west1/agent/sessions/f2156d38-71ad-b60f-1cb2-cf98d20d5d05" }
Webhook返回内容
{ "fulfillmentText": "La production d'énergie actuelle est de 1001.6812 watts.", "outputContexts": [] }
排查建议
- 响应格式适配:Google Assistant需要符合Actions规范的响应结构,仅返回
fulfillmentText可能无法正常渲染。建议在Webhook响应中添加fulfillmentMessages并使用simpleResponses类型,确保消息兼容Assistant展示逻辑。 - 优化Webhook响应速度:日志显示Webhook延迟达2921ms,Assistant的超时阈值可能比控制台更严格。需优化Solar Edge API调用逻辑,比如添加数据缓存、简化请求处理流程,将响应时间控制在合理范围内。
- 上下文处理检查:Assistant请求包含系统上下文
__system_counters__,需确认Webhook是否正确处理上下文参数,避免因上下文差异导致响应异常。 - 本地化验证:当前交互语言为法语,需确保返回内容符合Assistant法语地区的展示要求,避免特殊字符或格式导致渲染失败。
内容的提问来源于stack exchange,提问作者Thibault Wislez
相关产品推荐
相关产品推荐

