Google dialogflow how use dynamic respons strings?

时间:2019-04-08 13:57:03

标签: dialogflow

I'm trying to make a simple dialogflow conversation. I have made a simple conversation to ask a person who he is trying to call and than says if a person is available / unavailable, wich is just a text reply. When a person is unavailable i have potentially 3 actions the user can do, leave a voicemail, redirect to a colleague or wait until the person is available,

so the message i would return is " I"m sorry nameOfPerson is not available, would you like to leave a voicemail message, redirect to a colleague or wait until nameOfPerson is available?"

Which works but how can i make it so that lets say there is no voicemail the intent only respons with, "I"m sorry nameOfPerson is not available, would you like to redirect to a colleague or wait until nameOfPerson is available?"

Currently the only way i see to fix this is making 7 intents with all different contexts like:

Intent1: voicemailContext
Intent2: redirectContext
Intent3: voicemailContext, redirectContext
Intent4: waitingContext
Intent5: WaitingContext, redirectContext
Intent6: waitingContext, voicemailContext
intent7: waitingContext,redirectContext, voicemailContext

All that work for just a small adjustment seems way to complicated. Also currently i'm sending those options in a call wich i would much rather not since people could also just say those options and get a match

1 个答案:

答案 0 :(得分:0)

Dialogflow在处理逻辑方面非常差。如您所见,您可以对它进行排序,但这会导致模型过于复杂。要记住的一件事可能对此有所帮助:Intent擅长建模用户所说的 ,但是您仍然要对自己的行为负责。

在许多情况下,更好的方法是将逻辑放在实现网络挂钩中。这使您的代码可以确定最佳响应,然后发送该响应。根据您希望如何构造回复,您还有其他一些选择:

  • 您可以在回复中发回上下文。这样可以限制用户回复时可以触发哪些Intent。
  • 另一种方法是只为答复提供一个Intent,而使用Entities表示他们可以做什么。然后,让您满意,再次确定他们是否给了您有效或无效的答复,并做出相应的答复。