From 3d7c994bf96ae01fdd8a810a835ed0b9254115f7 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Mon, 6 May 2024 16:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E6=95=B4=E3=80=91ai=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E5=A2=9E=E5=8A=A0sort=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/ai/dal/dataobject/AiChatModalDO.java | 5 +++++ .../module/ai/service/impl/AiChatModalServiceImpl.java | 2 +- .../iocoder/yudao/module/ai/vo/AiChatModalAddReq.java | 10 +++++++--- .../iocoder/yudao/module/ai/vo/AiChatModalListRes.java | 3 +++ .../src/main/resources/http/chat-modal.http | 6 ++++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/AiChatModalDO.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/AiChatModalDO.java index 43175d349..cb045c549 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/AiChatModalDO.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/AiChatModalDO.java @@ -43,8 +43,13 @@ public class AiChatModalDO extends BaseDO { * 禁用 0、正常 1、禁用 */ private Integer disable; + /** + * 排序 + */ + private Integer sort; /** * modal 配置(json) */ private String config; + } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/AiChatModalServiceImpl.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/AiChatModalServiceImpl.java index cc7f505b1..b8030cc9f 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/AiChatModalServiceImpl.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/AiChatModalServiceImpl.java @@ -54,7 +54,7 @@ public class AiChatModalServiceImpl implements AiChatModalService { queryWrapperX.like(AiChatModalDO::getName, req.getSearch().trim()); } // 默认排序 - queryWrapperX.orderByDesc(AiChatModalDO::getId); + queryWrapperX.orderByAsc(AiChatModalDO::getSort); // 查询 PageResult aiChatModalDOPageResult = aiChatModalMapper.selectPage(req, queryWrapperX); // 转换 res diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalAddReq.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalAddReq.java index 4145e2cd4..6a2b143dd 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalAddReq.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalAddReq.java @@ -19,25 +19,29 @@ import java.util.Map; @Accessors(chain = true) public class AiChatModalAddReq { - @NotNull @Schema(description = "模型名字") @Size(max = 60, message = "模型名字最大60个字符") + @NotNull(message = "模型名字不能为空!") private String name; - @NotNull @Size(max = 32, message = "模型平台最大32个字符") @Schema(description = "模型平台 参考 AiPlatformEnum") + @NotNull(message = "平台不能为空!") private String platform; - @NotNull @Schema(description = "模型类型(qianwen、yiyan、xinghuo、openai)") @Size(max = 32, message = "模型类型最大32个字符") + @NotNull(message = "modal模型不能为空!") private String modal; @Schema(description = "模型照片") @Size(max = 256, message = "模型照片地址最大256个字符") private String imageUrl; + @Schema(description = "排序") + @NotNull(message = "sort排序不能为空!") + private Integer sort; + @Schema(description = "模型配置JSON") // @Size(max = 1024, message = "模型配置最大1024个字符") private Map config; diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalListRes.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalListRes.java index d05ed7d0d..ce99e39db 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalListRes.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/AiChatModalListRes.java @@ -34,6 +34,9 @@ public class AiChatModalListRes { @Schema(description = "禁用 0、正常 1、禁用") private Integer disable; + @Schema(description = "排序 asc 排序") + private Integer sort; + @Schema(description = "modal 配置") private String config; } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http index 50c89908c..ab8aa85c6 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http @@ -10,10 +10,11 @@ Content-Type: application/json Authorization: {{token}} { - "name": "小红书Ai写作大模型-plus", - "modal": "ERNIE-3.5-8K", + "name": "小红书Ai写作大模型4.0", + "modal": "ERNIE 4.0", "platform": "yiyan", "imageUrl": "", + "sort": 100, "config": { "topK": 0.6, "topP": 0.6, @@ -32,6 +33,7 @@ Authorization: {{token}} "modal": "ERNIE-3.5-8K", "platform": "yiyan", "imageUrl": "", + "sort": 1, "config": { "topK": 0.6, "topP": 0.6,