[英]DialogFlow Google Assistant Webhook Response: “Empty speech response”
我在使用Dialogflow的Fulfillment / Webhook時遇到了一些麻煩。 我創建了一個Intent,它接受一個參數作為輸入(引腳號)。 使用Webhook調用在服務器端“驗證”該引腳。 也就是說,選中“為此意圖啟用webhook調用”。 該方法在成功驗證時返回正消息。
只要我使用Dialogflow控制台的“立即嘗試”窗口,整個場景就能完美運行。 但是當我嘗試在Google智能助理模擬器中測試時,它會響應:
也,
這是意圖:
我已設置從Webhook調用返回的響應:
"messages": [
{
"speech": "Thanks. Your pin has been confirmed.",
"type": 0
}
此處的示例響應: https : //dialogflow.com/docs/fulfillment
請注意,我已經檢查了錯誤“空語音響應” 。 它沒有幫助。
這是一個很好的問題,文檔對於有效的回復看起來有點不清楚。
在回復Google智能助理的消息時,您應該使用speech
和displayText
參數進行響應。 所以等效的反應會是這樣的
{
"speech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed."
}
但是,如果您要在Google功能(卡片,功能請求等)上執行其他操作,或者甚至只是在與用戶交談時保持對話打開,那么您需要將data.google
對象用作以及可能包含simpleResponse
作為回復的一部分。 這可能看起來像這樣:
{
"speech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed.",
"data": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "Thanks. Your pin has been confirmed.",
"displayText": "Thank you. We have confirmed your PIN and you can proceed."
}
}
]
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.