예제 #1
0
        public async Task RefreshKnowledgeBaseFile(IDialogContext context, LuisResult result)
        {
            var eventToSend = new KnowledgeBaseEvent()
            {
                ChannelId      = context.Activity.ChannelId,
                ConversationId = context.Activity.Conversation.Id,
                EventType      = Common.Events.EventType.REFRESHKB,
                UserId         = context.Activity.From.Id
            };

            await eventProvider.SendEventAsync(eventToSend);

            await GenerateKnowledgeBaseFiles();

            await context.PostAsync(messageProvider.GetMessage("KnowledgeBaseRefreshed"));
        }
예제 #2
0
        public async Task ListQuestions(IDialogContext context, LuisResult result)
        {
            var expiracy = configuration.GetConfiguration <int>("privateKbFileExpiracy");
            var link     = await blobStorageProvider.GenerateSASUriAsync(configuration.GetString("KbFilesContainer"), configuration.GetString("privateKbFile"), expiracy);

            if (string.IsNullOrEmpty(link))
            {
                await GenerateKnowledgeBaseFiles();

                link = await blobStorageProvider.GenerateSASUriAsync(configuration.GetString("KbFilesContainer"), configuration.GetString("privateKbFile"), expiracy);
            }

            var eventToSend = new KnowledgeBaseEvent()
            {
                ChannelId      = context.Activity.ChannelId,
                ConversationId = context.Activity.Conversation.Id,
                EventType      = Common.Events.EventType.DOWNLOADKB,
                UserId         = context.Activity.From.Id
            };
            await eventProvider.SendEventAsync(eventToSend);

            await context.PostAsync(string.Format(messageProvider.GetMessage("knowledgeBaseDownload"), link, expiracy));
        }