Commit e6fefa06b7463582bd8f981c24364e2ef3fccf67
1 parent
b31e919d
【优化】AI 角色分类处理用户角色,为空情况
Showing
1 changed file
with
3 additions
and
1 deletions
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/model/AiChatRoleServiceImpl.java
| ... | ... | @@ -14,6 +14,8 @@ import lombok.extern.slf4j.Slf4j; |
| 14 | 14 | import org.springframework.stereotype.Service; |
| 15 | 15 | |
| 16 | 16 | import java.util.List; |
| 17 | +import java.util.Objects; | |
| 18 | +import java.util.stream.Collectors; | |
| 17 | 19 | |
| 18 | 20 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 19 | 21 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| ... | ... | @@ -132,7 +134,7 @@ public class AiChatRoleServiceImpl implements AiChatRoleService { |
| 132 | 134 | @Override |
| 133 | 135 | public List<String> getChatRoleCategoryList() { |
| 134 | 136 | List<AiChatRoleDO> list = chatRoleMapper.selectListGroupByCategory(CommonStatusEnum.ENABLE.getStatus()); |
| 135 | - return convertList(list, AiChatRoleDO::getCategory); | |
| 137 | + return convertList(list.stream().filter(Objects::nonNull).collect(Collectors.toList()), AiChatRoleDO::getCategory); | |
| 136 | 138 | } |
| 137 | 139 | |
| 138 | 140 | } | ... | ... |