在机器人框架中检索“数字” Luis实体并立即显示

我正在尝试识别与Intent命令关联的实体“数字”。

这是我在路易斯

在机器人框架中检索“数字” Luis实体并立即显示

的实体

我使用Core Bot示例,并让类名称保持不变。 https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/csharp_dotnetcore/13.core-bot

我在flightbooking.cs中添加了“数字”实体

// Built-in entities
            public DateTimeSpec[] datetime;
            public double[] number;

我在flightbookingex.cs中添加了这个

public string Order_Number
            => Entities.number.ToString();

我在这里创建了一个类:Order_Details.cs


namespace microsoft.BotBuilderSamples
{
    public class Order_Details
    {
        public string Order_Number { get; set; }

    }
}

当我想在maindialog.cs中检索结果时

case FlightBooking.Intent.commande:
                    var commandemessagetext = "Voici le bon de commande";
                    var orderDetails = new Order_Details()
                    {
                        // Get destination and origin from the composite entities arrays.
                        Order_Number = luisResult.Order_Number,};

                    var travelDateMsg = { result.Order_Number };

它说Cannot initialize an implicitly-typed variable with an array initializerThe name 'result' does not exist in the current context

我没有找到另一种方法。我想在“案例FlightBooking.Intent.commande”中显示travelDateMsg的结果。在核心bot示例中,它显示在另一个stepcontext中。

我也尝试了以下代码,但是以某种方式无法正常工作。

                case FlightBooking.Intent.commande:

                    var commandemessagetext = "Here the order";

                    var order_count= luisResult.Entities;

                    var messageTexto = $"you have ordered {order_count}";
                    var message = MessageFactory.Text(messageTexto,messageTexto,InputHints.IgnoringInput);
                    await stepContext.Context.SendactivityAsync(message,cancellationToken); 

结果是"you have ordered microsoft.BotBuilderSamples.FlightBooking+_Entities"

有没有一种简单的方法可以在与检测意图的代码相同的代码块中返回某个意图的值?

非常感谢您对此有任何建议

diego0003 回答:在机器人框架中检索“数字” Luis实体并立即显示

回答第二个错误The name 'result' does not exist in the current context是因为您有错字:

case FlightBooking.Intent.commande:
                    var commandemessagetext = "Voici le bon de commande";
                    var orderDetails = new Order_Details()
                    {
                        // Get destination and origin from the composite entities arrays.
                        Order_Number = luisResult.Order_Number,};

                    var travelDateMsg = { result.Order_Number };

那里没有result,那里有luisResult

本文链接:https://www.f2er.com/3113524.html

大家都在问