无法从AWS Lex Intent分离自定义插槽类型(.net SDK)

时间:2018-09-10 12:10:48

标签: amazon-web-services amazon-lex slots

我试图通过将null值传递给slot参数,从而通过.NET SDK将我的自定义插槽与Lex意图分离。但它仍显示意图的位置。下面是我用来从意图中添加和删除广告位的代码。

            List<Slot> slots = new List<Slot>();
            if (intentGuide.Slots != null)
            {
                slots = intentGuide.Slots
                .Select(x => new Amazon.LexModelBuildingService.Model.Slot
                {
                    Name = x.Name,
                    Description = "",
                    SlotType = slotTypes.FirstOrDefault(z=>z.SlotTypeId == x.SlotTypeId).Name,
                    SlotTypeVersion = "$LATEST",
                    SlotConstraint = x.IsRequired == true ? "Required" : "Optional",
                    ValueElicitationPrompt = new Prompt
                    {
                        MaxAttempts = 1,
                        Messages = new List<Amazon.LexModelBuildingService.Model.Message> {
                        new Amazon.LexModelBuildingService.Model.Message {
                            Content = x.Prompt,
                            ContentType = "PlainText"
                            },
                        }
                    }
                }).ToList();
            }


            PutIntentRequest request = new PutIntentRequest
            {
                Name = intentGuide.Name,
                Checksum = AmazonLexService.GetIntentCheckSum(intentGuide.Name),
                ConclusionStatement = new Statement
                {
                    Messages = responseMessages,
                },
                Description = "",
                FulfillmentActivity = new FulfillmentActivity { Type = "ReturnIntent" },
                SampleUtterances = intentGuide.Utterances.Select(x => x.Text).ToList(),
                Slots = slots
            };

            return AmazonLexService.PutIntentHelper(request, out ErrorMessage);

0 个答案:

没有答案