聊天时加入基因情况
This commit is contained in:
@@ -3,7 +3,9 @@ package com.peanut.common.utils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.peanut.config.WebSocket;
|
||||
import com.peanut.modules.common.entity.AiChatContent;
|
||||
import com.peanut.modules.common.entity.PrecisionMedicineGene;
|
||||
import com.peanut.modules.common.service.AiChatContentService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.Consts;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
@@ -138,8 +140,31 @@ public class RagFlowApiUtil {
|
||||
}
|
||||
|
||||
//与助手聊天流式
|
||||
public void chatToAssistantStream(String chatId,String chatName,String sessionId,String sessionName,String question,String patientName) {
|
||||
public void chatToAssistantStream(String chatId,String chatName,String sessionId,String sessionName,String question,String patientName,Map<String,Object> geneInfo) {
|
||||
try {
|
||||
String allQuestion = question;
|
||||
if (geneInfo!=null){
|
||||
String geneStr = "";
|
||||
String geneInfoStr = "";
|
||||
String prescriptionStr = "";
|
||||
List<PrecisionMedicineGene> geneList = (List<PrecisionMedicineGene>) geneInfo.get("geneList");
|
||||
for (PrecisionMedicineGene gene:geneList){
|
||||
// geneStr += gene.getName()+"("+gene.getNamecn()+")基因阳性。";
|
||||
if (StringUtils.isEmpty(geneInfoStr)){
|
||||
geneInfoStr = "已知"+gene.getDescription()+"匹配药材:"+gene.getTcmName()+"。";
|
||||
}else {
|
||||
geneInfoStr += gene.getDescription()+"匹配药材:"+gene.getTcmName()+"。";
|
||||
}
|
||||
}
|
||||
allQuestion+=geneStr+geneInfoStr;
|
||||
List<Map<String,Object>> prescriptionList = (List<Map<String, Object>>) geneInfo.get("prescriptionList");
|
||||
if (prescriptionList.size()>0){
|
||||
for (Map<String, Object> prescription:prescriptionList) {
|
||||
prescriptionStr+="基因匹配方剂:"+prescription.get("name")+",方剂组成:"+prescription.get("compose")+"出处:"+prescription.get("source");
|
||||
}
|
||||
allQuestion+=prescriptionStr;
|
||||
}
|
||||
}
|
||||
String userId = ShiroUtils.getUId()+"";
|
||||
Map<String, Object> entity = new HashMap<>();
|
||||
entity.put("question", question);
|
||||
|
||||
Reference in New Issue
Block a user