简体   繁体   English

如何在对话框流中将必需的字段添加到上下文参数

[英]how add a required filed to context parameters in dialog flow

In the chat application i am developing with dialog flow has scenario like this. 在聊天应用程序中,我正在使用对话框流程开发这种情况。 Users can ask details about loans that they can get. 用户可以询问有关可获得贷款的详细信息。 that is a one intent. 这是一个意图。 once user says the loan type they want i need to save it and use it every where when they ask question. 一旦用户说出贷款类型,他们想要我需要保存它,并在他们提出问题时在任何地方使用它。 for one example i have a another intent called loan payments. 例如,我还有另一种意图,即贷款支付。 In that intent they can ask questions like 为此,他们可以提出类似的问题

I am interested in getting a personal loan for a duration of 5 years and the loan amount would be 5 million rupees. 我有兴趣获得为期5年的个人贷款,贷款金额为500万卢比。 Can you let me know the monthly repayment amount? 您能告诉我每月还款额吗?

to calculate that, loan type is a must (personal loan in this case). 要计算,贷款类型是必须的(在这种情况下为个人贷款)。 so if any user has specified the loan type before i need to use it here other wise i need to ask users to provide it again. 因此,如果有任何用户在我需要在这里使用它之前指定了贷款类型,则我需要请用户再次提供它。 but if i am using context i cant add add required. 但是,如果我使用上下文,则无法添加添加。 how to achieve this. 如何做到这一点。 also since i have already set the parameters i cant change the value of them. 也因为我已经设置了参数,所以我无法更改它们的值。 this is how my parameters look like 这是我的参数的样子

在此处输入图片说明

This is where your business logic comes in picture. 这就是您的业务逻辑的体现。 Chat application can be built in two ways, directional & open-ended . 聊天应用程序可以通过两种方式构建: 定向和开放式 In first one, you can explicitly go on asking few questions with set options/buttons for the services that you're offering & user has to select any one of them or in the second one, you keep it open for people to type-in anything & then you extract values & respond them based on their inputs. 在第一个中,您可以使用要设置的选项/按钮针对要提供的服务明确地继续问几个问题,而用户必须选择其中的一个,或者在第二个中,您可以让其他人继续输入任何东西,然后您提取值并根据其输入来响应它们。

Now that you're of second type, even if you use contexts, dialogflow offers you a favor to extract parameter values of first intent in the second one. 现在您已经是第二类,即使您使用上下文,dialogflow也可以帮助您提取第二个中第一个意图的参数值。 You just have to use, #context_name.parameter_name . 您只需要使用#context_name.parameter_name But now, if you're saying that if user has already defined loan type in earlier intent then you don't want to ask him again it in next intent, then this is purely a business logic that you will have to code in your webhook. 但是现在,如果您说的是,如果用户已经在较早的意图中定义了贷款类型,那么您就不想在下一个意图中再次询问他,那么这纯粹是一种业务逻辑,您必须在Webhook中进行编码。 Dialogflow won't do it for you. Dialogflow不会为您做到这一点。

I hope, this answers your question & if you don't want to do it that way, go for directional flow. 希望这能回答您的问题,如果您不想那样做,请进行定向流动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM