簡體   English   中英

如何為所選實體提供動態答案作為對話流實現中的參數

[英]How to provide dynamic answer for the selected entity as parameter in dialogflow fulfillment

我有一個實體(項目),它的值是('name'、'colour'、'awards')

我有三個意圖

Intent1 = Welcome Intent (user will get the options in the form of chips)
Intent2 = Select Option (bot will ask question to enter detail for selected option)
Intent3 = Update Option (bot will save the record and ask next option to update.)

Example - 
bot: welcome! what you want to update? name, colour, awards.
user: name
bot: Enter your name.
user: John
bot: record updated, what to update next? name, colour, awards.

現在的問題是獎項有多個要更新的字段,要更新獎項,用戶必須提供三件事(獎項名稱、獎項日期、獎項描述)

我想要的是當用戶從籌碼中選擇獎勵選項時,應該采取新的意圖,我將通過插槽填充獲取所有數據。

首先要記住的是,意圖代表用戶所說的內容,不是您對他們所說的內容進行的操作。 所以說你“去一個意圖”是沒有意義的。

其次,雖然槽填充看起來是個好主意,但它通常會導致進一步的問題,因為它不能很好地處理條件信息,或者如果用戶跳過他們想要更新的內容,它就會處理用戶。

所有這些都可以通過在對話中設置狀態機、您需要什么信息以及他們迄今為止提供的信息來更好地解決。 根據這些設置,您可以自己提示他們下一步的期望。 (您可能還會發現使用一個或多個 Dialogflow 上下文也有助於確定如何接受結果。)

因此,例如,當用戶表示他們正在更新獎勵時,它可能會像這樣工作:

User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?

User: Merit
[This matches the Fallback Intent with an Input Context for 'awards', since it is free-form input. Your fulfillment stores this and sets the 'awards' context with a parameter that we are now prompting for the date.]
Bot: Got it, the award is named Merit. When was it awarded?

User: Today
[This matches an Intent with a training phrase of "<@sys.date>" and the Input Context of 'awards'. There are also training phrases for things like "It was awarded <@sys.date>" and so forth. Your fulfillment sets the date and sets the 'awards' context with a parameter that we're now prompting for description.]
Bot: Got it. Awarded on March 1st. What is the description?

User: They were awesome.
[This matches the Fallback Intent with the Input Context of 'awards' again, because it is still free-form input. Our fulfillment, however, knows that this is about the description this time, so it stores it and removes the 'awards' context since we've captured everything.]
Bot: I've recorded that as a description of "they were awesome" - sure thing. That was everything we needed for now. Do you want to update the name, colour, or awards next?

這一切看起來很簡單。 但是考慮一下對話是否是這樣進行的:

User: Awards
[Your fulfillment sets the 'awards' context with a parameter that we are prompting for the name.]
Bot: Ok, I'm going to need the award name, description, and when it was awarded. What is the name?

User: [Having done this many times] They were given the award for Honor yesterday
[This might match an Intent with an Input Context of 'awards' and the training phrase of "Given the award for <@sys.any> <@sys.date>" and possibly "<@sys.date> they got an award for <@sys.any>". Your fulfillment sets the name and date from this, sees what information it still needs, and prompts with...]
Bot: Got it. Award named Honor. Awarded March 1. What is the description?

User: Actually, it is named Honorable Service
[This matches an Intent with a training phrase of "named <@sys.any>" and an Input Context for 'awards'. Your fulfillment changes the name stored, checks what we still need, and again prompts...]
Bot: Ok, I've changed the award name to Honorable Service. What is the description?

第一種情況可以通過槽填充和簡單提示來處理,但第二種情況不能。 能夠處理來自人們的更自然的反應和更靈活的提示對您的用戶來說會更好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM