mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 19:36:50 +08:00
案例助手:聊天增加上传时间和企业信息
This commit is contained in:
@@ -15,6 +15,8 @@ import com.xboe.module.boecase.service.IAiAccessTokenService;
|
|||||||
import com.xboe.module.boecase.service.ICaseAiChatService;
|
import com.xboe.module.boecase.service.ICaseAiChatService;
|
||||||
import com.xboe.module.boecase.vo.CaseAiMessageVo;
|
import com.xboe.module.boecase.vo.CaseAiMessageVo;
|
||||||
import com.xboe.module.boecase.vo.CaseReferVo;
|
import com.xboe.module.boecase.vo.CaseReferVo;
|
||||||
|
import com.xboe.system.organization.vo.OrgSimpleVo;
|
||||||
|
import com.xboe.system.user.service.IUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
import okhttp3.sse.EventSource;
|
import okhttp3.sse.EventSource;
|
||||||
@@ -65,6 +67,9 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAiAccessTokenService aiAccessTokenService;
|
private IAiAccessTokenService aiAccessTokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserService userService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CaseAiConversationsDao caseAiConversationsDao;
|
private CaseAiConversationsDao caseAiConversationsDao;
|
||||||
|
|
||||||
@@ -180,10 +185,10 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sseEmitter.send(responseData.toJSONString());
|
||||||
|
} else {
|
||||||
|
sseEmitter.send(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送给前端
|
|
||||||
sseEmitter.send(data);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("调用接口处理监听数据时发生异常", e);
|
log.error("调用接口处理监听数据时发生异常", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -409,11 +414,6 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 构建返给前端的数据结构
|
// 构建返给前端的数据结构
|
||||||
JSONObject modifiedResponse = new JSONObject();
|
|
||||||
modifiedResponse.put("success", true);
|
|
||||||
modifiedResponse.put("code", 0);
|
|
||||||
modifiedResponse.put("message", "业务处理成功");
|
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
data.put("status", 0);
|
data.put("status", 0);
|
||||||
data.put("conversationId", conversationData.conversationId);
|
data.put("conversationId", conversationData.conversationId);
|
||||||
@@ -448,10 +448,8 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
|||||||
data.put("fileRefer", newFileRefer);
|
data.put("fileRefer", newFileRefer);
|
||||||
data.put("suggestions", responseData.get("suggestions"));
|
data.put("suggestions", responseData.get("suggestions"));
|
||||||
|
|
||||||
modifiedResponse.put("data", data);
|
|
||||||
|
|
||||||
log.info("处理文件引用成功,返回 {} 个案例引用", currentCaseRefers.size());
|
log.info("处理文件引用成功,返回 {} 个案例引用", currentCaseRefers.size());
|
||||||
return modifiedResponse;
|
return data;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("处理文件引用并构建响应数据异常", e);
|
log.error("处理文件引用并构建响应数据异常", e);
|
||||||
@@ -519,13 +517,17 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
|||||||
if (caseEntity == null) {
|
if (caseEntity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String authorUserId = caseEntity.getAuthorId();
|
||||||
|
OrgSimpleVo authorOrg = userService.findOrgByUserId(authorUserId);
|
||||||
// 构建 CaseReferVo
|
// 构建 CaseReferVo
|
||||||
CaseReferVo caseRefer = new CaseReferVo();
|
CaseReferVo caseRefer = new CaseReferVo();
|
||||||
caseRefer.setCaseId(caseEntity.getId());
|
caseRefer.setCaseId(caseEntity.getId());
|
||||||
caseRefer.setTitle(caseEntity.getTitle());
|
caseRefer.setTitle(caseEntity.getTitle());
|
||||||
caseRefer.setAuthorName(caseEntity.getAuthorName());
|
caseRefer.setAuthorName(caseEntity.getAuthorName());
|
||||||
caseRefer.setContent(caseEntity.getContent());
|
caseRefer.setContent(caseEntity.getContent());
|
||||||
|
caseRefer.setUploadTime(caseEntity.getSysCreateTime());
|
||||||
|
caseRefer.setOrgInfo(authorOrg.getName());
|
||||||
|
|
||||||
// 构建关键词列表
|
// 构建关键词列表
|
||||||
List<String> keywords = new ArrayList<>();
|
List<String> keywords = new ArrayList<>();
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.xboe.module.boecase.vo;
|
package com.xboe.module.boecase.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,6 +28,18 @@ public class CaseReferVo {
|
|||||||
*/
|
*/
|
||||||
private String authorName;
|
private String authorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织信息
|
||||||
|
*/
|
||||||
|
private String orgInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private LocalDateTime uploadTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关键词列表
|
* 关键词列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user