2023-08-17 11:59:19 +08:00
|
|
|
package com.ai.da.controller;
|
|
|
|
|
|
|
|
|
|
import com.ai.da.common.response.Response;
|
2023-08-29 10:33:32 +08:00
|
|
|
import com.ai.da.model.dto.GenerateLikeDTO;
|
2023-08-17 11:59:19 +08:00
|
|
|
import com.ai.da.model.dto.GenerateThroughImageTextDTO;
|
|
|
|
|
import com.ai.da.model.vo.GenerateCaptionVO;
|
|
|
|
|
import com.ai.da.model.vo.GenerateCollectionVO;
|
2023-08-29 10:33:32 +08:00
|
|
|
import com.ai.da.model.vo.GenerateLikeVO;
|
2023-08-17 11:59:19 +08:00
|
|
|
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("通过文字、图片生成图片")
|
2023-08-18 10:42:08 +08:00
|
|
|
@PostMapping("/sketchAndPrint")
|
2023-08-17 11:59:19 +08:00
|
|
|
public Response<GenerateCollectionVO> generateThroughImageText(@Valid @RequestBody GenerateThroughImageTextDTO generateThroughImageTextDTO){
|
2023-08-18 10:42:08 +08:00
|
|
|
return Response.success(generateService.generateThroughImageText(generateThroughImageTextDTO));
|
2023-08-17 11:59:19 +08:00
|
|
|
}
|
|
|
|
|
|
2023-08-29 10:33:32 +08:00
|
|
|
@ApiOperation("喜欢生成的图片")
|
|
|
|
|
@PostMapping("/like")
|
|
|
|
|
public Response<GenerateLikeVO> like(@Valid @RequestBody GenerateLikeDTO generateLikeDTO){
|
|
|
|
|
return Response.success(generateService.generateLike(generateLikeDTO));
|
|
|
|
|
}
|
2023-08-17 11:59:19 +08:00
|
|
|
|
2023-09-19 15:21:53 +08:00
|
|
|
@ApiOperation(value = "取消喜欢")
|
|
|
|
|
@PostMapping("/dislike")
|
|
|
|
|
public Response<Boolean> dislike(@RequestParam Long generateDetailId,String timeZone) {
|
|
|
|
|
return Response.success(generateService.generateDislike(generateDetailId,timeZone));
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-17 11:59:19 +08:00
|
|
|
}
|