mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-17 16:02:14 +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
|
@Mapper
|
||||||
public interface ChatContextMapper {
|
public interface ChatContextMapper {
|
||||||
|
|
||||||
ChatContextDO getContextByChatId(int chatId);
|
ChatContextDO getContextByChatId(Integer chatId);
|
||||||
|
|
||||||
int updateContext(ChatContextDO contextDO);
|
int updateContext(ChatContextDO contextDO);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.tencent.supersonic.headless.core.pojo.ChatContext;
|
|||||||
|
|
||||||
public interface ChatContextRepository {
|
public interface ChatContextRepository {
|
||||||
|
|
||||||
ChatContext getOrCreateContext(int chatId);
|
ChatContext getOrCreateContext(Integer chatId);
|
||||||
|
|
||||||
void updateContext(ChatContext chatCtx);
|
void updateContext(ChatContext chatCtx);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class ChatContextRepositoryImpl implements ChatContextRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChatContext getOrCreateContext(int chatId) {
|
public ChatContext getOrCreateContext(Integer chatId) {
|
||||||
ChatContextDO context = chatContextMapper.getContextByChatId(chatId);
|
ChatContextDO context = chatContextMapper.getContextByChatId(chatId);
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
ChatContext chatContext = new ChatContext();
|
ChatContext chatContext = new ChatContext();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public interface ChatContextService {
|
|||||||
*/
|
*/
|
||||||
Long getContextModel(Integer chatId);
|
Long getContextModel(Integer chatId);
|
||||||
|
|
||||||
ChatContext getOrCreateContext(int chatId);
|
ChatContext getOrCreateContext(Integer chatId);
|
||||||
|
|
||||||
void updateContext(ChatContext chatCtx);
|
void updateContext(ChatContext chatCtx);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ChatContextServiceImpl implements ChatContextService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChatContext getOrCreateContext(int chatId) {
|
public ChatContext getOrCreateContext(Integer chatId) {
|
||||||
return chatContextRepository.getOrCreateContext(chatId);
|
return chatContextRepository.getOrCreateContext(chatId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user