简体   繁体   English

将自定义操作和智能家居操作与谷歌助手相结合

[英]combine custom action and smarthome action with google assistant

I created a custom Google action using @assistant/conversation sdk and a smarthome action using actions-on-google sdk.我使用 @assistant/conversation sdk 创建了一个自定义 Google 操作,并使用 actions-on-google sdk 创建了一个智能家居操作。 My first question is, how can I combine both and link then with same backend server.我的第一个问题是,如何将两者结合起来,然后与同一个后端服务器链接。 My second question is, can I import actions-on-google like that: const { actionssdk, smarthome } = require('actions-on-google') or should I import just one type of google actions.我的第二个问题是,我可以像这样导入 actions-on-google: const { actionssdk, smarthome } = require('actions-on-google') 还是应该只导入一种类型的 google 操作。

While you can have a single backend server which has both smart home and conversational actions, you cannot have a single Action with both integrations.虽然您可以拥有一个同时具有智能家居和会话操作的后端服务器,但您不能拥有一个具有两种集成的操作。 Rather, you would need to create two independent projects: one smart home and one conversational.相反,您需要创建两个独立的项目:一个智能家居和一个会话。

You will probably want to define two endpoints, one for each, but both can be hosted in the same backend.您可能想要定义两个端点,每个端点一个,但两者都可以托管在同一个后端。 If you are using Node.js, you can have all the same underlying logic and use a routing system like Express to export /actions/conversation and /actions/smarthome .如果您使用的是 Node.js,则可以拥有所有相同的底层逻辑并使用 Express 之类的路由系统来导出/actions/conversation/actions/smarthome

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM