Commit 580ee3ea authored by luojun's avatar luojun

deepseek优化

parent 32eae563
......@@ -92,7 +92,7 @@ public class DeepSeekAiListener extends EventSourceListener {
//存储聊天记录
chatgptRoleRecordsService.saveRecords(this.stringBuffer.toString(),
ScreenEnum.getByUserName(maxKbChatReq.getUserName()),
Integer.valueOf(maxKbChatReq.getSessionId()), 10001, 0);
Integer.valueOf(maxKbChatReq.getSessionId()), 10001, 0,2);
return;
}
if (completionResponse.getContent()!=null){
......
......@@ -89,11 +89,11 @@ public interface ChatgptRoleRecordsService extends CommonService<ChatgptRoleReco
/**
* 创建聊天记录
*/
void saveRecords(String message, Integer receiverId,Integer sessionId,Integer senderId,Integer isAsk);
void saveRecords(String message, Integer receiverId,Integer sessionId,Integer senderId,Integer isAsk,Integer depth);
/**
* 创建聊天记录
*/
void saveContent(String message, Integer receiverId,Integer sessionId,Integer senderId,Integer isAsk,Integer type,String content);
void saveContent(String message, Integer receiverId,Integer sessionId,Integer senderId,Integer isAsk,Integer depth,Integer type,String content);
}
......@@ -124,26 +124,27 @@ public class ChatgptRoleRecordsServiceImpl extends CommonServiceImpl<ChatgptRole
}
@Override
public void saveRecords(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk) {
ChatgptRoleRecords chatgptRoleRecords = createRecords(message, receiverId, sessionId, senderId, isAsk);
public void saveRecords(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk,Integer depth) {
ChatgptRoleRecords chatgptRoleRecords = createRecords(message, receiverId, sessionId, senderId, isAsk,depth);
save(chatgptRoleRecords);
}
@NotNull
private static ChatgptRoleRecords createRecords(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk) {
private static ChatgptRoleRecords createRecords(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk,Integer depth) {
ChatgptRoleRecords chatgptRoleRecords = new ChatgptRoleRecords();
chatgptRoleRecords.setMessage(message);
chatgptRoleRecords.setReceiverId(receiverId);
chatgptRoleRecords.setSessionId(sessionId);
chatgptRoleRecords.setSenderId(senderId);
chatgptRoleRecords.setIsAsk(isAsk);
chatgptRoleRecords.setIsDepth(depth);
chatgptRoleRecords.setCreateTime(DateUtil.getNowTimestamp());
return chatgptRoleRecords;
}
@Override
public void saveContent(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk, Integer type, String content) {
ChatgptRoleRecords chatgptRoleRecords = createRecords(message, receiverId, sessionId, senderId, isAsk);
public void saveContent(String message, Integer receiverId, Integer sessionId, Integer senderId, Integer isAsk, Integer depth,Integer type, String content) {
ChatgptRoleRecords chatgptRoleRecords = createRecords(message, receiverId, sessionId, senderId, isAsk,depth);
chatgptRoleRecords.setType(type);
chatgptRoleRecords.setContent(content);
save(chatgptRoleRecords);
......
......@@ -60,13 +60,12 @@ public class ChatgptRoleRecordsController {
@ApiOperation("收藏会话")
@GetMapping(value = "collect/list")
public ApiResponse<Object> collectList(String content,String sessionId,Integer isDepth){
public ApiResponse<Object> collectList(String content,String sessionId){
List<ChatgptRoleRecords> list = chatgptRoleRecordsService.lambdaQuery()
.eq(ChatgptRoleRecords::getMessage, content)
.eq(ChatgptRoleRecords::getSessionId,sessionId).list();
list.forEach(i->{
i.setIsCollect(1);
i.setIsDepth(isDepth);
});
chatgptRoleRecordsService.updateBatchById(list);
return ApiResponse.buildSuccess();
......
......@@ -162,11 +162,11 @@ public class VoiceWebSocketServer {
chatgptRoleSessionService.saveRecord(Integer.valueOf(webSocketModel.getSessionId()),
webSocketModel.getData(),10001,ScreenEnum.getByUserName(webSocketModel.getName()));
chatgptRoleRecordsService.saveRecords(webSocketModel.getData(),10001,Integer.valueOf(webSocketModel.getSessionId()),ScreenEnum.getByUserName(webSocketModel.getName()),1,2);
//如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData());
} else if (byId != null && "sendText".equals(webSocketModel.getAction())) {
chatgptRoleRecordsService.saveRecords(webSocketModel.getData(),10001,Integer.valueOf(webSocketModel.getSessionId()),ScreenEnum.getByUserName(webSocketModel.getName()),1);
chatgptRoleRecordsService.saveRecords(webSocketModel.getData(),10001,Integer.valueOf(webSocketModel.getSessionId()),ScreenEnum.getByUserName(webSocketModel.getName()),1,2);
//如果是H5则发送给大屏消息
sendMsgToWeb(memberId,webSocketModel.getData());
......@@ -191,7 +191,7 @@ public class VoiceWebSocketServer {
webSocketModel.getData(),10001,ScreenEnum.getByUserName(webSocketModel.getName()));
}
//创建问题记录
chatgptRoleRecordsService.saveRecords(webSocketModel.getData(),10001,Integer.valueOf(webSocketModel.getSessionId()),ScreenEnum.getByUserName(webSocketModel.getName()),1);
chatgptRoleRecordsService.saveRecords(webSocketModel.getData(),10001,Integer.valueOf(webSocketModel.getSessionId()),ScreenEnum.getByUserName(webSocketModel.getName()),1,1);
PythonApiReq pythonApiReq = new PythonApiReq();
pythonApiReq.setQuestion(webSocketModel.getData());
......@@ -204,7 +204,7 @@ public class VoiceWebSocketServer {
//结束标识
sendMessage(session,JSONObject.toJSONString(WebSocketModel.createBaseMode("done","text","")));
//存储会话记录
chatgptRoleRecordsService.saveContent(analysisData.getData(),ScreenEnum.getByUserName(memberId.split("__")[1]) ,Integer.valueOf(webSocketModel.getSessionId()),10001,0,analysisData.getDataList()!=null?1:0,analysisData.getDataList());
chatgptRoleRecordsService.saveContent(analysisData.getData(),ScreenEnum.getByUserName(memberId.split("__")[1]) ,Integer.valueOf(webSocketModel.getSessionId()),10001,0,1,analysisData.getDataList()!=null?1:0,analysisData.getDataList());
}else if (analysisData.getType().equals(2)){
//左边内容
sendMessage(session,JSONObject.toJSONString(WebSocketModel.createChartMode("reply","text",analysisData.getData(),StringUtils.isNotBlank(analysisData.getFile()) ? "https://newscreen.justh5.com/bg/" + analysisData.getFile() : null)));
......@@ -212,7 +212,7 @@ public class VoiceWebSocketServer {
//结束标识
sendMessage(session,JSONObject.toJSONString(WebSocketModel.createChartMode("done","chart",analysisData.getData(),StringUtils.isNotBlank(analysisData.getFile()) ? "https://newscreen.justh5.com/bg/" + analysisData.getFile() : null)));
//存储会话记录
chatgptRoleRecordsService.saveContent(analysisData.getData(),ScreenEnum.getByUserName(memberId.split("__")[1]),Integer.valueOf(webSocketModel.getSessionId()),10001,0,StringUtils.isNotBlank(analysisData.getFile())?2:0,StringUtils.isNotBlank(analysisData.getFile())?"https://newscreen.justh5.com/bg/" + analysisData.getFile():null);
chatgptRoleRecordsService.saveContent(analysisData.getData(),ScreenEnum.getByUserName(memberId.split("__")[1]),Integer.valueOf(webSocketModel.getSessionId()),10001,0,1,StringUtils.isNotBlank(analysisData.getFile())?2:0,StringUtils.isNotBlank(analysisData.getFile())?"https://newscreen.justh5.com/bg/" + analysisData.getFile():null);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment