@inject IRestWrapper RestWrapper @inject ISnackbar Snackbar شما میتوانید سوال های هر بخش ها را به صورت کامل تنظیم نمایید @foreach (var item in PiQuestions) { } @* *@ + افزودن @AiResponse @if (IsProcessing) {

در حال فکر کردن ....

}
@* focus:outline-none focus:ring-2 focus:ring-slate-400 focus:ring-offset-2 focus:ring-offset-slate-50 *@ @code { private MedicalHistoryQuestionType _questionType; private string _questionTitle = string.Empty; private MedicalHistoryPart _questionPart = MedicalHistoryPart.PresentIllness; private bool IsProcessing { get; set; } private MarkupString AiResponse { get; set; } [Parameter] public List PiQuestions { get; set; } = new(); [Parameter] public string ChiefComplaint { get; set; } = string.Empty; private void RemoveQuestion(MedicalHistoryQuestionSDto question) { PiQuestions.Remove(question); } private void AddQuestion() { PiQuestions.Add(new MedicalHistoryQuestionSDto { Part = _questionPart, Question = _questionTitle, QuestionType = _questionType }); _questionTitle = string.Empty; } private async Task AskWithAi() { try { IsProcessing = true; var request = new { content = $"شکایت اصلی بیمار (CC) {ChiefComplaint} است. لطفاً سوالات بخش PI (Present Illness) را در سه دسته زیر تولید کنید: سوالات توضیحی (Open-ended): سوالاتی که بیمار باید توضیح دهد. سوالات بله/خیر (Yes/No): سوالاتی که پاسخ مشخص بله یا خیر دارند. سوالات زمانی (Time-based): سوالاتی مرتبط با زمان شروع، مدت و تغییرات مشکل. لطفاً سوالات مرتبط با سردرد شامل شدت، محل، عوامل تشدیدکننده یا تسکین‌دهنده و علائم همراه (مثل تهوع یا تاری دید) باشد. use html concept for response and just send html and remove , head , html and body tag" }; var response = await RestWrapper.AiRestApi.ChatAsync(request); response = response.Replace("```html", null); response = response.Replace("```", null); response = response.Replace("\\n", null); response = response.Replace(@"""", null); AiResponse = (MarkupString)response; } catch (ApiException ex) { var exe = await ex.GetContentAsAsync(); Snackbar.Add(exe != null ? exe.Message : ex.Content, Severity.Error); } catch (Exception e) { Snackbar.Add(e.Message, Severity.Error); } finally { IsProcessing = false; } } }