mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-30 11:11:55 +08:00
【优化】AI Image 分页列表、get-my 返回 resp 结构
This commit is contained in:
parent
f347b15a1e
commit
e4a0512b51
@ -38,8 +38,8 @@ public class AiImageController {
|
|||||||
// TODO @fan:建议把 dallDrawing、midjourney 融合成一个 draw 接口,异步绘制;然后返回一个 id 给前端;前端通过 get 接口轮询,直到获取到生成成功
|
// TODO @fan:建议把 dallDrawing、midjourney 融合成一个 draw 接口,异步绘制;然后返回一个 id 给前端;前端通过 get 接口轮询,直到获取到生成成功
|
||||||
@Operation(summary = "dall2/dall3绘画", description = "openAi dall3是付费的!")
|
@Operation(summary = "dall2/dall3绘画", description = "openAi dall3是付费的!")
|
||||||
@PostMapping("/dall")
|
@PostMapping("/dall")
|
||||||
public AiImageDallRespVO dallDrawing(@Validated @RequestBody AiImageDallReqVO req) {
|
public AiImageDallRespVO dall(@Validated @RequestBody AiImageDallReqVO req) {
|
||||||
return aiImageService.dallDrawing(req);
|
return aiImageService.dall(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "midjourney绘画", description = "midjourney图片绘画流程:1、提交任务 2、获取完成的任务 3、选择对应功能 4、获取最终结果")
|
@Operation(summary = "midjourney绘画", description = "midjourney图片绘画流程:1、提交任务 2、获取完成的任务 3、选择对应功能 4、获取最终结果")
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
package cn.iocoder.yudao.module.ai.controller.admin.image.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotNull;
|
|
||||||
import jakarta.validation.constraints.Size;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dall2/dall2 绘画
|
* dall2/dall2 绘画
|
||||||
*
|
*
|
||||||
@ -17,31 +17,57 @@ import lombok.experimental.Accessors;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AiImageDallRespVO {
|
public class AiImageDallRespVO {
|
||||||
|
|
||||||
@Schema(description = "提示词")
|
@Schema(description = "id编号", example = "1")
|
||||||
@NotNull(message = "提示词不能为空!")
|
private Long id;
|
||||||
@Size(max = 1200, message = "提示词最大1200")
|
|
||||||
|
@Schema(description = "用户id", example = "1")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "提示词", example = "南极的小企鹅")
|
||||||
private String prompt;
|
private String prompt;
|
||||||
|
|
||||||
@Schema(description = "模型")
|
@Schema(description = "平台", example = "openai")
|
||||||
@NotNull(message = "模型不能为空")
|
private String platform;
|
||||||
|
|
||||||
|
@Schema(description = "模型", example = "dall2")
|
||||||
private String model;
|
private String model;
|
||||||
|
|
||||||
@Schema(description = "风格")
|
@Schema(description = "图片宽度", example = "1024")
|
||||||
private String style;
|
private String width;
|
||||||
|
|
||||||
@Schema(description = "图片size 1024x1024 ...")
|
@Schema(description = "图片高度", example = "1024")
|
||||||
private String size;
|
private String height;
|
||||||
|
|
||||||
@Schema(description = "图片地址(自己服务器)")
|
@Schema(description = "绘画状态:10 进行中、20 绘画完成、30 绘画失败", example = "10")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "是否发布", example = "public")
|
||||||
|
private String publicStatus;
|
||||||
|
|
||||||
|
@Schema(description = "图片地址(自己服务器)", example = "http://")
|
||||||
private String picUrl;
|
private String picUrl;
|
||||||
|
|
||||||
@Schema(description = "可以访问图像的URL。")
|
@Schema(description = "绘画图片地址(绘画好的服务器)", example = "http://")
|
||||||
private String originalPicUrl;
|
private String originalPicUrl;
|
||||||
|
|
||||||
@Schema(description = "图片base64。")
|
@Schema(description = "绘画错误信息", example = "图片错误信息")
|
||||||
private String base64;
|
|
||||||
|
|
||||||
@Schema(description = "错误信息。")
|
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
|
// ============ 绘画请求参数
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - style
|
||||||
|
*/
|
||||||
|
@Schema(description = "绘画请求参数")
|
||||||
|
private Map<String, Object> drawRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* - mjNonceId
|
||||||
|
* - mjOperationId
|
||||||
|
* - mjOperationName
|
||||||
|
* - mjOperations
|
||||||
|
*/
|
||||||
|
@Schema(description = "绘画请求响应参数")
|
||||||
|
private Map<String, Object> drawResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midjourney req
|
* AI Image 我的图片列表 req
|
||||||
*
|
*
|
||||||
* @author fansili
|
* @author fansili
|
||||||
* @time 2024/4/28 17:42
|
* @time 2024/4/28 17:42
|
||||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midjourney req
|
* midjourney req
|
||||||
@ -22,56 +23,57 @@ import java.time.LocalDateTime;
|
|||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class AiImageListRespVO extends PageParam {
|
public class AiImageListRespVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "id编号", example = "1")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "用户id")
|
@Schema(description = "用户id", example = "1")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "提示词")
|
@Schema(description = "提示词", example = "南极的小企鹅")
|
||||||
private String prompt;
|
private String prompt;
|
||||||
|
|
||||||
@Schema(description = "模型 dall2/dall3、MJ、NIJI")
|
@Schema(description = "平台", example = "openai")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
@Schema(description = "模型", example = "dall2")
|
||||||
private String model;
|
private String model;
|
||||||
|
|
||||||
@Schema(description = "生成图像的尺寸大小。对于dall-e-2模型,尺寸可为256x256, 512x512, 或 1024x1024。对于dall-e-3模型,尺寸可为1024x1024, 1792x1024, 或 1024x1792。")
|
@Schema(description = "图片宽度", example = "1024")
|
||||||
private String size;
|
private String width;
|
||||||
|
|
||||||
@Schema(description = "风格")
|
@Schema(description = "图片高度", example = "1024")
|
||||||
private String style;
|
private String height;
|
||||||
|
|
||||||
@Schema(description = "图片地址(自己服务器)")
|
@Schema(description = "绘画状态:10 进行中、20 绘画完成、30 绘画失败", example = "10")
|
||||||
private String picUrl;
|
|
||||||
|
|
||||||
@Schema(description = "绘画状态:提交、排队、绘画中、绘画完成、绘画失败")
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@Schema(description = "绘画图片地址(绘画好的服务器)")
|
@Schema(description = "是否发布", example = "public")
|
||||||
private String originalPicUrl;
|
|
||||||
|
|
||||||
@Schema(description = "绘画错误信息")
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
@Schema(description = "是否发布")
|
|
||||||
private String publicStatus;
|
private String publicStatus;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "图片地址(自己服务器)", example = "http://")
|
||||||
private LocalDateTime createTime;
|
private String picUrl;
|
||||||
|
|
||||||
@Schema(description = "更新时间")
|
@Schema(description = "绘画图片地址(绘画好的服务器)", example = "http://")
|
||||||
private LocalDateTime updateTime;
|
private String originalPicUrl;
|
||||||
|
|
||||||
// ============ mj 需要字段
|
@Schema(description = "绘画错误信息", example = "图片错误信息")
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
@Schema(description = "用户操作的Nonce编号(MJ返回)")
|
// ============ 绘画请求参数
|
||||||
private String mjNonceId;
|
|
||||||
|
|
||||||
@Schema(description = "用户操作的操作编号(MJ返回)")
|
/**
|
||||||
private String mjOperationId;
|
* - style
|
||||||
|
*/
|
||||||
|
@Schema(description = "绘画请求参数")
|
||||||
|
private Map<String, Object> drawRequest;
|
||||||
|
|
||||||
@Schema(description = "用户操作的操作名字(MJ返回)")
|
/**
|
||||||
private String mjOperationName;
|
* - mjNonceId
|
||||||
|
* - mjOperationId
|
||||||
@Schema(description = "mj图片生产成功保存的 components json 数组")
|
* - mjOperationName
|
||||||
private String mjOperations;
|
* - mjOperations
|
||||||
|
*/
|
||||||
|
@Schema(description = "绘画请求响应参数")
|
||||||
|
private Map<String, Object> drawResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.ai.dal.dataobject.image;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -60,6 +62,7 @@ public class AiImageDO extends BaseDO {
|
|||||||
* - style
|
* - style
|
||||||
*/
|
*/
|
||||||
@Schema(description = "绘画请求参数")
|
@Schema(description = "绘画请求参数")
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private Map<String, Object> drawRequest;
|
private Map<String, Object> drawRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,6 +72,7 @@ public class AiImageDO extends BaseDO {
|
|||||||
* - mjOperations
|
* - mjOperations
|
||||||
*/
|
*/
|
||||||
@Schema(description = "绘画请求响应参数")
|
@Schema(description = "绘画请求响应参数")
|
||||||
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private Map<String, Object> drawResponse;
|
private Map<String, Object> drawResponse;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public interface AiImageService {
|
|||||||
*
|
*
|
||||||
* @param req
|
* @param req
|
||||||
*/
|
*/
|
||||||
AiImageDallRespVO dallDrawing(AiImageDallReqVO req);
|
AiImageDallRespVO dall(AiImageDallReqVO req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* midjourney 图片生成
|
* midjourney 图片生成
|
||||||
|
@ -115,7 +115,7 @@ public class AiImageServiceImpl implements AiImageService {
|
|||||||
|
|
||||||
// TODO @fan:1)loginUserId 通过 controller 传入;
|
// TODO @fan:1)loginUserId 通过 controller 传入;
|
||||||
@Override
|
@Override
|
||||||
public AiImageDallRespVO dallDrawing(AiImageDallReqVO req) {
|
public AiImageDallRespVO dall(AiImageDallReqVO req) {
|
||||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
// 保存数据库
|
// 保存数据库
|
||||||
// TODO @fan:1)使用 BeanUtils;2)使用链式调用哈;
|
// TODO @fan:1)使用 BeanUtils;2)使用链式调用哈;
|
||||||
|
Loading…
Reference in New Issue
Block a user