feat: 优化

This commit is contained in:
2026-02-23 00:09:36 +08:00
parent 547953cd00
commit 1e2e726744
6 changed files with 198 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.tik.muye.aiagent.dal.AiAgentDO;
import cn.iocoder.yudao.module.tik.muye.aiagent.service.AiAgentService;
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentRespVO;
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AppAiAgentRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
@@ -33,9 +33,9 @@ public class AppAiAgentController {
@GetMapping("/list")
@Operation(summary = "获取启用的智能体列表")
public CommonResult<List<AiAgentRespVO>> getEnabledAgentList() {
public CommonResult<List<AppAiAgentRespVO>> getEnabledAgentList() {
List<AiAgentDO> list = aiAgentService.getEnabledAgentList();
return success(BeanUtils.toBean(list, AiAgentRespVO.class));
return success(BeanUtils.toBean(list, AppAiAgentRespVO.class));
}
}

View File

@@ -115,9 +115,7 @@ public class AiAgentServiceImpl implements AiAgentService {
if (importAgent.getCategoryName() == null || importAgent.getCategoryName().isEmpty()) {
throw new RuntimeException("分类不能为空");
}
if (importAgent.getIcon() == null || importAgent.getIcon().isEmpty()) {
throw new RuntimeException("图标URL不能为空");
}
// 图标URL可以为空
if (importAgent.getStatus() == null) {
throw new RuntimeException("状态不能为空");
}

View File

@@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.tik.muye.aiagent.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 用户 App - AI智能体 Response VO
* 精简版,不包含敏感字段(如 systemPrompt
*/
@Schema(description = "用户 App - AI智能体 Response VO")
@Data
public class AppAiAgentRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5900")
private Long id;
@Schema(description = "智能体ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24745")
private String agentId;
@Schema(description = "智能体名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "文案助手")
private String agentName;
@Schema(description = "图标URL")
private String icon;
@Schema(description = "设定描述", example = "专业的文案创作助手")
private String description;
@Schema(description = "分类名称(中文)", example = "文案创作")
private String categoryName;
}