添加消息最大记忆数
This commit is contained in:
parent
87b7512d44
commit
594d1b377c
@ -0,0 +1,25 @@
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
host: krcia.top
|
||||
port: 6379
|
||||
password: xiong990416.
|
||||
database: 3
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://krcia.top:3306/elysia-db?serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: xiong990416.
|
||||
elysia-authorization:
|
||||
version: v0.3-0909
|
||||
enable-cors: true
|
||||
enable-api-doc: true
|
||||
mail:
|
||||
host: smtp.qq.com
|
||||
port: 465
|
||||
username: krcia@qq.com
|
||||
auth-code: ghylxjvfnnjqdfhe
|
||||
enable-ssl: true
|
||||
metadata-save:
|
||||
path: /app/metadata
|
||||
agent-url: http://192.168.1.2:4562/oss
|
||||
File diff suppressed because one or more lines are too long
@ -25,15 +25,16 @@ import top.krcia.elysiaserver.utils.JWTGenerator;
|
||||
import top.krcia.elysiaserver.utils.P;
|
||||
import top.krcia.elysiaserver.utils.U;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ChatServiceImpl implements ChatService {
|
||||
|
||||
@Value("${elysia-authorization.metadata-save.agent-url}")
|
||||
private String agentUrl;
|
||||
|
||||
@Value("${elysia-chat.max-memory}")
|
||||
private int maxMemory;
|
||||
@Resource
|
||||
private ChatRoomDao chatRoomDao;
|
||||
@Resource
|
||||
@ -87,14 +88,17 @@ public class ChatServiceImpl implements ChatService {
|
||||
chatRoomRecordDao.addMessage(messageId, chatRoom.getRoomId(), 1, message, new Date());
|
||||
IPage<ChatRoomRecord> iPage = new Page();
|
||||
iPage.setCurrent(1);
|
||||
iPage.setSize(100);
|
||||
iPage.setSize(maxMemory);
|
||||
QueryWrapper<ChatRoomRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderByAsc("chat_date");
|
||||
queryWrapper.orderByDesc("chat_date");
|
||||
iPage = chatRoomRecordDao.selectPage(iPage, queryWrapper, roomId);
|
||||
SysUser sysUser = new SysUser(userId);
|
||||
sysUser = sysUserDao.selectById(sysUser);
|
||||
RobotTemplate robotTemplate = robotTemplateDao.selectById(new RobotTemplate(robot.getTemplateId()));
|
||||
ReplyQueue replyQueue = new ReplyQueue(sysUser.getUserId(), roomId, iPage.getRecords(), sysUser.getDeepseekKey(), chatRoom.getEngine(), chatRoom.getRoomName(), agentUrl + chatRoom.getRoomImage(), robot.getSystemPrompt(), robotTemplate.getContent(), robotTemplate.getTemperature());
|
||||
List<ChatRoomRecord> messageH = new ArrayList<>();
|
||||
messageH.addAll(iPage.getRecords());
|
||||
Collections.reverse(messageH);
|
||||
ReplyQueue replyQueue = new ReplyQueue(sysUser.getUserId(), roomId, messageH, sysUser.getDeepseekKey(), chatRoom.getEngine(), chatRoom.getRoomName(), agentUrl + chatRoom.getRoomImage(), robot.getSystemPrompt(), robotTemplate.getContent(), robotTemplate.getTemperature());
|
||||
robotReplyTask.addTask(replyQueue);
|
||||
chatRoom.setLastChatTime(new Date());
|
||||
chatRoomDao.updateById(chatRoom);
|
||||
|
||||
@ -31,7 +31,7 @@ public class ChatSocketHandler extends TextWebSocketHandler {
|
||||
sessions.put(userId, session);
|
||||
// 上线发送最近一条消息
|
||||
if (offlineMessage.containsKey(userId)) {
|
||||
sendDelayedMessage(session, offlineMessage.get(userId), 15);
|
||||
// sendDelayedMessage(session, offlineMessage.get(userId), 15);
|
||||
try {
|
||||
offlineMessage.remove(userId);
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -21,3 +21,5 @@ elysia-authorization:
|
||||
metadata-save:
|
||||
path: ./metadata/
|
||||
agent-url: http://192.168.1.2:4563/oss
|
||||
elysia-chat:
|
||||
max-memory: 300
|
||||
@ -1,37 +1,25 @@
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.8.88
|
||||
host: krcia.top
|
||||
port: 6379
|
||||
password: xiong990416.
|
||||
database: 3
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.8.88:3306/elysia-db?serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://krcia.top:3306/elysia-db?serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: xiong990416.
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB # 单个文件最大 10MB
|
||||
max-request-size: 20MB # 整个请求最大 20MB
|
||||
elysia-authorization:
|
||||
version: v0.1-0909-dev
|
||||
enable-cors: true
|
||||
enable-api-doc: true
|
||||
mail:
|
||||
host: smtp.qq.com
|
||||
port: 465
|
||||
username: krcia@qq.com
|
||||
auth-code: ghylxjvfnnjqdfhe
|
||||
enable-ssl: true
|
||||
metadata-save:
|
||||
path: ./metadata/
|
||||
agent-url: http://krcia.top:4560/oss
|
||||
|
||||
#打印数据日志
|
||||
logging:
|
||||
level:
|
||||
#MyBatis SQL 日志
|
||||
top.krcia.elysiaserver.chat.dao: debug # 你的Mapper接口所在包
|
||||
#MyBatis-Plus SQL 日志
|
||||
com.baomidou.mybatisplus.core.override.MybatisMapperProxy: debug
|
||||
org.apache.ibatis: debug
|
||||
java.sql: debug
|
||||
java.sql.Statement: debug
|
||||
java.sql.PreparedStatement: debug
|
||||
path: /app/metadata
|
||||
agent-url: http://127.0.0.1:9091/oss
|
||||
elysia-chat:
|
||||
max-memory: 300
|
||||
File diff suppressed because one or more lines are too long
@ -3,8 +3,8 @@ services:
|
||||
container_name: elysia-authorization
|
||||
image: jdk-17:prod
|
||||
volumes:
|
||||
- ./authorization/:/app/
|
||||
- ./metadata:/app/metadata
|
||||
- /DATA/elysia/authorization/:/app/
|
||||
- /DATA/elysia/metadata:/app/metadata
|
||||
command:
|
||||
- java
|
||||
- -Dfile.encoding=UTF-8
|
||||
@ -15,8 +15,8 @@ services:
|
||||
container_name: elysia-chat
|
||||
image: jdk-17:prod
|
||||
volumes:
|
||||
- ./chat/:/app/
|
||||
- ./metadata:/app/metadata
|
||||
- /DATA/elysia/chat/:/app/
|
||||
- /DATA/elysia/metadata:/app/metadata
|
||||
command:
|
||||
- java
|
||||
- -Dfile.encoding=UTF-8
|
||||
@ -27,8 +27,8 @@ services:
|
||||
container_name: elysia-server
|
||||
image: jdk-17:prod
|
||||
volumes:
|
||||
- ./server/:/app/
|
||||
- ./metadata:/app/metadata
|
||||
- /DATA/elysia/server/:/app/
|
||||
- /DATA/elysia/metadata:/app/metadata
|
||||
command:
|
||||
- java
|
||||
- -Dfile.encoding=UTF-8
|
||||
@ -40,7 +40,7 @@ services:
|
||||
container_name: elysia-nginx
|
||||
image: nginx:latest
|
||||
volumes:
|
||||
- ./nginx/conf/conf.d:/etc/nginx/conf.d
|
||||
- ./nginx/html:/etc/nginx/html
|
||||
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./metadata:/etc/nginx/metadata
|
||||
- /DATA/elysia/nginx/conf/conf.d:/etc/nginx/conf.d
|
||||
- /DATA/elysia/nginx/html:/etc/nginx/html
|
||||
- /DATA/elysia/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- /DATA/elysia/metadata:/etc/nginx/metadata
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
spring:
|
||||
data:
|
||||
redis:
|
||||
host: krcia.top
|
||||
port: 6379
|
||||
password: xiong990416.
|
||||
database: 3
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://krcia.top:3306/elysia-db?serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: xiong990416.
|
||||
app:
|
||||
agent-url: http://192.168.1.2:4561/oss
|
||||
release: /app/metadata
|
||||
@ -6,6 +6,6 @@ spring:
|
||||
profiles:
|
||||
active: development
|
||||
elysia-server:
|
||||
version: v0.1-0909-dev
|
||||
version: v0.3-251201
|
||||
enable-cors: true
|
||||
enable-api-doc: true
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user