private async Task StoreKnowledgebaseFile() { var qaText = string.Empty; QuestionWithAnswers.ForEach(qa => { qaText += $"{qa.Question}\r\n"; qaText += $"{qa.Answer}\r\n\r\n"; }); await FileExtensions.WriteAllTextAsync(FileName, qaText); }
private async Task Analyze() { FileName = _markdownFileInfo.FullName; Name = _markdownFileInfo.Name.Replace(".md", "").ToLowerInvariant(); Text = await FileExtensions.ReadAllTextAsync(_markdownFileInfo.FullName); Lines = Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList(); Lines.ForEach(l => { l = l.Trim(); if (!AddQuestion(l)) { AddAnswer(l); } }); AddQuestionWithAnswer(); }