【发布时间】:2020-07-29 18:24:56
【问题描述】:
我创建了一个聊天机器人,并成功尝试通过卡片响应传递 GIF 图像。但是,在 DialogFlow 上可以很好地查看响应,但 Chatbot Messenger 没有显示任何内容。
这就是我如何称呼我的形象:
# Function 4 --------------------------------------------------------------------------------------------------
def rerun_conversation(req):
rerun_conversation_text=req.get('queryResult').get('parameters').get('rerun_again')
if rerun_conversation_text == "No" or rerun_conversation_text == "no":
return {"fulfillmentMessages": [
{
"card": {
"title": "Enjoy the film",
"imageUri": "https://lh6.googleusercontent.com/lVo4excFqlywxK4iJ-ITrB0QGZR8ZSF59bL46eXylYCjYRA-8J2YqcSosA-AVE8sdcC2tvnKpUBhlYHS9gu6=w1919-h1007"
}
}
]
}
elif rerun_conversation_text == "Yes" or rerun_conversation_text == "yes":
return {"followupEventInput": {"name": "KellyMovieBot","languageCode": "en-US"}}
Dialogflow 中的输出:
但在 Facebook Messenger 中不返回任何内容
我做了更新 - 29.07.2020 - 22:10
return {"fulfillmentMessages": [
{
"platform": "FACEBOOK",
"card": {
"title": "Title: this is a title",
"subtitle": "This is an subtitle. Text can include unicode characters including emoji ????.",
"imageUri": "https://lh6.googleusercontent.com/lVo4excFqlywxK4iJ-ITrB0QGZR8ZSF59bL46eXylYCjYRA-8J2YqcSosA-AVE8sdcC2tvnKpUBhlYHS9gu6=w1919-h1007",
"buttons": [
{
"text": "This is a button",
"postback": "https://assistant.google.com/"
}
]
}
}
]
}
这似乎适用于 Facebook Messenger 响应,但图像再次显示在 Dialogflow 中而不是 Facebook Messenger 中。代码取自this SO question。
在 Messenger 中仍然存在问题
但是,当我成功显示不同的图像时...gif图像来自云端硬盘是否重要?但是 Dialogflow 没有任何问题,只有 Messenger 才有。
不同的静态图片
更新 30.07.2020-基于 cmets
更改此图片 uri“https://lh6.googleusercontent.com/lVo4excFqlywxK4iJ-ITrB0QGZR8ZSF59bL46eXylYCjYRA-8J2YqcSosA-AVE8sdcC2tvnKpUBhlYHS9gu6=w1919-h1007”
到
https://drive.google.com/file/d/1onUvzmNd4cvg4maSA6EpW5uu3py8jYZE/view?usp=sharing
导致了这个(所以我猜只是从驱动器共享图像是不够的):
【问题讨论】:
标签: python facebook dialogflow-es facebook-messenger dialogflow-es-fulfillment