我想创建一个ChatBot,用户(主要)从芯片建议中选择。我不明白如何在Flask中构建芯片建议。
以下代码将生成null:
@app.route('/webhook', methods=['POST'])
def webhook():
two_chips = jsonify(fulfillment_text="This message is from Dialogflow's testing!",
fulfillment_messages=[
{
"payload": {
"richContent": [
[
{
"type": "chips",
"options": [
{
"text": "HIV Testing Schedule",
"link": "https://example.com" #Links work, but I don't want links
},
{
"link": "https://example.com",
"text": "PreP"
}
]
}
]
]
}
}])
return two_chips理想情况下,点击按钮将触发新的动作/意图,机器人将以更具体的文本进行响应。也就是说,我应该用什么替换link字段?
这个link表明有一个replyMetadata字段,但这似乎是特定于kommunicate的,而不是谷歌?
我看过flask-dialogflow,但是文档对我来说太稀疏和冲突了。
发布于 2021-06-05 16:25:08
发布于 2021-06-08 00:12:41
你在寻找像下面这样的建议筹码吗?

您分享的示例负载来自Kommunicate免责声明:我是founder @kommunicate,它特定于Kommunicate平台的链接按钮。似乎你正在寻找的是直接按钮/建议芯片,这是来自Kommunicate的正确文档:https://docs.kommunicate.io/docs/message-types#suggested-replies As Kommunicate支持全方位和多平台web、android、iOS、whatsapp、LINE、facebook等,因此Kommunicate支持自己丰富的消息有效负载以及对话流特定的有效负载。
对于Dialogflow特定的建议芯片,请使用:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "These are suggestion chips."
}
},
{
"simpleResponse": {
"textToSpeech": "Which type of response would you like to see next?"
}
}
],
"suggestions": [
{
"title": "Suggestion 1"
},
{
"title": "Suggestion 2"
},
{
"title": "Suggestion 3"
}
],
"linkOutSuggestion": {
"destinationName": "Suggestion Link",
"url": "https://assistant.google.com/"
}
}
}
}
}https://stackoverflow.com/questions/67842975
复制相似问题