示例#1
0
        public AIResponse TextRequest(AIRequest request)
        {
            var preditor = new BotPreditor();
            var text     = preditor.Predict(agent, request);

            return(null);
        }
示例#2
0
        public AIResponse TextRequest(AIRequest request)
        {
            var preditor   = new BotPreditor();
            var doc        = preditor.Predict(agent, request).Result;
            var parameters = new Dictionary <String, Object>();

            doc.Sentences[0].Entities.ForEach(x => parameters.Add(x.Entity, x.Value));

            return(new AIResponse
            {
                Lang = request.Language,
                Timestamp = DateTime.UtcNow,
                SessionId = request.SessionId,
                Status = new AIResponseStatus(),
                Result = new AIResponseResult
                {
                    Score = doc.Sentences[0].Intent.Confidence,
                    ResolvedQuery = doc.Sentences[0].Text,
                    Fulfillment = new AIResponseFulfillment {
                    },
                    Parameters = parameters,
                    Metadata = new AIResponseMetadata
                    {
                        IntentName = doc.Sentences[0].Intent.Label
                    }
                }
            });
        }