mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-10 03:16:48 +08:00
案例助手:增加@Transactional注解
This commit is contained in:
@@ -45,6 +45,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
@@ -83,6 +84,7 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
private CasesDao casesDao;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public SseEmitter chat(CaseAiChatDto caseAiChatDto, CurrentUser currentUser) {
|
||||
// 1. 获取conversationId
|
||||
String conversationId = getOrCreateConversationId(caseAiChatDto, currentUser);
|
||||
@@ -96,7 +98,7 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
conversation.setAiConversationId(conversationId);
|
||||
conversation.setConversationName("AI案例咨询-" + LocalDateTime.now());
|
||||
conversation.setConversationUser(currentUser.getAccountId());
|
||||
// 由于编译问题,这里先注释,实际部署时需要取消注释
|
||||
// 保存会话到数据库
|
||||
caseAiConversationsDao.save(conversation);
|
||||
}
|
||||
|
||||
@@ -242,6 +244,7 @@ public class CaseAiChatServiceImpl implements ICaseAiChatService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CaseAiConversations createNewConversation(String userId, String conversationName) {
|
||||
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
|
||||
String url = caseAiProperties.getBaseUrl() + "/apigateway/knowledge/v1/conversation";
|
||||
|
||||
Reference in New Issue
Block a user