diff --git a/src/Shentun.Peis.Application/AIMessages/AIMessageAppService.cs b/src/Shentun.Peis.Application/AIMessages/AIMessageAppService.cs index 953a606..a18312e 100644 --- a/src/Shentun.Peis.Application/AIMessages/AIMessageAppService.cs +++ b/src/Shentun.Peis.Application/AIMessages/AIMessageAppService.cs @@ -76,19 +76,49 @@ namespace Shentun.Peis.AIMessages client.BaseAddress = new Uri(apiBaseAddress); // 设置API密钥或其他认证信息(如果有的话) client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}"); - + //client.DefaultRequestHeaders.Add("Accept", "text/html"); try { var requestBody = new { model = modelValue, messages = new[] { new { role = "user", content = input.Message } } + //response_format = "html" }; var response = await client.PostAsJsonAsync("chat/completions", requestBody); var result = await response.Content.ReadFromJsonAsync(); string data = result.Choices.First().Message.Content; - messageDto.Result = data; + + //string dataHtml = data.Replace("### ", "").Replace("---", "").Replace("-", ""); + //var dataHtmlList = dataHtml.Split("**", StringSplitOptions.RemoveEmptyEntries).ToList(); + //StringBuilder stringBuilder = new StringBuilder(); + //foreach (var item in dataHtmlList) + //{ + // var sindex = dataHtmlList.IndexOf(item) + 1; + // if (sindex > 1) + // { + // if (sindex % 2 == 0) + // { + + // stringBuilder.Append("" + item); + // } + // else + // { + + // stringBuilder.Append("" + item); + // } + // } + // else + // { + // stringBuilder.Append(item); + // } + //} + //messageDto.Result = stringBuilder.ToString(); + + string dataHtml = data.Replace("### ", "").Replace("---", "").Replace("-", "").Replace("**", ""); + + messageDto.Result = dataHtml; } catch (HttpRequestException e) diff --git a/src/Shentun.Peis.Application/SelfServiceMachines/SelfServiceMachineAppService.cs b/src/Shentun.Peis.Application/SelfServiceMachines/SelfServiceMachineAppService.cs index 63013f1..93e3027 100644 --- a/src/Shentun.Peis.Application/SelfServiceMachines/SelfServiceMachineAppService.cs +++ b/src/Shentun.Peis.Application/SelfServiceMachines/SelfServiceMachineAppService.cs @@ -91,7 +91,7 @@ namespace Shentun.Peis.SelfServiceMachines { patientRegisterQuery = patientRegisterQuery.Where(m => m.patientRegister.PatientRegisterNo == input.PatientRegisterNo); } - else if (!string.IsNullOrWhiteSpace(input.PatientRegisterNo)) + else if (!string.IsNullOrWhiteSpace(input.PatientNo)) { patientRegisterQuery = patientRegisterQuery.Where(m => m.patient.PatientNo == input.PatientNo); }