|
|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.byzs.module.web.controller.admin.ai;
|
|
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
+import cn.iocoder.byzs.framework.common.enums.CommonStatusEnum;
|
|
|
import cn.iocoder.byzs.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.byzs.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.byzs.framework.common.util.object.BeanUtils;
|
|
|
@@ -11,16 +12,17 @@ import cn.iocoder.byzs.module.ai.controller.admin.chat.vo.message.AiChatMessageS
|
|
|
import cn.iocoder.byzs.module.ai.controller.admin.image.vo.AiImageDrawReqVO;
|
|
|
import cn.iocoder.byzs.module.ai.controller.admin.image.vo.AiImageRespVO;
|
|
|
import cn.iocoder.byzs.module.ai.controller.admin.model.vo.chatRole.AiChatRolePageReqVO;
|
|
|
-import cn.iocoder.byzs.module.ai.controller.admin.model.vo.chatRole.AiChatRoleRespVO;
|
|
|
import cn.iocoder.byzs.module.ai.controller.admin.video.vo.AiVideoDrawReqVO;
|
|
|
import cn.iocoder.byzs.module.ai.controller.admin.video.vo.AiVideoRespVO;
|
|
|
import cn.iocoder.byzs.module.ai.dal.dataobject.image.AiImageDO;
|
|
|
import cn.iocoder.byzs.module.ai.dal.dataobject.model.AiChatRoleDO;
|
|
|
+import cn.iocoder.byzs.module.ai.dal.dataobject.model.AiModelDO;
|
|
|
import cn.iocoder.byzs.module.ai.dal.dataobject.video.AiVideoDO;
|
|
|
import cn.iocoder.byzs.module.ai.service.chat.AiChatConversationService;
|
|
|
import cn.iocoder.byzs.module.ai.service.chat.AiChatMessageService;
|
|
|
import cn.iocoder.byzs.module.ai.service.image.AiImageService;
|
|
|
import cn.iocoder.byzs.module.ai.service.model.AiChatRoleService;
|
|
|
+import cn.iocoder.byzs.module.ai.service.model.AiModelService;
|
|
|
import cn.iocoder.byzs.module.ai.service.video.AiVideoService;
|
|
|
import cn.iocoder.byzs.module.web.controller.admin.ai.vo.WebAiChatRoleVO;
|
|
|
import cn.iocoder.byzs.module.web.service.ai.WebAiServiceImpl;
|
|
|
@@ -58,7 +60,34 @@ public class WebAiController {
|
|
|
@Resource
|
|
|
private AiChatRoleService chatRoleService;
|
|
|
@Resource
|
|
|
+ private AiModelService modelService;
|
|
|
+ @Resource
|
|
|
private WebAiServiceImpl webAiService;
|
|
|
+
|
|
|
+
|
|
|
+ // ================ 模型数据 ================
|
|
|
+
|
|
|
+ @GetMapping("/selectRoleModel")
|
|
|
+ @Operation(summary = "获得聊天角色分页")
|
|
|
+ public CommonResult<PageResult<WebAiChatRoleVO>> selectRoleModel(@Valid AiChatRolePageReqVO pageReqVO) {
|
|
|
+ PageResult<AiChatRoleDO> pageResult = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId());
|
|
|
+ return success(BeanUtils.toBean(pageResult, WebAiChatRoleVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PermitAll
|
|
|
+ @TenantIgnore
|
|
|
+ @GetMapping("/getModelIdByType")
|
|
|
+ @Operation(summary = "获得模型列表")
|
|
|
+ public CommonResult<Long> getModelIdByType(
|
|
|
+ @RequestParam("type") Integer type,
|
|
|
+ @RequestParam(value = "platform", required = false) String platform) {
|
|
|
+ List<AiModelDO> list = modelService.getModelListByStatusAndType(
|
|
|
+ CommonStatusEnum.ENABLE.getStatus(), type, platform);
|
|
|
+ if (ObjUtil.isEmpty(list)) {
|
|
|
+ return success(null);
|
|
|
+ }
|
|
|
+ return success(list.get(0).getId());
|
|
|
+ }
|
|
|
|
|
|
// ================ 智能问答 ================
|
|
|
|
|
|
@@ -112,14 +141,6 @@ public class WebAiController {
|
|
|
return success(BeanUtils.toBean(imageList, AiImageRespVO.class));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @GetMapping("/selectRoleModel")
|
|
|
- @Operation(summary = "获得聊天角色分页")
|
|
|
- public CommonResult<PageResult<WebAiChatRoleVO>> selectRoleModel(@Valid AiChatRolePageReqVO pageReqVO) {
|
|
|
- PageResult<AiChatRoleDO> pageResult = chatRoleService.getChatRoleMyPage(pageReqVO, getLoginUserId());
|
|
|
- return success(BeanUtils.toBean(pageResult, WebAiChatRoleVO.class));
|
|
|
- }
|
|
|
-
|
|
|
// ================ 视频管理 ================
|
|
|
|
|
|
@Operation(summary = "生成视频")
|
|
|
@@ -137,4 +158,12 @@ public class WebAiController {
|
|
|
}
|
|
|
return success(BeanUtils.toBean(video, AiVideoRespVO.class));
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/video-get-mys")
|
|
|
+ @Operation(summary = "获取【我的】视频记录列表")
|
|
|
+ @Parameter(name = "ids", required = true, description = "视频编号数组", example = "1024,2048")
|
|
|
+ public CommonResult<List<AiVideoRespVO>> getVideoListMyByIds(@RequestParam("ids") List<Long> ids) {
|
|
|
+ List<AiVideoDO> videoList = videoService.getVideoList(ids);
|
|
|
+ return success(BeanUtils.toBean(videoList, AiVideoRespVO.class));
|
|
|
+ }
|
|
|
}
|