简体   繁体   English

尝试使用Dialogflow V2 API中的自定义事件更新intent参数,并且不传递给intent

[英]Trying to update intent parameter using custom events in Dialogflow V2 API and its not passing through to the intent

In our Dialogflow agent, We have an intent set up with an event called "updateParams" associated with the intent. 在我们的Dialogflow代理中,我们建立了一个意图,该意图与与该意图相关联的事件称为“ updateParams”。 The intent has a parameter called "ExampleEntity" that I would like to update using c# by invoking the event using the Detect Intent API. 该意图具有一个名为“ ExampleEntity”的参数,我想使用c#通过使用Detect Intent API调用该事件来更新该参数。 We are using this version of the sdk Google.Cloud.Dialogflow.V2" Version="1.0.0-beta02" 我们正在使用此版本的sdk Google.Cloud.Dialogflow.V2“ Version =” 1.0.0-beta02“

            queryInput.Event = new EventInput
            {
                Name = "updateParams",

                Parameters = new Struct
                {                        
                    Fields = {{ "ExampleEntity",Value.ForString("Bla")}} 
                },
                LanguageCode = languageCode
            };

An example of the response can be seen here. 可以在此处看到响应示例。 As you can see the "ExampleEntity" parameter isn't being updated as per the request: 如您所见,“ ExampleEntity”参数并未根据请求进行更新: 在此处输入图片说明

Any tips on where we're going wrong? 关于我们要去哪里的任何提示? We're fairly new to Dialogflow so it is probably something simple. 我们是Dialogflow的新手,所以它可能很简单。

Your code looks okay. 您的代码看起来还不错。
However, in your intent, you need to provide default value of the entity ExampleEntity . 但是, ExampleEntity您的意图,您需要提供实体ExampleEntity 默认值

Give it as : #event_name.entity_name #event_name.entity_name为: #event_name.entity_name
Your event is updateParams and entity name is ExampleEntity , so in this case default value will be #updateParams.ExampleEntity 您的事件是updateParams ,实体名称是ExampleEntity ,因此在这种情况下,默认值将是#updateParams.ExampleEntity

This way, when your intent is invoked through the event with the values passed, ExampleEntity will know from where to pick up the default value. 这样,当通过事件调用您的意图并传递值时, ExampleEntity将知道从何处获取默认值。

You can check out this answer for details as well. 您也可以查看答案以获取详细信息。

Hope it helps. 希望能帮助到你。

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

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