refactor(agent): 优化收藏功能代码实现

- 前端移除未使用的 ArrowRightOutlined 导入
- 优化智能体列表排序逻辑,避免修改原数组
- 后端使用 Stream API 简化收藏智能体 ID 获取逻辑
This commit is contained in:
2026-02-26 20:17:00 +08:00
parent d429dc887a
commit 2d96e8ca4e
3 changed files with 5 additions and 9 deletions

View File

@@ -55,11 +55,9 @@ public class AiAgentFavoriteServiceImpl implements AiAgentFavoriteService {
@Override
public Set<Long> getFavoriteAgentIds(Long userId) {
List<AiAgentFavoriteDO> favorites = aiAgentFavoriteMapper.selectListByUserId(userId);
Set<Long> agentIds = new HashSet<>();
for (AiAgentFavoriteDO favorite : favorites) {
agentIds.add(favorite.getAgentId());
}
return agentIds;
return favorites.stream()
.map(AiAgentFavoriteDO::getAgentId)
.collect(java.util.stream.Collectors.toSet());
}
@Override