【修改】增加 dall2\dall3 绘画方法,还未实现

This commit is contained in:
cherishsince 2024-04-25 16:56:54 +08:00
parent edb2a844cc
commit 44f7c841de
5 changed files with 55 additions and 2 deletions

View File

@ -1,10 +1,17 @@
package cn.iocoder.yudao.module.ai.controller;
import cn.iocoder.yudao.module.ai.service.AiImageService;
import cn.iocoder.yudao.module.ai.vo.AiImageDallDrawingReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
/**
* ai作图
@ -15,10 +22,18 @@ import org.springframework.web.bind.annotation.RestController;
*/
@Tag(name = "A10-ai作图")
@RestController
@RequestMapping("/ai/chat/message")
@RequestMapping("/ai/image")
@Slf4j
@AllArgsConstructor
public class AiImageController {
private final AiImageService aiImageService;
@Operation(summary = "dall2/dall3绘画", description = "openAi dall3是付费的!")
@GetMapping("/dallDrawing")
public SseEmitter dallDrawing(@Validated @ModelAttribute AiImageDallDrawingReq req) {
Utf8SseEmitter sseEmitter = new Utf8SseEmitter();
aiImageService.dallDrawing(req, sseEmitter);
return null;
}
}

View File

@ -18,7 +18,7 @@ import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@TableName("ai_drawing_image")
public class AiDrawingImage extends BaseDO {
public class AiDrawingImageDO extends BaseDO {
@TableId(type = IdType.AUTO)
private Long id;

View File

@ -1,5 +1,8 @@
package cn.iocoder.yudao.module.ai.service;
import cn.iocoder.yudao.module.ai.controller.Utf8SseEmitter;
import cn.iocoder.yudao.module.ai.vo.AiImageDallDrawingReq;
/**
* ai 作图
*
@ -8,4 +11,12 @@ package cn.iocoder.yudao.module.ai.service;
* @since 1.0
*/
public interface AiImageService {
/**
* ai绘画 - dall2/dall3 绘画
*
* @param req
* @param sseEmitter
*/
void dallDrawing(AiImageDallDrawingReq req, Utf8SseEmitter sseEmitter);
}

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.ai.service.impl;
import cn.iocoder.yudao.module.ai.controller.Utf8SseEmitter;
import cn.iocoder.yudao.module.ai.service.AiImageService;
import cn.iocoder.yudao.module.ai.vo.AiImageDallDrawingReq;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -18,5 +20,8 @@ import org.springframework.stereotype.Service;
public class AiImageServiceImpl implements AiImageService {
@Override
public void dallDrawing(AiImageDallDrawingReq req, Utf8SseEmitter sseEmitter) {
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.ai.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* dall2/dall2 绘画
*
* @author fansili
* @time 2024/4/25 16:24
* @since 1.0
*/
@Data
@Accessors(chain = true)
public class AiImageDallDrawingReq {
@Schema(description = "提示词")
@NotNull(message = "提示词不能为空!")
private String prompt;
}