我可以将实体的值指定为特定形式而不是特定值吗?

Can I specify an entity's value as a specific form instead of a specific value?

我有一个实体,每个用户的值可能不同(例如 "Turn on the lights at room XYZ where "room XYZ" 是一个实体的值)。我可以在平台上指定该实体的形式吗room $something 我该怎么做?

响应不是问题,因为它将由后端处理。问题是我如何将整个值 "room XYZ" 而不是 "room"

发送到后端

您正在查看这些参数的实体类型。其中,您有几个选择:

  1. 最简单的情况下,您可以将其定义为 @sys.any 类型。那只会将值传递给后端并让它处理错误。 (它确实可以优雅地处理错误的输入,对吧?)

  2. 但是,如果您使用 V2 API 设置特定的实体类型,则可以使用 Dialogflow 的 API. So once you know who the user is, you can get their list of devices, and set each device as a possible value for a user entity type. You'll need to create the entity type ahead of time (it doesn't matter with what) and then use the /userEntities endpoint if you're using the V1 API or the project.agent.sessions.entityTypes 资源在会话开始时设置实体类型该会话的实体。

(选择 1 更容易,选择 2 会给你更好的用户体验。)