|
@@ -0,0 +1,425 @@
|
|
|
+package com.qizhen.healsphere;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.qizhen.healsphere.common.ai.BaidubceUtil;
|
|
|
+import com.qizhen.healsphere.common.ai.Knowlege;
|
|
|
+import com.qizhen.healsphere.common.ai.QizhenAssistant;
|
|
|
+import com.qizhen.healsphere.repository.neo4j.entity.BaseEntity;
|
|
|
+import com.qizhen.healsphere.service.EntityService;
|
|
|
+import com.qizhen.healsphere.service.RelationshipService;
|
|
|
+import com.qizhen.healsphere.web.vo.CreateEntityVO;
|
|
|
+import com.qizhen.healsphere.web.vo.RelationshipVO;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.context.annotation.ComponentScan;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@ComponentScan(basePackages = {"com.qizhen.healsphere.model","com.qizhen.healsphere.repository"})
|
|
|
+@SpringBootTest
|
|
|
+public class DataWriteTest {
|
|
|
+ @Autowired
|
|
|
+ RelationshipService relationshipService;
|
|
|
+ @Autowired
|
|
|
+ EntityService entityService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void writeNeo4j() {
|
|
|
+ String startLabel = "疾病";
|
|
|
+ String propertyStr = "并发症\t的并发症有哪些疾病";
|
|
|
+ String[] properties = propertyStr.split(",");
|
|
|
+ for(String property:properties){
|
|
|
+ String[] split = property.split("\t");
|
|
|
+ if(split.length<2){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String endLabel = split[0];
|
|
|
+ List<Knowlege> data = getData(BaidubceUtil.getAccessToken(), property);
|
|
|
+ if(!CollectionUtils.isEmpty(data)) {
|
|
|
+ long startId = -1;
|
|
|
+ for (Knowlege temp:data) {
|
|
|
+ String value = temp.getValue();
|
|
|
+ if(StringUtils.isBlank(value)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(value);
|
|
|
+ BaseEntity fromEntity = createNoExists(startLabel, temp.getEntity());
|
|
|
+ startId = fromEntity.getId();
|
|
|
+ List<RelationshipVO> relationshipList = new ArrayList<>();
|
|
|
+ for(int i=0;i<jsonArray.size();i++){
|
|
|
+ String name = jsonArray.getString(i);
|
|
|
+ if(StringUtils.isEmpty(name)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ BaseEntity toEntity = createNoExists(endLabel, name);
|
|
|
+ Long endId = toEntity.getId();
|
|
|
+ RelationshipVO relationshipVO = new RelationshipVO();
|
|
|
+ relationshipVO.setStartId(startId);
|
|
|
+ relationshipVO.setEndId(endId);
|
|
|
+ relationshipVO.setStartLabel(startLabel);
|
|
|
+ relationshipVO.setEndLabel(endLabel);
|
|
|
+ relationshipVO.setRelationshipType(startLabel+"相关"+endLabel);
|
|
|
+ relationshipList.add(relationshipVO);
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(relationshipList)) {
|
|
|
+ relationshipService.createRelationship(relationshipList);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private BaseEntity createNoExists(String labelName, String name) {
|
|
|
+ BaseEntity nodeByName = entityService.findNodeByName(labelName, name);
|
|
|
+ if(Objects.nonNull(nodeByName)){//节点不存在
|
|
|
+ return nodeByName;
|
|
|
+ }
|
|
|
+ CreateEntityVO createEntity = new CreateEntityVO();
|
|
|
+ createEntity.setName(name);
|
|
|
+ createEntity.setLabel(labelName);
|
|
|
+ return entityService.create(createEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void main() {
|
|
|
+ String accessToken = BaidubceUtil.getAccessToken();
|
|
|
+ String propertyStr = "并发症\t的并发症有哪些疾病"+
|
|
|
+ ",常见并发症\t的常见并发症有哪些疾病" +
|
|
|
+ ",提示病情加重或进展的临床指标\t的诊疗过程或病程中出现哪些指标或情况,可能提示疾病进一步进展、加重或恶化。" +
|
|
|
+ ",早期预警指标\t的早期临床预警指标有哪些" +
|
|
|
+ ",病因\t的病因或常见病因有哪些病因或致病原因" +
|
|
|
+ ",危险因素\t的危险因素或常见危险因素或危险诱发因素有哪些" +
|
|
|
+ ",遗传方式\t的遗传方式有哪些遗传方式(如果该病无遗传方式,可回答“无”)" +
|
|
|
+ ",遗传基因\t的遗传基因名称有哪些遗传基因名称" +
|
|
|
+ ",诱因\t的诱因或诱发因素或常见诱因有哪些诱因" +
|
|
|
+ ",出院标准\t的出院标准有哪些"+
|
|
|
+ ",合并症\t可能合并的疾病有哪些疾病" +
|
|
|
+ ",常合并的疾病\t常见的可能合并的疾病有哪些疾病" +
|
|
|
+ ",护理操作\t相关的护理操作有哪些护理操作名称" +
|
|
|
+ ",护理方案\t是一种疾病,请为该病做一个简要的护理方案" +
|
|
|
+ ",护理方式\t可能用到的护理方式或护理方法有哪些" +
|
|
|
+ ",分期\t的分期有哪些" +
|
|
|
+ ",分型\t的分型有哪些" +
|
|
|
+ ",分型分期标准\t的分型分期标准有哪些" +
|
|
|
+ ",父类\t的父类疾病名称或更大类的疾病名称有哪些疾病名称" +
|
|
|
+ ",严重程度\t按疾病严重程度分类有哪些" +
|
|
|
+ ",子类\t常见的子类疾病或疾病分类分型有哪些疾病" +
|
|
|
+ ",病原学检查\t的病原学检查项目名称有哪些" +
|
|
|
+ ",辅助检查\t的辅助检查项目名称有哪些" +
|
|
|
+ ",实验室检查\t的实验室检查项目名称或化验项目名称或检验项目名称有哪些" +
|
|
|
+ ",随访复查\t随访时需要复查的检查项目名称有哪些" +
|
|
|
+ ",体格检查\t的体格检查项目名称或体查项目名称有哪些" +
|
|
|
+ ",主要体格检查项目\t的主要体格检查项目名称或体查项目名称有哪些" +
|
|
|
+ ",相关B超检查\t相关的B超检查项目名称或超声检查项目名称或彩超检查项目名称有哪些" +
|
|
|
+ ",相关电学检查\t相关的心电图、脑电或肌电检查项目名称有哪些" +
|
|
|
+ ",相关检查\t相关的检查项目名称有哪些" +
|
|
|
+ ",关尿液检查\t相关的尿液检查项目名称或尿检名称有哪些" +
|
|
|
+ ",关血液检查\t相关的血液检查项目名称或血清学检查项目名称有哪些" +
|
|
|
+ ",血清学检查\t的血清学检查项目名称有哪些" +
|
|
|
+ ",相关影像学检查\t相关的影像学检查名称有哪些" +
|
|
|
+ ",诊断相关检查\t诊断相关的检查项目名称或诊断时需要的检查项目名称有哪些" +
|
|
|
+ ",治疗相关检查\t治疗相关检查项目名称或用于指导治疗的检查项目名称有哪些" +
|
|
|
+ ",与…鉴别诊断\t需要鉴别诊断的疾病名称有哪些疾病名称" +
|
|
|
+ ",就诊科室\t的就诊科室有哪些科室名称" +
|
|
|
+ ",最常见的就诊科室\t最常见的就诊科室有哪些科室名称" +
|
|
|
+ ",所属科室\t所属的科室有哪些科室名称" +
|
|
|
+ ",临床表现\t的临床表现有哪些临床表现" +
|
|
|
+ ",症状\t的症状有哪些症状" +
|
|
|
+ ",常见症状\t的常见症状有哪些症状" +
|
|
|
+ ",典型症状\t的典型症状有哪些症状" +
|
|
|
+ ",前驱症状\t的前驱症状或先兆症状有哪些症状" +
|
|
|
+ ",主要症状\t的主要症状有哪些症状";
|
|
|
+
|
|
|
+ saveExel(propertyStr, accessToken,"前半生");
|
|
|
+ }
|
|
|
+
|
|
|
+ static HSSFWorkbook workbook;
|
|
|
+
|
|
|
+ private static void saveExel(String propertyStr, String accessToken,String fileName) {
|
|
|
+ String[] properties = propertyStr.split(",");
|
|
|
+ workbook = new HSSFWorkbook();//这里也可以设置sheet的Name
|
|
|
+ HSSFSheet sheet = workbook.createSheet(fileName);
|
|
|
+ ;//工作表
|
|
|
+ int rows = 0;
|
|
|
+ for(String property:properties){
|
|
|
+ List<Knowlege> data = getData(accessToken, property);
|
|
|
+ if(!CollectionUtils.isEmpty(data)) {
|
|
|
+ for (Knowlege temp:data) {
|
|
|
+ HSSFRow row = sheet.createRow(rows++);
|
|
|
+ row.createCell(0).setCellValue(temp.getEntity() == null ? "" : temp.getEntity());
|
|
|
+ row.createCell(1).setCellValue(temp.getProperty() == null ? "" : temp.getProperty());
|
|
|
+ row.createCell(2).setCellValue(temp.getValue() == null ? "" : temp.getValue());
|
|
|
+ row.createCell(3).setCellValue(temp.getQuestion() == null ? "" : temp.getQuestion());
|
|
|
+ row.createCell(4).setCellValue(temp.getAnswer() == null ? "" : temp.getAnswer());
|
|
|
+ row.createCell(5).setCellValue(temp.getChunk() == null ? "" : temp.getChunk());
|
|
|
+ row.createCell(6).setCellValue(temp.getRefenrece() == null ? "" : temp.getRefenrece());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ save(fileName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static synchronized void save(String fileName) {
|
|
|
+ try {
|
|
|
+ fileName="C:\\Users\\17664\\Desktop\\"+fileName+System.currentTimeMillis()+".xlsx";
|
|
|
+ //文档输出
|
|
|
+ FileOutputStream out = new FileOutputStream(new File(fileName));
|
|
|
+ workbook.write(out);
|
|
|
+ out.close();
|
|
|
+ System.out.println(fileName + "存储完毕");
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static List<Knowlege> getData(String accessToken,String property) {
|
|
|
+ List<Knowlege> list = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ QizhenAssistant qizhenAssistant = new QizhenAssistant();
|
|
|
+ BaidubceUtil baidubceUtil = new BaidubceUtil();
|
|
|
+
|
|
|
+ String diseaseStr = "风湿性心脏病" +
|
|
|
+ ",原发性高血压" +
|
|
|
+ ",急性心肌梗死" +
|
|
|
+ ",急性冠脉综合征" +
|
|
|
+ ",冠状动脉粥样硬化性心脏病" +
|
|
|
+ ",心力衰竭" +
|
|
|
+ ",心源性休克" +
|
|
|
+ ",酒精中毒" +
|
|
|
+ ",咽炎" +
|
|
|
+ ",急性扁桃体炎" +
|
|
|
+ ",变应性鼻炎" +
|
|
|
+ ",慢性鼻窦炎" +
|
|
|
+ ",鼻出血" +
|
|
|
+ ",急性牙髓炎" +
|
|
|
+ ",牙周病" +
|
|
|
+ ",溃疡性口炎" +
|
|
|
+ ",反流性食管炎" +
|
|
|
+ ",胃溃疡" +
|
|
|
+ ",慢性萎缩性胃炎" +
|
|
|
+ ",功能性消化不良" +
|
|
|
+ ",急性阑尾炎" +
|
|
|
+ ",克罗恩病" +
|
|
|
+ ",肠梗阻" +
|
|
|
+ ",肝硬化" +
|
|
|
+ ",急性胰腺炎" +
|
|
|
+ ",过敏性皮炎" +
|
|
|
+ ",湿疹" +
|
|
|
+ ",银屑病" +
|
|
|
+ ",带状疱疹" +
|
|
|
+ ",类风湿性关节炎" +
|
|
|
+ ",系统性红斑狼疮" +
|
|
|
+ ",慢性肾炎" +
|
|
|
+ ",肾病综合征" +
|
|
|
+ ",慢性肾衰竭" +
|
|
|
+ ",肾结石" +
|
|
|
+ ",输尿管结石" +
|
|
|
+ ",膀胱炎" +
|
|
|
+ ",前列腺增生" +
|
|
|
+ ",子宫内膜异位症" +
|
|
|
+ ",卵巢囊肿" +
|
|
|
+ ",痛经" +
|
|
|
+ ",女性更年期综合征" +
|
|
|
+ ",异位妊娠" +
|
|
|
+ ",妊娠剧吐" +
|
|
|
+ ",鼻咽恶性肿瘤" +
|
|
|
+ ",肝恶性肿瘤" +
|
|
|
+ ",乳房恶性肿瘤" +
|
|
|
+ ",宫颈恶性肿瘤" +
|
|
|
+ ",多发性骨髓瘤" +
|
|
|
+ ",急性白血病" +
|
|
|
+ ",血管瘤" +
|
|
|
+ ",子宫平滑肌瘤" +
|
|
|
+ ",新生儿黄疸" +
|
|
|
+ ",新生儿腹泻" +
|
|
|
+ ",缺铁性贫血" +
|
|
|
+ ",地中海贫血" +
|
|
|
+ ",血友病" +
|
|
|
+ ",甲状腺功能减退症" +
|
|
|
+ ",甲状腺功能亢进症" +
|
|
|
+ ",桥本甲状腺炎" +
|
|
|
+ ",2型糖尿病" +
|
|
|
+ ",糖尿病" +
|
|
|
+ ",甲状旁腺功能减退症" +
|
|
|
+ ",卵巢早衰" +
|
|
|
+ ",坏血病" +
|
|
|
+ ",高脂血症" +
|
|
|
+ ",高尿酸血症" +
|
|
|
+ ",精神分裂症" +
|
|
|
+ ",抑郁症" +
|
|
|
+ ",化脓性脑膜炎" +
|
|
|
+ ",帕金森病" +
|
|
|
+ ",癫痫" +
|
|
|
+ ",偏头痛" +
|
|
|
+ ",脑梗死" +
|
|
|
+ ",脑卒中" +
|
|
|
+ ",阻塞性睡眠呼吸暂停综合征" +
|
|
|
+ ",肺栓塞" +
|
|
|
+ ",慢性肺源性心脏病" +
|
|
|
+ ",急性上呼吸道感染" +
|
|
|
+ ",病毒性肺炎" +
|
|
|
+ ",社区获得性肺炎" +
|
|
|
+ ",支气管肺炎" +
|
|
|
+ ",肺炎" +
|
|
|
+ ",支气管哮喘" +
|
|
|
+ ",呼吸衰竭" +
|
|
|
+ ",肺部感染" +
|
|
|
+ ",急性泪腺炎" +
|
|
|
+ ",急性泪囊炎" +
|
|
|
+ ",巩膜炎" +
|
|
|
+ ",角膜炎" +
|
|
|
+ ",中耳炎" +
|
|
|
+ ",风湿性关节炎" +
|
|
|
+ ",颈椎病" +
|
|
|
+ ",颈肩综合征" +
|
|
|
+ ",坐骨神经痛" +
|
|
|
+ ",肩周炎" +
|
|
|
+ ",骨质疏松" +
|
|
|
+ ",锁骨骨折" +
|
|
|
+ ",肱骨骨折" +
|
|
|
+ ",肩关节脱位";
|
|
|
+
|
|
|
+
|
|
|
+ diseaseStr = "急性心肌梗死" +
|
|
|
+ ",急性冠脉综合征";
|
|
|
+
|
|
|
+ String[] diseases = diseaseStr.split(",");
|
|
|
+ for (int i=0;i<diseases.length;i++) {
|
|
|
+ try {
|
|
|
+ String disease = diseases[i];
|
|
|
+ disease = disease.trim();
|
|
|
+ String[] split = property.split("\t");
|
|
|
+ if(split.length<2){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String quetionParty = split[1];
|
|
|
+ String relation = split[0];
|
|
|
+ String question = "#角色设定\n" +
|
|
|
+ "你是一个医生,你的任务是回答医学相关的问题。\n" +
|
|
|
+ "\n" +
|
|
|
+ "#要求\n" +
|
|
|
+ "1、只根据知识库里的知识回答,不要推理,不要发散!\n" +
|
|
|
+ "2、知识库里没有找到相应的知识,则返回\"未找到相关知识\"\n" +
|
|
|
+ "\n" +
|
|
|
+ "请回答:"+disease + quetionParty + "?";
|
|
|
+ Map<String, String> result = qizhenAssistant.getChatResponse(question, QizhenAssistant.getConversationId());
|
|
|
+ String answer = result.get("answer");
|
|
|
+ String references = result.get("references");
|
|
|
+ String defaultReferences = result.get("defaultReferences");
|
|
|
+ String chatResponse = "";
|
|
|
+ if (!("failed".equals(answer) || answer.contains(QizhenAssistant.noAnswer))) {
|
|
|
+ String format = "你是专门处理医学领域文本的关系抽取专家。你将在指定的文本中抽取其中“"+disease+"的"+relation+"”。\n" +
|
|
|
+ "\n" +
|
|
|
+ "#要求\n" +
|
|
|
+ "1、抽取的结果将以JSON数组的形式呈现。每个抽取的“"+relation+"”高度简洁、高度概括,不要要描述性的文字,文字尽量保持在12个字符以内!\n" +
|
|
|
+ "\n" +
|
|
|
+ "#示例\n" +
|
|
|
+ "以抽取主要症状为例\n" +
|
|
|
+ "文本:\n" +
|
|
|
+ "臭汗症的主要症状有全身或局部多汗且有臭味^[1][3][4]^。\n" +
|
|
|
+ "\n" +
|
|
|
+ "局部性臭汗症多发于大汗腺所在部位,如腋窝、腹股沟、足部、肛周、外阴、脐部及女性乳房下等处,以足部、腋部臭汗症最为多见。腋窝臭汗症俗称狐臭,是一种特殊的刺鼻臭味。足部臭汗症常与足部多汗伴发,有刺鼻的臭味^[1][4]^。\n" +
|
|
|
+ "\n" +
|
|
|
+ "全身性臭汗症为一种与种族有关的生理现象,也可见于卫生习惯不良者,服食某些食物(如葱、蒜、芥末)或某些药物(如麝香)后,在个别人中可产生臭汗^[4]^。\n" +
|
|
|
+ "\n" +
|
|
|
+ "输出:[\"全身或局部多汗且有臭味\",\"局部性臭汗症\",\"腋窝臭汗症\",\"足部臭汗症常\",\"全身性臭汗症\"]\n" +
|
|
|
+ "\n" +
|
|
|
+ "2、没有可抽取的“"+relation+"”,则返回空json数组。\n" +
|
|
|
+ "\n" +
|
|
|
+ "本次抽取的文本如下:\n\n";
|
|
|
+
|
|
|
+ String zhiling = format+ answer;
|
|
|
+ System.out.println(zhiling);
|
|
|
+ chatResponse = baidubceUtil.getChatResponse(zhiling, accessToken);
|
|
|
+ chatResponse = filte(chatResponse);
|
|
|
+ JSONArray jsonResult = new JSONArray();
|
|
|
+ if(!StringUtils.isBlank(chatResponse)){
|
|
|
+ try{
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(chatResponse);
|
|
|
+ JSONArray referenceJA = JSONArray.parseArray(references);
|
|
|
+ for(int t=0;t<jsonArray.size();t++){
|
|
|
+ String name = jsonArray.getString(t);
|
|
|
+ JSONObject temp = new JSONObject();
|
|
|
+ temp.put("name", name);
|
|
|
+ JSONArray tempReferenceJA = new JSONArray();
|
|
|
+ for(int r=0;r<referenceJA.size();r++){
|
|
|
+ JSONObject referenceJO = referenceJA.getJSONObject(r);
|
|
|
+ String content = referenceJO.getString("content");
|
|
|
+ if(content.contains(name)){
|
|
|
+ //JSONObject clone = referenceJO.clone();
|
|
|
+ tempReferenceJA.add(referenceJO.getString("title"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ temp.put("reference", tempReferenceJA);
|
|
|
+ if(tempReferenceJA.size()<1){
|
|
|
+ temp.put("defaultReferences", defaultReferences);
|
|
|
+ }
|
|
|
+ jsonResult.add(temp);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("######"+chatResponse);
|
|
|
+ e.printStackTrace();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ addNode(disease, relation, chatResponse,jsonResult.toJSONString(), answer, question, result, list);
|
|
|
+ }else {
|
|
|
+ addNode(disease, relation, "","", answer, question, result, list);
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println("抽取三元组失败!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println("未知错误!");
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void addNode(String disease, String property, String chatResponse,String refences, String answer, String question, Map<String, String> result, List<Knowlege> list) {
|
|
|
+ Knowlege knowlege = new Knowlege();
|
|
|
+ knowlege.setEntity(disease);
|
|
|
+ knowlege.setProperty(property);
|
|
|
+ knowlege.setValue(chatResponse);
|
|
|
+ knowlege.setAnswer(answer);
|
|
|
+ knowlege.setQuestion(question);
|
|
|
+ knowlege.setChunk(result.get("references"));
|
|
|
+ knowlege.setRefenrece(refences);
|
|
|
+ list.add(knowlege);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String filte(String chatResponse) {
|
|
|
+ if (chatResponse.startsWith("```json")) {
|
|
|
+ chatResponse = chatResponse.substring(7);
|
|
|
+ }
|
|
|
+ if (chatResponse.endsWith("```")) {
|
|
|
+ chatResponse = chatResponse.substring(0, chatResponse.length() - 3);
|
|
|
+ }
|
|
|
+ return chatResponse;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|