48 lines
1.3 KiB
Java
48 lines
1.3 KiB
Java
|
|
package com.ai.da.controller;
|
||
|
|
|
||
|
|
import com.ai.da.common.response.Response;
|
||
|
|
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
||
|
|
import com.ai.da.model.vo.GenerateCaptionVO;
|
||
|
|
import com.ai.da.model.vo.GenerateCollectionVO;
|
||
|
|
import com.ai.da.service.GenerateService;
|
||
|
|
import io.swagger.annotations.Api;
|
||
|
|
import io.swagger.annotations.ApiOperation;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import javax.validation.Valid;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @author XP
|
||
|
|
*/
|
||
|
|
@Api(tags = "Generate模块")
|
||
|
|
@Slf4j
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/api/generate")
|
||
|
|
public class GenerateController {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private GenerateService generateService;
|
||
|
|
|
||
|
|
@ApiOperation("自动识别sketch的caption")
|
||
|
|
@PostMapping("/caption")
|
||
|
|
public Response<GenerateCaptionVO> generateCaption(@RequestParam Long sketchElementId){
|
||
|
|
return Response.success(generateService.generateCaption(sketchElementId));
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@ApiOperation("通过文字、图片生成图片")
|
||
|
|
@PostMapping("/sketch")
|
||
|
|
public Response<GenerateCollectionVO> generateThroughImageText(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO){
|
||
|
|
return Response.success(generateService.generateSketchThroughImageText(generateThroughImageTextDTO));
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|