Example #1
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));
        }
Example #2
0
 private async Task <string> GenerateKbLinkWithSASToken(int linkExpiracy)
 {
     return(await fileBlob.GenerateSASUriAsync(configuration.GetString("fileBlobContainer"), configuration.GetString("PublicKBDownloadFile"), linkExpiracy));
 }