mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 03:16:48 +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.vo.CaseAiMessageVo;
|
||||
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 okhttp3.*;
|
||||
import okhttp3.sse.EventSource;
|
||||
@@ -65,6 +67,9 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
@Autowired
|
||||
private IAiAccessTokenService aiAccessTokenService;
|
||||
|
||||
@Autowired
|
||||
private IUserService userService;
|
||||
|
||||
@Autowired
|
||||
private CaseAiConversationsDao caseAiConversationsDao;
|
||||
|
||||
@@ -180,10 +185,10 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sseEmitter.send(responseData.toJSONString());
|
||||
} else {
|
||||
sseEmitter.send(data);
|
||||
}
|
||||
|
||||
// 发送给前端
|
||||
sseEmitter.send(data);
|
||||
} catch (IOException e) {
|
||||
log.error("调用接口处理监听数据时发生异常", 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();
|
||||
data.put("status", 0);
|
||||
data.put("conversationId", conversationData.conversationId);
|
||||
@@ -448,10 +448,8 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
data.put("fileRefer", newFileRefer);
|
||||
data.put("suggestions", responseData.get("suggestions"));
|
||||
|
||||
modifiedResponse.put("data", data);
|
||||
|
||||
log.info("处理文件引用成功,返回 {} 个案例引用", currentCaseRefers.size());
|
||||
return modifiedResponse;
|
||||
return data;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理文件引用并构建响应数据异常", e);
|
||||
@@ -519,13 +517,17 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
if (caseEntity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
String authorUserId = caseEntity.getAuthorId();
|
||||
OrgSimpleVo authorOrg = userService.findOrgByUserId(authorUserId);
|
||||
// 构建 CaseReferVo
|
||||
CaseReferVo caseRefer = new CaseReferVo();
|
||||
caseRefer.setCaseId(caseEntity.getId());
|
||||
caseRefer.setTitle(caseEntity.getTitle());
|
||||
caseRefer.setAuthorName(caseEntity.getAuthorName());
|
||||
caseRefer.setContent(caseEntity.getContent());
|
||||
caseRefer.setUploadTime(caseEntity.getSysCreateTime());
|
||||
caseRefer.setOrgInfo(authorOrg.getName());
|
||||
|
||||
// 构建关键词列表
|
||||
List<String> keywords = new ArrayList<>();
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.xboe.module.boecase.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -25,6 +28,18 @@ public class CaseReferVo {
|
||||
*/
|
||||
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