Esempio n. 1
0
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var dbName            = (!string.IsNullOrEmpty(parameters.Database)) ? parameters.Database : Settings.MasterDatabase;
            var publishingTargets = PublishWrapper.GetPublishingTargets(dbName);

            return(IntentInputFactory.Create(IntentInputType.LinkList, publishingTargets));
        }
        public override ConversationResponse Respond(LuisResult result, ItemContextParameters parameters, IConversation conversation)
        {
            var message = "Hmmm. I'm not sure so I've looked up some possible answers for you";

            var path = Context.Server.MapPath("~/sitecore/shell/sitecore.version.xml");

            if (!File.Exists(path))
            {
                return(ConversationResponseFactory.Create(KeyName, string.Empty));
            }

            string    xmlText = File.ReadAllText(path);
            XDocument xdoc    = XDocument.Parse(xmlText);

            var version = xdoc.Descendants("version").First();
            var major   = version.Descendants("major").First().Value;
            var minor   = version.Descendants("minor").First().Value;

            var searchItems = WebSearchRepository
                              .WebSearch($"{result.Query} in Sitecore {major}.{minor}");

            var options = searchItems.WebPages.Value
                          .Take(3)
                          .Select(a => new ListItem(a.Name, a.Url))
                          .ToList();

            var intentInput = IntentInputFactory.Create(IntentInputType.ExternalLinks, options);

            return(ConversationResponseFactory.Create(KeyName, message, true, intentInput));
        }
        public override ConversationResponse Respond(LuisResult result, ItemContextParameters parameters, IConversation conversation)
        {
            var profiles     = ProfileService.GetProfiles();
            var patternCards = ProfileService.GetAllPatternCards();
            var profileCards = ProfileService.GetAllProfileCards();

            var patternParents = patternCards.Select(a => a.Paths.ParentPath).Distinct().Count();
            var profileParents = profileCards.Select(a => a.Paths.ParentPath).Distinct().Count();

            var profilesWithoutPatterns = profiles.Count - patternParents;
            var profilesWithoutProfiles = profiles.Count - profileParents;

            var itemList = new List <ListItem>
            {
                new ListItem(string.Format(Translator.Text("Chat.Intents.SetupPersonalization.CreateProfile"))),     // profile
                new ListItem(string.Format(Translator.Text("Chat.Intents.SetupPersonalization.CreatePatternCard"))), // pattern card
                new ListItem(string.Format(Translator.Text("Chat.Intents.SetupPersonalization.CreateProfileCard"))), // profile card
                new ListItem(Translator.Text("Chat.Intents.SetupPersonalization.AssignProfileCard")),                // add profile card to page or search action
                new ListItem(string.Format(Translator.Text("Chat.Intents.SetupPersonalization.CreateGoal"))),
                new ListItem(Translator.Text("Chat.Intents.SetupPersonalization.AssignGoal"))
            };
            var intentList = IntentInputFactory.Create(IntentInputType.LinkList, itemList);

            return(ConversationResponseFactory.Create(KeyName, Translator.Text("Chat.Intents.SetupPersonalization.ToSetup"), true, intentList));
        }
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var yes     = Translator.Text("Chat.Parameters.Yes");
            var no      = Translator.Text("Chat.Parameters.No");
            var options = new List <ListItem> {
                new ListItem(yes, yes), new ListItem(no, no)
            };

            return(IntentInputFactory.Create(IntentInputType.LinkList, options));
        }
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var dbName = (!string.IsNullOrEmpty(parameters.Database)) ? parameters.Database : Settings.MasterDatabase;
            var db     = DataWrapper.GetDatabase(dbName);

            var options = DataWrapper
                          .GetLanguages(db)
                          .Select(l => LanguageManager.GetLanguageItem(l, db))
                          .Select(a => new ListItem(a.DisplayName, a.DisplayName))
                          .ToList();

            return(IntentInputFactory.Create(IntentInputType.LinkList, options));
        }
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var all      = Translator.Text("Chat.Parameters.All");
            var item     = (Item)conversation.Data[ItemParamName].Value;
            var versions = item
                           .Versions
                           .GetVersionNumbers()
                           .Select(a => new ListItem(a.Number.ToString()))
                           .ToList();

            versions.Insert(0, new ListItem(all, all));

            return(IntentInputFactory.Create(IntentInputType.LinkList, versions));
        }
Esempio n. 7
0
 public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
 {
     return(IntentInputFactory.Create(IntentInputType.None));
 }
        public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
        {
            var indexes = SearchWrapper.GetIndexNames().Concat(new[] { Translator.Text("Chat.Parameters.All") });

            return(IntentInputFactory.Create(IntentInputType.ListSearch, indexes.Select(a => new ListItem(a, a)).ToList()));
        }
Esempio n. 9
0
 public IntentInput GetInput(ItemContextParameters parameters, IConversation conversation)
 {
     return(IntentInputFactory.Create(IntentInputType.ItemSearch, ParamMessage, Parameters));
 }