在我的座席中,用户可以将任意数字(8-12位数)作为他的第一个用户输入。例如,他写道:“111222333”。我需要捕获这个仅数字输入,在我的webhook上验证并返回特定的响应/事件。
我尝试使用@ sys.any,因为数字的系统实体都不合适。然而,它是如此贪婪它(正确)捕获字符。这意味着此类意图实际上将用作默认回退意图。
我尝试使用意图优先级,为此意图禁用机器学习,但没有运气。
任何人都试过这样解决过去的类似问题?我看到的最后一种方法是将Dialogflow和用户频道之间的验证放在专用的服务器/云端功能上,但我宁愿不这样做。
谢谢!
P.S。:建议Dialogflow团队创建@ sys.any-digit发送。
答案 0 :(得分:1)
我在我的应用程序中构建一个Intent来测试你的情况。
我为实体number
添加了一些@sys.number
参数的培训短语。
之后我在我的助手中写下您的号码示例:111222333并且服务器响应:
{
"originalRequest": {
"source": "google",
"version": "2",
"data": {
"isInSandbox": true,
"surface": {
"capabilities": [{
"name": "actions.capability.SCREEN_OUTPUT"
}, {
"name": "actions.capability.AUDIO_OUTPUT"
}, {
"name": "actions.capability.WEB_BROWSER"
}, {
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
}]
},
"inputs": [{
"rawInputs": [{
"query": "111222333",
"inputType": "KEYBOARD"
}],
"arguments": [{
"rawText": "111222333",
"textValue": "111222333",
"name": "text"
}],
"intent": "actions.intent.TEXT"
}],
"user": {
"lastSeen": "2018-04-17T07:40:59Z",
"locale": "fr-FR",
"userId": "1522092989814"
},
"conversation": {
"conversationId": "1523952140275",
"type": "ACTIVE",
"conversationToken": "[\"prenom-followup\"]"
},
"availableSurfaces": [{
"capabilities": [{
"name": "actions.capability.SCREEN_OUTPUT"
}, {
"name": "actions.capability.AUDIO_OUTPUT"
}]
}]
}
},
"id": "70c78adb-b14f-40c0-b766-e15e8a93445d",
"timestamp": "2018-04-17T08:07:09.807Z",
"lang": "fr-fr",
"result": {
"source": "agent",
"resolvedQuery": "111222333",
"speech": "",
"action": "Prenom.Prenom-testNumber",
"actionIncomplete": false,
"parameters": {
"number": "111222333"
},
"contexts": [{
"name": "prenom-followup",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 1
}, {
"name": "actions_capability_screen_output",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 0
}, {
"name": "actions_capability_audio_output",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 0
}, {
"name": "google_assistant_input_type_keyboard",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 0
}, {
"name": "actions_capability_media_response_audio",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 0
}, {
"name": "actions_capability_web_browser",
"parameters": {
"number": "111222333",
"number.original": "111222333"
},
"lifespan": 0
}],
"metadata": {
"matchedParameters": [{
"dataType": "@sys.number",
"name": "number",
"value": "$number",
"isList": false
}],
"intentName": "Prenom - TestNumber",
"isResponseToSlotfilling": false,
"intentId": "22f80258-5673-4ffc-9f5e-93b4bc2df3f6",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"nluResponseTime": 56
},
"fulfillment": {
"speech": "",
"messages": [{
"type": 0,
"speech": ""
}]
},
"score": 1.0
},
"status": {
"code": 200,
"errorType": "success",
"webhookTimedOut": false
},
"sessionId": "1523952140275"
}
JSON响应包含两个部分:originalRequest
,用户入口111222333
和result
,您可以在其中获取并捕获webhook功能的最终数字:
记住Dialogflow system-entities
的{{3}}。