使用 Google 助手在 Dialogflow 中的第一个 Intent 响应之前初始化会话实体类型
Initialize Session Entity Types before the first Intent response in Dialogflow with Google Assistant
我的应用当前在欢迎意图响应期间加载会话实体类型。
因此,如果用户说:
与 TestPoemApp 交谈。
我的应用程序将响应:
你好。你想听什么诗?
并且还发送 webhookResponse.SessionEntityTypes 定义实体 "PoemType" (fulfillment method) 的会话实体类型。然后用户可以说:
朗诵我的定制诗
其中 "My Custom Poem" 是实体 "PoemType" 的会话实体类型。 RecitePoem Intent 已启动,一切正常。
但是,如果用户说:
让 TestPoemApp 背诵我的自定义诗歌。 (a.k.a.UserPhrase2)
它不起作用,因为自绕过欢迎 Intent 以来,RecitePoem Intent 在加载会话实体类型之前直接触发。 有没有办法在第一次响应之前或期间加载会话实体类型?
注意 1:我尝试过的一件事是将事件与服务器端插槽填充一起使用。因此,当用户说出 UserPhrase2 时,RecitePoem Intent 会发现所需的 PoemType 参数丢失,并使用定义会话实体类型的 webhookResponse.SessionEntityTypes 进行响应,并且还会引发一个基本上只是重新触发 RecitePoem Intent 的事件。这是行不通的,因为我相信 webhookResponse.SessionEntityTypes 直到事件链结束才被读取(即 SessionEntityTypes 直到重新触发的 RecitePoem 调用响应才会被读取)。我相信这是因为 "When the followupEventInput parameter is set for a WebhookResponse, Dialogflow ignores the fulfillmentText, fulfillmentMessages, and payload fields." 没有特别提到 SessionEntityTypes,但我猜这些也被忽略了。
注意 2:我可以为实体打开 "Allow automated expansion" 并解决这个问题,但我想尽可能避免这种情况,因为我相信实际定义的会话实体类型会更好。
我最终直接向 DialogFlow 支持发送消息并收到了回复,所以我想在这里分享它:
Unfortunately, as of now Dialogflow do not support Session Entity
Types on AoG Deep Links Invocation. Currently, Session entity loads
once the conversation has started.
看来不可能。
我的应用当前在欢迎意图响应期间加载会话实体类型。
因此,如果用户说:
与 TestPoemApp 交谈。
我的应用程序将响应:
你好。你想听什么诗?
并且还发送 webhookResponse.SessionEntityTypes 定义实体 "PoemType" (fulfillment method) 的会话实体类型。然后用户可以说:
朗诵我的定制诗
其中 "My Custom Poem" 是实体 "PoemType" 的会话实体类型。 RecitePoem Intent 已启动,一切正常。
但是,如果用户说:
让 TestPoemApp 背诵我的自定义诗歌。 (a.k.a.UserPhrase2)
它不起作用,因为自绕过欢迎 Intent 以来,RecitePoem Intent 在加载会话实体类型之前直接触发。 有没有办法在第一次响应之前或期间加载会话实体类型?
注意 1:我尝试过的一件事是将事件与服务器端插槽填充一起使用。因此,当用户说出 UserPhrase2 时,RecitePoem Intent 会发现所需的 PoemType 参数丢失,并使用定义会话实体类型的 webhookResponse.SessionEntityTypes 进行响应,并且还会引发一个基本上只是重新触发 RecitePoem Intent 的事件。这是行不通的,因为我相信 webhookResponse.SessionEntityTypes 直到事件链结束才被读取(即 SessionEntityTypes 直到重新触发的 RecitePoem 调用响应才会被读取)。我相信这是因为 "When the followupEventInput parameter is set for a WebhookResponse, Dialogflow ignores the fulfillmentText, fulfillmentMessages, and payload fields." 没有特别提到 SessionEntityTypes,但我猜这些也被忽略了。
注意 2:我可以为实体打开 "Allow automated expansion" 并解决这个问题,但我想尽可能避免这种情况,因为我相信实际定义的会话实体类型会更好。
我最终直接向 DialogFlow 支持发送消息并收到了回复,所以我想在这里分享它:
Unfortunately, as of now Dialogflow do not support Session Entity Types on AoG Deep Links Invocation. Currently, Session entity loads once the conversation has started.
看来不可能。