feat: 全新智能体功能
- 基于先进智能体框架,增加智能体编排功能 - 增加智能体聊天,并对接持久化
This commit is contained in:
@@ -62,7 +62,7 @@ public class ChatPersistMySqlApplyServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldFallbackTitleWhenMessageMetadataMissing() {
|
||||
public void shouldKeepTitleBlankWhenMessageMetadataMissing() {
|
||||
ChatAppendMessageCommand command = new ChatAppendMessageCommand();
|
||||
command.setSessionId(BigInteger.valueOf(202));
|
||||
command.setTenantId(BigInteger.ONE);
|
||||
@@ -77,7 +77,7 @@ public class ChatPersistMySqlApplyServiceTest {
|
||||
Assert.assertEquals(1, upserts.size());
|
||||
ChatSessionUpsertCommand upsert = upserts.get(0);
|
||||
Assert.assertEquals("", upsert.getUserAccount());
|
||||
Assert.assertEquals("会话-202", upsert.getTitle());
|
||||
Assert.assertNull(upsert.getTitle());
|
||||
Assert.assertEquals(BigInteger.valueOf(7), upsert.getOperatorId());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,27 @@ public class ChatSessionQueryServiceImplTest {
|
||||
Assert.assertEquals(1, sessionRepository.listSessionsCalls);
|
||||
}
|
||||
|
||||
/**
|
||||
* Agent 会话查询必须把 assistantCode 过滤条件下推到 MySQL 会话表,避免混入 Bot 会话。
|
||||
*/
|
||||
@Test
|
||||
public void pageSessionsShouldPassAssistantCodeFilterToMysqlRepository() {
|
||||
FakeSessionRepository sessionRepository = new FakeSessionRepository();
|
||||
sessionRepository.sessions = List.of(session(BigInteger.valueOf(1002), 2));
|
||||
sessionRepository.count = 1;
|
||||
ChatSessionQueryServiceImpl service = new ChatSessionQueryServiceImpl(
|
||||
sessionRepository,
|
||||
new FakeLogRepository(),
|
||||
new FakeTableManager(List.of()),
|
||||
new FakeHotStateService()
|
||||
);
|
||||
|
||||
service.pageSessions(BigInteger.valueOf(7), BigInteger.valueOf(88), "AGENT", new ChatPageQuery());
|
||||
|
||||
Assert.assertEquals("AGENT", sessionRepository.capturedListAssistantCode);
|
||||
Assert.assertEquals("AGENT", sessionRepository.capturedCountAssistantCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作台消息分页必须走 MySQL 热表主线查询,并保持分页参数语义。
|
||||
*/
|
||||
@@ -124,6 +145,8 @@ public class ChatSessionQueryServiceImplTest {
|
||||
private long count;
|
||||
private int countSessionsCalls;
|
||||
private int listSessionsCalls;
|
||||
private String capturedListAssistantCode;
|
||||
private String capturedCountAssistantCode;
|
||||
private ChatSessionSummary summary;
|
||||
private List<ChatSessionSummary> sessions = new ArrayList<>();
|
||||
|
||||
@@ -133,13 +156,25 @@ public class ChatSessionQueryServiceImplTest {
|
||||
|
||||
@Override
|
||||
public List<ChatSessionSummary> listSessions(BigInteger userId, BigInteger assistantId, ChatPageQuery query) {
|
||||
return listSessions(userId, assistantId, null, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChatSessionSummary> listSessions(BigInteger userId, BigInteger assistantId, String assistantCode, ChatPageQuery query) {
|
||||
listSessionsCalls += 1;
|
||||
capturedListAssistantCode = assistantCode;
|
||||
return sessions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countSessions(BigInteger userId, BigInteger assistantId) {
|
||||
return countSessions(userId, assistantId, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countSessions(BigInteger userId, BigInteger assistantId, String assistantCode) {
|
||||
countSessionsCalls += 1;
|
||||
capturedCountAssistantCode = assistantCode;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user