mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-14 13:47:09 +00:00
(fix)(headless) fix getOrCreateContext npe when chatId is null (#916)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -11,7 +11,7 @@ public interface ChatContextService {
|
||||
*/
|
||||
Long getContextModel(Integer chatId);
|
||||
|
||||
ChatContext getOrCreateContext(int chatId);
|
||||
ChatContext getOrCreateContext(Integer chatId);
|
||||
|
||||
void updateContext(ChatContext chatCtx);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ChatContextServiceImpl implements ChatContextService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatContext getOrCreateContext(int chatId) {
|
||||
public ChatContext getOrCreateContext(Integer chatId) {
|
||||
return chatContextRepository.getOrCreateContext(chatId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user