mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-03-13 20:53:42 +08:00
Merge pull request #208 from LM20230311/upgrade/upgrade-spring-ai-1.0.0
Upgrade/upgrade spring ai 1.0.0
This commit is contained in:
@@ -144,6 +144,15 @@ security:
|
||||
# swagger 文档配置
|
||||
- /*/api-docs
|
||||
- /*/api-docs/**
|
||||
- /v3/api-docs
|
||||
- /v3/api-docs/**
|
||||
- /v3/api-docs/swagger-config
|
||||
- /swagger-ui.html
|
||||
- /swagger-ui/**
|
||||
- /doc.html
|
||||
- /webjars/**
|
||||
- /swagger-resources
|
||||
- /swagger-resources/**
|
||||
# actuator 监控配置
|
||||
- /actuator
|
||||
- /actuator/**
|
||||
@@ -252,13 +261,17 @@ springdoc:
|
||||
group-configs:
|
||||
- group: 1.系统模块
|
||||
packages-to-scan: org.ruoyi.system
|
||||
- group: 2.业务模块
|
||||
packages-to-scan: org.ruoyi.chat
|
||||
knife4j:
|
||||
enable: true
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
excludes: /system/notice,/v3/api-docs/**,/doc.html,/swagger-ui/**,/swagger-ui.html,/swagger-resources/**,/webjars/**,/druid/**,/actuator/**,/favicon.ico
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
@@ -290,6 +303,7 @@ management:
|
||||
logfile:
|
||||
external-file: ./logs/sys-console.log
|
||||
|
||||
# websocket
|
||||
# websocket
|
||||
websocket:
|
||||
enabled: true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.ruoyi.common.core.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
import org.ruoyi.common.core.config.properties.ThreadPoolProperties;
|
||||
import org.ruoyi.common.core.utils.Threads;
|
||||
@@ -18,6 +19,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
||||
*
|
||||
* @author Lion Li
|
||||
**/
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(ThreadPoolProperties.class)
|
||||
public class ThreadPoolConfig {
|
||||
@@ -43,7 +45,8 @@ public class ThreadPoolConfig {
|
||||
* 执行周期性或定时任务
|
||||
*/
|
||||
@Bean(name = "scheduledExecutorService")
|
||||
protected ScheduledExecutorService scheduledExecutorService() {
|
||||
public ScheduledExecutorService scheduledExecutorService() {
|
||||
log.info("====创建定时任务线程池====");
|
||||
return new ScheduledThreadPoolExecutor(core,
|
||||
new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy()) {
|
||||
|
||||
@@ -35,7 +35,17 @@ public class AllUrlHandler implements InitializingBean {
|
||||
Pattern pattern = Pattern.compile("\\{(.*?)\\}");
|
||||
|
||||
Set<String> handlerSet = handlerMethods.keySet().stream()
|
||||
.flatMap(info -> info.getPatternsCondition().getPatterns().stream())
|
||||
.flatMap(info -> {
|
||||
// Spring 5 (AntPath) 风格
|
||||
if (info.getPatternsCondition() != null && info.getPatternsCondition().getPatterns() != null) {
|
||||
return info.getPatternsCondition().getPatterns().stream();
|
||||
}
|
||||
// Spring 6 (PathPattern) 风格
|
||||
if (info.getPathPatternsCondition() != null && info.getPathPatternsCondition().getPatterns() != null) {
|
||||
return info.getPathPatternsCondition().getPatterns().stream().map(p -> p.getPatternString());
|
||||
}
|
||||
return java.util.stream.Stream.<String>empty();
|
||||
})
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 获取注解上边的 path 替代 path variable 为 *
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</scm>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<spring-ai.version>1.0.0-M7</spring-ai.version>
|
||||
<spring-ai.version>1.0.0</spring-ai.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-ai.version>1.0.0-M7</spring-ai.version>
|
||||
<spring-ai.version>1.0.0</spring-ai.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<jda.version>5.0.0-beta.9</jda.version>
|
||||
<chatgpt-java.version>1.1.2-beta0</chatgpt-java.version>
|
||||
<dataurl.version>2.0.0</dataurl.version>
|
||||
<knife4j.verison>4.1.0</knife4j.verison>
|
||||
<knife4j.verison>4.5.0</knife4j.verison>
|
||||
<user-agent-utils.verison>1.21</user-agent-utils.verison>
|
||||
<httpclient.verison>4.5.14</httpclient.verison>
|
||||
<java.version>17</java.version>
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||
<artifactId>knife4j-openapi3-webflux-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.verison}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.ruoyi.chat.controller.tripartite;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author ageerle
|
||||
* @date 2025-05-03
|
||||
*/
|
||||
@Api(tags = "任务查询")
|
||||
@Tag(name = "任务查询")
|
||||
@RestController
|
||||
@RequestMapping("/mj")
|
||||
@RequiredArgsConstructor
|
||||
@@ -32,7 +32,7 @@ public class FaceController {
|
||||
|
||||
private final MjOkHttpUtil mjOkHttpUtil;
|
||||
|
||||
@ApiOperation(value = "换脸")
|
||||
@Operation(summary = "换脸")
|
||||
@PostMapping("/insight-face/swap")
|
||||
public String insightFace(@RequestBody InsightFace insightFace) {
|
||||
// 扣除接口费用并且保存消息记录
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.ruoyi.chat.controller.tripartite;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
@@ -28,7 +28,7 @@ public class LumaController {
|
||||
private final IChatCostService chatCostService;
|
||||
|
||||
|
||||
@ApiOperation(value = "文生视频")
|
||||
@Operation(summary = "文生视频")
|
||||
@PostMapping("/generations/")
|
||||
public String generateVideo(@RequestBody GenerateLuma generateLuma) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("luma");
|
||||
@@ -40,7 +40,7 @@ public class LumaController {
|
||||
return okHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "文生视频任务查询")
|
||||
@Operation(summary = "文生视频任务查询")
|
||||
@GetMapping("/generations/{taskId}")
|
||||
public String getGenerationTask(@PathVariable String taskId) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("luma");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.ruoyi.chat.controller.tripartite;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
@@ -23,7 +23,7 @@ import java.util.Optional;
|
||||
* @author ageerle
|
||||
* @date 2025-05-03
|
||||
*/
|
||||
@Api(tags = "任务提交")
|
||||
@Tag(name = "任务提交")
|
||||
@RestController
|
||||
@RequestMapping("/mj/submit")
|
||||
@RequiredArgsConstructor
|
||||
@@ -33,7 +33,7 @@ public class SubmitController {
|
||||
private final IChatCostService chatCostService;
|
||||
private final MjOkHttpUtil mjOkHttpUtil;
|
||||
|
||||
@ApiOperation(value = "绘图变化")
|
||||
@Operation(summary = "绘图变化")
|
||||
@PostMapping("/change")
|
||||
public String change(@RequestBody SubmitChangeDTO changeDTO) {
|
||||
String jsonStr = JSONUtil.toJsonStr(changeDTO);
|
||||
@@ -42,7 +42,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "执行动作")
|
||||
@Operation(summary = "执行动作")
|
||||
@PostMapping("/action")
|
||||
public String action(@RequestBody SubmitActionDTO changeDTO) {
|
||||
ActionType actionType = ActionType.fromCustomId(getAction(changeDTO.getCustomId()));
|
||||
@@ -69,7 +69,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "绘图变化-simple")
|
||||
@Operation(summary = "绘图变化-simple")
|
||||
@PostMapping("/simple-change")
|
||||
public String simpleChange(@RequestBody SubmitSimpleChangeDTO simpleChangeDTO) {
|
||||
String jsonStr = JSONUtil.toJsonStr(simpleChangeDTO);
|
||||
@@ -78,7 +78,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交图生图、混图任务")
|
||||
@Operation(summary = "提交图生图、混图任务")
|
||||
@PostMapping("/blend")
|
||||
public String blend(@RequestBody SubmitBlendDTO blendDTO) {
|
||||
chatCostService.taskDeduct("mj","blend", 0.0);
|
||||
@@ -88,7 +88,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交图生文任务")
|
||||
@Operation(summary = "提交图生文任务")
|
||||
@PostMapping("/describe")
|
||||
public String describe(@RequestBody SubmitDescribeDTO describeDTO) {
|
||||
chatCostService.taskDeduct("mj","describe",0.0);
|
||||
@@ -98,7 +98,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交文生图任务")
|
||||
@Operation(summary = "提交文生图任务")
|
||||
@PostMapping("/imagine")
|
||||
public String imagine(@RequestBody SubmitImagineDTO imagineDTO) {
|
||||
chatCostService.taskDeduct("mj",imagineDTO.getPrompt(), 0.0);
|
||||
@@ -108,7 +108,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交局部重绘任务")
|
||||
@Operation(summary = "提交局部重绘任务")
|
||||
@PostMapping("/modal")
|
||||
public String modal(@RequestBody SubmitModalDTO submitModalDTO) {
|
||||
chatCostService.taskDeduct("mj","repaint ", 0.0);
|
||||
@@ -118,7 +118,7 @@ public class SubmitController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "提交提示词分析任务")
|
||||
@Operation(summary = "提交提示词分析任务")
|
||||
@PostMapping("/shorten")
|
||||
public String shorten(@RequestBody SubmitShortenDTO submitShortenDTO) {
|
||||
chatCostService.taskDeduct("mj","shorten", 0.0);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.ruoyi.chat.controller.tripartite;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
@@ -29,7 +29,7 @@ public class SunoController {
|
||||
private final OkHttpConfig okHttpConfig;
|
||||
private final IChatCostService chatCostService;
|
||||
|
||||
@ApiOperation(value = "文生歌曲")
|
||||
@Operation(summary = "文生歌曲")
|
||||
@PostMapping("/generate")
|
||||
public String generate(@RequestBody GenerateSuno generateSuno) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("suno");
|
||||
@@ -42,7 +42,7 @@ public class SunoController {
|
||||
return okHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "生成歌词")
|
||||
@Operation(summary = "生成歌词")
|
||||
@PostMapping("/generate/lyrics/")
|
||||
public String generate(@RequestBody GenerateLyric generateLyric) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("suno");
|
||||
@@ -53,7 +53,7 @@ public class SunoController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询歌词任务")
|
||||
@Operation(summary = "查询歌词任务")
|
||||
@GetMapping("/lyrics/{taskId}")
|
||||
public String lyrics(@PathVariable String taskId) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("suno");
|
||||
@@ -63,7 +63,7 @@ public class SunoController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询歌曲任务")
|
||||
@Operation(summary = "查询歌曲任务")
|
||||
@GetMapping("/feed/{taskId}")
|
||||
public String feed(@PathVariable String taskId) {
|
||||
OkHttpUtil okHttpUtil = okHttpConfig.getOkHttpUtil("suno");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package org.ruoyi.chat.controller.tripartite;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
@@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
* @author ageerle
|
||||
* @date 2025-05-03
|
||||
*/
|
||||
@Api(tags = "任务查询")
|
||||
@Tag(name = "任务查询")
|
||||
@RestController
|
||||
@RequestMapping("/mj/task")
|
||||
@RequiredArgsConstructor
|
||||
@@ -27,15 +27,15 @@ public class TaskController {
|
||||
|
||||
private final MjOkHttpUtil mjOkHttpUtil;
|
||||
|
||||
@ApiOperation(value = "指定ID获取任务")
|
||||
@Operation(summary = "指定ID获取任务")
|
||||
@GetMapping("/{id}/fetch")
|
||||
public String fetch(@ApiParam(value = "任务ID") @PathVariable String id) {
|
||||
public String fetch(@Parameter(description = "任务ID") @PathVariable String id) {
|
||||
String url = "mj/task/" + id + "/fetch";
|
||||
Request request = mjOkHttpUtil.createGetRequest(url);
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据ID列表查询任务")
|
||||
@Operation(summary = "根据ID列表查询任务")
|
||||
@PostMapping("/list-by-condition")
|
||||
public String listByIds(@RequestBody TaskConditionDTO conditionDTO) {
|
||||
String url = "mj/task/list-by-condition";
|
||||
@@ -44,9 +44,9 @@ public class TaskController {
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取任务图片的seed")
|
||||
@Operation(summary = "获取任务图片的seed")
|
||||
@GetMapping("/{id}/image-seed")
|
||||
public String getSeed(@ApiParam(value = "任务ID") @PathVariable String id) {
|
||||
public String getSeed(@Parameter(description = "任务ID") @PathVariable String id) {
|
||||
String url = "mj/task/" + id + "/image-seed";
|
||||
Request request = mjOkHttpUtil.createGetRequest(url);
|
||||
return mjOkHttpUtil.executeRequest(request);
|
||||
|
||||
@@ -2,7 +2,7 @@ package org.ruoyi.chat.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
public class DomainObject implements Serializable {
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModelProperty("ID")
|
||||
@Schema(description = "ID")
|
||||
protected String id;
|
||||
|
||||
@Setter
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.ruoyi.chat.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -10,13 +9,13 @@ import java.io.Serializable;
|
||||
* @author WangLe
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("Discord账号")
|
||||
@Schema(name = "Discord账号")
|
||||
public class InsightFace implements Serializable {
|
||||
/**本人头像json*/
|
||||
@ApiModelProperty("本人头像json")
|
||||
@Schema(description = "本人头像json")
|
||||
private String sourceBase64;
|
||||
|
||||
/**明星头像json*/
|
||||
@ApiModelProperty("明星头像json")
|
||||
@Schema(description = "明星头像json")
|
||||
private String targetBase64;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -8,9 +8,9 @@ import lombok.Setter;
|
||||
@Setter
|
||||
public abstract class BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty("自定义参数")
|
||||
@Schema(description = "自定义参数")
|
||||
protected String state;
|
||||
|
||||
@ApiModelProperty("回调地址, 为空时使用全局notifyHook")
|
||||
@Schema(description = "回调地址, 为空时使用全局notifyHook")
|
||||
protected String notifyHook;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("变化任务提交参数")
|
||||
@Schema(name = "变化任务提交参数")
|
||||
public class SubmitActionDTO {
|
||||
|
||||
private String customId;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.chat.enums.BlendDimensions;
|
||||
@@ -9,13 +9,13 @@ import org.ruoyi.chat.enums.BlendDimensions;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("Blend提交参数")
|
||||
@Schema(name = "Blend提交参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubmitBlendDTO extends BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty(value = "图片base64数组", required = true, example = "[\"data:image/png;base64,xxx1\", \"data:image/png;base64,xxx2\"]")
|
||||
@ArraySchema(arraySchema = @Schema(description = "图片base64数组", requiredMode = Schema.RequiredMode.REQUIRED), schema = @Schema(example = "data:image/png;base64,xxx1"))
|
||||
private List<String> base64Array;
|
||||
|
||||
@ApiModelProperty(value = "比例: PORTRAIT(2:3); SQUARE(1:1); LANDSCAPE(3:2)", example = "SQUARE")
|
||||
@Schema(description = "比例: PORTRAIT(2:3); SQUARE(1:1); LANDSCAPE(3:2)", example = "SQUARE")
|
||||
private BlendDimensions dimensions = BlendDimensions.SQUARE;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.ruoyi.chat.enums.TaskAction;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("变化任务提交参数")
|
||||
@Schema(name = "变化任务提交参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubmitChangeDTO extends BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty(value = "任务ID", required = true, example = "\"1320098173412546\"")
|
||||
@Schema(description = "任务ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "\"1320098173412546\"")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "UPSCALE(放大); VARIATION(变换); REROLL(重新生成)", required = true,
|
||||
allowableValues = "UPSCALE, VARIATION, REROLL", example = "UPSCALE")
|
||||
@Schema(description = "UPSCALE(放大); VARIATION(变换); REROLL(重新生成)", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"UPSCALE", "VARIATION", "REROLL"}, example = "UPSCALE")
|
||||
private TaskAction action;
|
||||
|
||||
@ApiModelProperty(value = "序号(1~4), action为UPSCALE,VARIATION时必传", allowableValues = "range[1, 4]", example = "1")
|
||||
@Schema(description = "序号(1~4), action为UPSCALE,VARIATION时必传", minimum = "1", maximum = "4", example = "1")
|
||||
private Integer index;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@ApiModel("Describe提交参数")
|
||||
@Schema(name = "Describe提交参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubmitDescribeDTO extends BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty(value = "图片base64", required = true, example = "data:image/png;base64,xxx")
|
||||
@Schema(description = "图片base64", requiredMode = Schema.RequiredMode.REQUIRED, example = "data:image/png;base64,xxx")
|
||||
private String base64;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -9,17 +8,17 @@ import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("Imagine提交参数")
|
||||
@Schema(name = "Imagine提交参数")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubmitImagineDTO extends BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty(value = "提示词", required = true, example = "Cat")
|
||||
@Schema(description = "提示词", requiredMode = Schema.RequiredMode.REQUIRED, example = "Cat")
|
||||
private String prompt;
|
||||
|
||||
@ApiModelProperty(value = "垫图base64数组")
|
||||
@Schema(description = "垫图base64数组")
|
||||
private List<String> base64Array;
|
||||
|
||||
@ApiModelProperty(hidden = true)
|
||||
@Schema(hidden = true)
|
||||
@Deprecated(since = "3.0", forRemoval = true)
|
||||
private String base64;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("局部重绘提交参数")
|
||||
@Schema(name = "局部重绘提交参数")
|
||||
public class SubmitModalDTO extends BaseSubmitDTO{
|
||||
|
||||
private String maskBase64;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("prompt分析提交参数")
|
||||
@Schema(name = "prompt分析提交参数")
|
||||
public class SubmitShortenDTO extends BaseSubmitDTO{
|
||||
|
||||
private String botType;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("变化任务提交参数-simple")
|
||||
@Schema(name = "变化任务提交参数-simple")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SubmitSimpleChangeDTO extends BaseSubmitDTO {
|
||||
|
||||
@ApiModelProperty(value = "变化描述: ID $action$index", required = true, example = "1320098173412546 U2")
|
||||
@Schema(description = "变化描述: ID $action$index", requiredMode = Schema.RequiredMode.REQUIRED, example = "1320098173412546 U2")
|
||||
private String content;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
package org.ruoyi.chat.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.v3.oas.annotations.media.ArraySchema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("任务查询参数")
|
||||
@Schema(name = "任务查询参数")
|
||||
public class TaskConditionDTO {
|
||||
|
||||
@ArraySchema(arraySchema = @Schema(description = "任务ID列表"), schema = @Schema(example = "1320098173412546"))
|
||||
private List<String> ids;
|
||||
|
||||
}
|
||||
|
||||
@@ -435,8 +435,8 @@ public class ChatCostServiceImpl implements IChatCostService {
|
||||
@Override
|
||||
public boolean checkBalanceSufficient(ChatRequest chatRequest) {
|
||||
if (chatRequest.getUserId() == null) {
|
||||
log.warn("checkBalanceSufficient->用户ID为空,视为余额不足");
|
||||
return false;
|
||||
log.warn("当前未登录");
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class OpenAIServiceImpl implements IChatService {
|
||||
this.chatClient = chatClientBuilder
|
||||
.defaultOptions(
|
||||
OpenAiChatOptions.builder().model("gpt-4o-mini").build())
|
||||
.defaultTools(new SyncMcpToolCallbackProvider(mcpSyncClients))
|
||||
.defaultToolCallbacks(new SyncMcpToolCallbackProvider(mcpSyncClients))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,16 @@ public class BillingChatServiceProxy implements IChatService {
|
||||
String errorMsg = "余额不足,无法使用AI服务,请充值后再试";
|
||||
log.warn("余额不足阻止AI回复,用户ID: {}, 模型: {}",
|
||||
chatRequest.getUserId(), chatRequest.getModel());
|
||||
throw new RuntimeException(errorMsg);
|
||||
try {
|
||||
emitter.send(errorMsg);
|
||||
emitter.complete();
|
||||
} catch (IOException e) {
|
||||
log.error("推送流异常,用户ID: {}, 模型: {}",
|
||||
chatRequest.getUserId(), chatRequest.getModel());
|
||||
emitter.complete();
|
||||
throw new RuntimeException(errorMsg);
|
||||
}
|
||||
return emitter;
|
||||
}
|
||||
|
||||
log.debug("余额检查通过,开始AI回复,用户ID: {}, 模型: {}",
|
||||
|
||||
Reference in New Issue
Block a user