mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
【定义】定义 midjourney 相关功能操作api
This commit is contained in:
parent
6e3f34b0db
commit
1a7446b914
@ -3,17 +3,14 @@ package cn.iocoder.yudao.module.ai.controller.admin.image;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReq;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.service.AiImageService;
|
import cn.iocoder.yudao.module.ai.service.AiImageService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@ -40,10 +37,34 @@ public class AiImageController {
|
|||||||
return aiImageService.dallDrawing(req);
|
return aiImageService.dallDrawing(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "midjourney", description = "midjourney图片绘画流程:1、提交任务 2、获取完成的任务 3、选择对应功能 4、获取最终结果")
|
@Operation(summary = "midjourney绘画", description = "midjourney图片绘画流程:1、提交任务 2、获取完成的任务 3、选择对应功能 4、获取最终结果")
|
||||||
@PostMapping("/midjourney")
|
@PostMapping("/midjourney")
|
||||||
public CommonResult<Void> midjourney(@Validated @RequestBody AiImageMidjourneyReq req) {
|
public CommonResult<Void> midjourney(@Validated @RequestBody AiImageMidjourneyReqVO req) {
|
||||||
aiImageService.midjourney(req);
|
aiImageService.midjourney(req);
|
||||||
return success(null);
|
return success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "midjourney绘画操作", description = "一般有选择图片、放大、换一批...")
|
||||||
|
@PostMapping("/midjourney-operate")
|
||||||
|
public CommonResult<Void> midjourneyOperate(@Validated @RequestBody AiImageMidjourneyReqVO req) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取midjourney绘画列表", description = "获取 Midjourney 绘画列表")
|
||||||
|
@GetMapping("/get-midjourney-list")
|
||||||
|
public CommonResult<Void> getMidjourneyList(@Validated @RequestBody AiImageMidjourneyReqVO req) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "取消 midjourney 绘画", description = "取消 midjourney 绘画")
|
||||||
|
@PostMapping("/cancel-midjourney")
|
||||||
|
public CommonResult<Void> cancelMidjourney(@RequestParam("id") Long id) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除绘画记录", description = "")
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
public CommonResult<Void> delete(@RequestParam("id") Long id) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
@ -13,9 +14,6 @@ import lombok.experimental.Accessors;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AiImageMidjourneyReq {
|
public class AiImageMidjourneyListReqVO extends PageParam {
|
||||||
|
|
||||||
@Schema(description = "提示词")
|
|
||||||
private String prompt;
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midjourney req
|
||||||
|
*
|
||||||
|
* @author fansili
|
||||||
|
* @time 2024/4/28 17:42
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AiImageMidjourneyListRespVO extends PageParam {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* midjourney req
|
||||||
|
*
|
||||||
|
* @author fansili
|
||||||
|
* @time 2024/4/28 17:42
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class AiImageMidjourneyReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "提示词")
|
||||||
|
private String prompt;
|
||||||
|
|
||||||
|
@Schema(description = "绘画比例 1:1、3:4、4:3、9:16、16:9")
|
||||||
|
private String size;
|
||||||
|
|
||||||
|
@Schema(description = "风格")
|
||||||
|
private String style;
|
||||||
|
|
||||||
|
@Schema(description = "参考图")
|
||||||
|
private String referImage;
|
||||||
|
}
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.ai.service;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReq;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReqVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ai 作图
|
* ai 作图
|
||||||
@ -26,5 +26,5 @@ public interface AiImageService {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void midjourney(AiImageMidjourneyReq req);
|
void midjourney(AiImageMidjourneyReqVO req);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|||||||
import cn.iocoder.yudao.module.ai.ErrorCodeConstants;
|
import cn.iocoder.yudao.module.ai.ErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageDallDrawingRespVO;
|
||||||
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReq;
|
import cn.iocoder.yudao.module.ai.controller.admin.image.vo.AiImageMidjourneyReqVO;
|
||||||
import cn.iocoder.yudao.module.ai.convert.AiImageConvert;
|
import cn.iocoder.yudao.module.ai.convert.AiImageConvert;
|
||||||
import cn.iocoder.yudao.module.ai.dal.dataobject.image.AiImageDO;
|
import cn.iocoder.yudao.module.ai.dal.dataobject.image.AiImageDO;
|
||||||
import cn.iocoder.yudao.module.ai.dal.mysql.AiImageMapper;
|
import cn.iocoder.yudao.module.ai.dal.mysql.AiImageMapper;
|
||||||
@ -96,7 +96,7 @@ public class AiImageServiceImpl implements AiImageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void midjourney(AiImageMidjourneyReq req) {
|
public void midjourney(AiImageMidjourneyReqVO req) {
|
||||||
// 保存数据库
|
// 保存数据库
|
||||||
AiImageDO aiImageDO = doSave(req.getPrompt(), null, "midjoureny",
|
AiImageDO aiImageDO = doSave(req.getPrompt(), null, "midjoureny",
|
||||||
null, AiChatDrawingStatusEnum.SUBMIT, null);
|
null, AiChatDrawingStatusEnum.SUBMIT, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user