DialogFlow:如果意图被触发三次,如何存储和重用每次(第一次、第二次和第三次)的参数值?
DialogFlow: if an intent is triggered three times, how to store and reuse the parameters' value of each time (1st, 2nd, and 3rd)?
在 DialogFlow 中:我的意图是用户可能会触发多次。每次如何存储和重复使用参数值?
比如intent名称是“progress_tracking”,另一个intent是“get_progress_report”。
第一次触发“progress_tracking”意图:
User: I have finished only 1/5 of the project in the first 10 minutes. I'm not very confident.
Chatbot: thanks for sharing the progress. You should believe in yourself!
第二次触发“progress_tracking”意图:
User: I have finished only 1/2 of the project. It used 5 minutes. I think I can finish it on time.
Chatbot: Glad you progressed from 1/5 to 1/2. Earlier you are not very confident. How are you feeling now?
第三次触发“progress_tracking”意图:
User: I've done my work! It took me only 30 minutes!
Chatbot: well-done!
触发“get_progress_report”意图:
User: can you give me a report about my progress?
Chatbot: sure! in the first session, you completed 1/5 of the work in 10 minutes. In the second session, you ...........
正在寻找指导!提前致谢!
对于您的用例,我使用了输入和输出的概念 Contexts in my Intents. I also used the concept of conversational turns。
您可以参考以下步骤:
- 我创建了 Intents 并将输入和输出上下文传递给它。
- 我创建了一个自定义实体,即 @values 以将小数数据(½、⅕ 等)存储为 @sys.number 其中 returns 个十进制值 (0.2,0.5).
- 我使用 #context-name.parameter-name 将参数值从一个 Intent 传递到另一个 Intent,对于同一个 Intent,我通过使用$parameter-name 根据这个 doc.
- 您可以根据自己的需要参考下面的输出截图
输出 1 :
输出 2 :
您可以使用下面的代理来检查意图中的上下文流。您需要按照此 doc 将 Zip 代理导入您的项目,它会起作用。
压缩文件: Agent Zip file
在 DialogFlow 中:我的意图是用户可能会触发多次。每次如何存储和重复使用参数值?
比如intent名称是“progress_tracking”,另一个intent是“get_progress_report”。
第一次触发“progress_tracking”意图:
User: I have finished only 1/5 of the project in the first 10 minutes. I'm not very confident.
Chatbot: thanks for sharing the progress. You should believe in yourself!
第二次触发“progress_tracking”意图:
User: I have finished only 1/2 of the project. It used 5 minutes. I think I can finish it on time.
Chatbot: Glad you progressed from 1/5 to 1/2. Earlier you are not very confident. How are you feeling now?
第三次触发“progress_tracking”意图:
User: I've done my work! It took me only 30 minutes!
Chatbot: well-done!
触发“get_progress_report”意图:
User: can you give me a report about my progress?
Chatbot: sure! in the first session, you completed 1/5 of the work in 10 minutes. In the second session, you ...........
正在寻找指导!提前致谢!
对于您的用例,我使用了输入和输出的概念 Contexts in my Intents. I also used the concept of conversational turns。
您可以参考以下步骤:
- 我创建了 Intents 并将输入和输出上下文传递给它。
- 我创建了一个自定义实体,即 @values 以将小数数据(½、⅕ 等)存储为 @sys.number 其中 returns 个十进制值 (0.2,0.5).
- 我使用 #context-name.parameter-name 将参数值从一个 Intent 传递到另一个 Intent,对于同一个 Intent,我通过使用$parameter-name 根据这个 doc.
- 您可以根据自己的需要参考下面的输出截图
输出 1 :
输出 2 :
您可以使用下面的代理来检查意图中的上下文流。您需要按照此 doc 将 Zip 代理导入您的项目,它会起作用。
压缩文件: Agent Zip file