(fix)(headless) fix getOrCreateContext npe when chatId is null (#916)

This commit is contained in:
daikon
2024-04-17 11:47:37 +08:00
committed by GitHub
parent abc590d15a
commit d8c23cca05
5 changed files with 5 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ChatContextMapper {
ChatContextDO getContextByChatId(int chatId);
ChatContextDO getContextByChatId(Integer chatId);
int updateContext(ChatContextDO contextDO);

View File

@@ -4,7 +4,7 @@ import com.tencent.supersonic.headless.core.pojo.ChatContext;
public interface ChatContextRepository {
ChatContext getOrCreateContext(int chatId);
ChatContext getOrCreateContext(Integer chatId);
void updateContext(ChatContext chatCtx);

View File

@@ -24,7 +24,7 @@ public class ChatContextRepositoryImpl implements ChatContextRepository {
}
@Override
public ChatContext getOrCreateContext(int chatId) {
public ChatContext getOrCreateContext(Integer chatId) {
ChatContextDO context = chatContextMapper.getContextByChatId(chatId);
if (context == null) {
ChatContext chatContext = new ChatContext();

View File

@@ -11,7 +11,7 @@ public interface ChatContextService {
*/
Long getContextModel(Integer chatId);
ChatContext getOrCreateContext(int chatId);
ChatContext getOrCreateContext(Integer chatId);
void updateContext(ChatContext chatCtx);

View File

@@ -37,7 +37,7 @@ public class ChatContextServiceImpl implements ChatContextService {
}
@Override
public ChatContext getOrCreateContext(int chatId) {
public ChatContext getOrCreateContext(Integer chatId) {
return chatContextRepository.getOrCreateContext(chatId);
}