连接一个网络服务,它可以询问事情并接收答案?
Hooking up a web service, which can ask things back and receives answers?
是否有可能以某种方式调用 Web 服务,该服务可以询问并接收答案?
让我解释一下:
在家里,我有一个媒体中心,上面放着一些电影。它的内容当然会随着时间的推移而变化:文件会被添加、删除、重命名等等。
现在我想说“嘿 Google,玩绿野仙踪”,然后我的电视上就会播放绿野仙踪了。
因为我知道如何在 .NET 中开发东西,所以家里的 Web 服务 运行 已经存在并且工作正常,电影开始了。我想多亏了 API.ai,我应该可以通过 webhook 功能将它连接到 Google 主页。
但是如果有多个结果,我想问,应该选择哪个结果呢?例如:
- 用户说 "Play Star Wars"
- Google Home 调用我的网络服务,它检查我的磁盘并发现有多部星球大战电影。
- 现在,需要询问用户 "There are multiple results. Which one would you like to see? Star Wars: A new hope, Star Wars: The empire strikes back, ..."
- 用户现在回答 "Star Wars: A new hope"
- Google Home 使用该信息再次调用 Web 服务,成功后回复 "Okay, playing Star Wars: A new hope."
我还没有找到如何用 API.ai 做到这一点。据我了解,API.ai 使用一些参数调用 Web 服务 (JSON),将从 Web 服务收到的响应文本发送回 Google 主页,然后结束。
还是我漏掉了什么?你们知道我如何实现这种情况吗?
或者我们能否以某种方式开发我们的 私有 服务,例如 Google Home 应用程序(Akinator、Dominos、CNBC 等)中列出的服务,或者是只有作为合作伙伴才有可能吗?实际上会很好。
提前致谢!
你需要研究API,api.ai webhook request/response 格式并实现它。看看this tutorial. Then, of course, you will have to poke a hole in your firewall to be able to receive the calls from Google or use ngrok or the BST proxy。
As I understand, API.ai calls the web service with some parameters
(JSON), sends the response text received from the web service back to
Google Home and then just ends.
除非您从您的网络服务发送:
否则该机器人仍处于控制之中
data: {
google: {
expect_user_response: false,
}
}
或在意向窗格API.AI中选中此框
如果您使用的是 ActionsSDKAssistant,请确保您使用的是正确的方法。询问与告知
https://developers.google.com/actions/reference/ActionsSdkAssistant#ask
https://developers.google.com/actions/reference/ActionsSdkAssistant#tell
是否有可能以某种方式调用 Web 服务,该服务可以询问并接收答案?
让我解释一下: 在家里,我有一个媒体中心,上面放着一些电影。它的内容当然会随着时间的推移而变化:文件会被添加、删除、重命名等等。
现在我想说“嘿 Google,玩绿野仙踪”,然后我的电视上就会播放绿野仙踪了。
因为我知道如何在 .NET 中开发东西,所以家里的 Web 服务 运行 已经存在并且工作正常,电影开始了。我想多亏了 API.ai,我应该可以通过 webhook 功能将它连接到 Google 主页。
但是如果有多个结果,我想问,应该选择哪个结果呢?例如:
- 用户说 "Play Star Wars"
- Google Home 调用我的网络服务,它检查我的磁盘并发现有多部星球大战电影。
- 现在,需要询问用户 "There are multiple results. Which one would you like to see? Star Wars: A new hope, Star Wars: The empire strikes back, ..."
- 用户现在回答 "Star Wars: A new hope"
- Google Home 使用该信息再次调用 Web 服务,成功后回复 "Okay, playing Star Wars: A new hope."
我还没有找到如何用 API.ai 做到这一点。据我了解,API.ai 使用一些参数调用 Web 服务 (JSON),将从 Web 服务收到的响应文本发送回 Google 主页,然后结束。
还是我漏掉了什么?你们知道我如何实现这种情况吗?
或者我们能否以某种方式开发我们的 私有 服务,例如 Google Home 应用程序(Akinator、Dominos、CNBC 等)中列出的服务,或者是只有作为合作伙伴才有可能吗?实际上会很好。
提前致谢!
你需要研究API,api.ai webhook request/response 格式并实现它。看看this tutorial. Then, of course, you will have to poke a hole in your firewall to be able to receive the calls from Google or use ngrok or the BST proxy。
As I understand, API.ai calls the web service with some parameters (JSON), sends the response text received from the web service back to Google Home and then just ends.
除非您从您的网络服务发送:
否则该机器人仍处于控制之中data: {
google: {
expect_user_response: false,
}
}
或在意向窗格API.AI中选中此框
如果您使用的是 ActionsSDKAssistant,请确保您使用的是正确的方法。询问与告知
https://developers.google.com/actions/reference/ActionsSdkAssistant#ask https://developers.google.com/actions/reference/ActionsSdkAssistant#tell