Commit 3d7c994bf96ae01fdd8a810a835ed0b9254115f7

Authored by cherishsince
1 parent c21b5f76

【调整】ai模型,增加sort排序

yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dal/dataobject/AiChatModalDO.java
@@ -44,7 +44,12 @@ public class AiChatModalDO extends BaseDO { @@ -44,7 +44,12 @@ public class AiChatModalDO extends BaseDO {
44 */ 44 */
45 private Integer disable; 45 private Integer disable;
46 /** 46 /**
  47 + * 排序
  48 + */
  49 + private Integer sort;
  50 + /**
47 * modal 配置(json) 51 * modal 配置(json)
48 */ 52 */
49 private String config; 53 private String config;
  54 +
50 } 55 }
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 { @@ -54,7 +54,7 @@ public class AiChatModalServiceImpl implements AiChatModalService {
54 queryWrapperX.like(AiChatModalDO::getName, req.getSearch().trim()); 54 queryWrapperX.like(AiChatModalDO::getName, req.getSearch().trim());
55 } 55 }
56 // 默认排序 56 // 默认排序
57 - queryWrapperX.orderByDesc(AiChatModalDO::getId); 57 + queryWrapperX.orderByAsc(AiChatModalDO::getSort);
58 // 查询 58 // 查询
59 PageResult<AiChatModalDO> aiChatModalDOPageResult = aiChatModalMapper.selectPage(req, queryWrapperX); 59 PageResult<AiChatModalDO> aiChatModalDOPageResult = aiChatModalMapper.selectPage(req, queryWrapperX);
60 // 转换 res 60 // 转换 res
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; @@ -19,25 +19,29 @@ import java.util.Map;
19 @Accessors(chain = true) 19 @Accessors(chain = true)
20 public class AiChatModalAddReq { 20 public class AiChatModalAddReq {
21 21
22 - @NotNull  
23 @Schema(description = "模型名字") 22 @Schema(description = "模型名字")
24 @Size(max = 60, message = "模型名字最大60个字符") 23 @Size(max = 60, message = "模型名字最大60个字符")
  24 + @NotNull(message = "模型名字不能为空!")
25 private String name; 25 private String name;
26 26
27 - @NotNull  
28 @Size(max = 32, message = "模型平台最大32个字符") 27 @Size(max = 32, message = "模型平台最大32个字符")
29 @Schema(description = "模型平台 参考 AiPlatformEnum") 28 @Schema(description = "模型平台 参考 AiPlatformEnum")
  29 + @NotNull(message = "平台不能为空!")
30 private String platform; 30 private String platform;
31 31
32 - @NotNull  
33 @Schema(description = "模型类型(qianwen、yiyan、xinghuo、openai)") 32 @Schema(description = "模型类型(qianwen、yiyan、xinghuo、openai)")
34 @Size(max = 32, message = "模型类型最大32个字符") 33 @Size(max = 32, message = "模型类型最大32个字符")
  34 + @NotNull(message = "modal模型不能为空!")
35 private String modal; 35 private String modal;
36 36
37 @Schema(description = "模型照片") 37 @Schema(description = "模型照片")
38 @Size(max = 256, message = "模型照片地址最大256个字符") 38 @Size(max = 256, message = "模型照片地址最大256个字符")
39 private String imageUrl; 39 private String imageUrl;
40 40
  41 + @Schema(description = "排序")
  42 + @NotNull(message = "sort排序不能为空!")
  43 + private Integer sort;
  44 +
41 @Schema(description = "模型配置JSON") 45 @Schema(description = "模型配置JSON")
42 // @Size(max = 1024, message = "模型配置最大1024个字符") 46 // @Size(max = 1024, message = "模型配置最大1024个字符")
43 private Map<String, Object> config; 47 private Map<String, Object> config;
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 { @@ -34,6 +34,9 @@ public class AiChatModalListRes {
34 @Schema(description = "禁用 0、正常 1、禁用") 34 @Schema(description = "禁用 0、正常 1、禁用")
35 private Integer disable; 35 private Integer disable;
36 36
  37 + @Schema(description = "排序 asc 排序")
  38 + private Integer sort;
  39 +
37 @Schema(description = "modal 配置") 40 @Schema(description = "modal 配置")
38 private String config; 41 private String config;
39 } 42 }
yudao-module-ai/yudao-module-ai-biz/src/main/resources/http/chat-modal.http
@@ -10,10 +10,11 @@ Content-Type: application/json @@ -10,10 +10,11 @@ Content-Type: application/json
10 Authorization: {{token}} 10 Authorization: {{token}}
11 11
12 { 12 {
13 - "name": "小红书Ai写作大模型-plus",  
14 - "modal": "ERNIE-3.5-8K", 13 + "name": "小红书Ai写作大模型4.0",
  14 + "modal": "ERNIE 4.0",
15 "platform": "yiyan", 15 "platform": "yiyan",
16 "imageUrl": "", 16 "imageUrl": "",
  17 + "sort": 100,
17 "config": { 18 "config": {
18 "topK": 0.6, 19 "topK": 0.6,
19 "topP": 0.6, 20 "topP": 0.6,
@@ -32,6 +33,7 @@ Authorization: {{token}} @@ -32,6 +33,7 @@ Authorization: {{token}}
32 "modal": "ERNIE-3.5-8K", 33 "modal": "ERNIE-3.5-8K",
33 "platform": "yiyan", 34 "platform": "yiyan",
34 "imageUrl": "", 35 "imageUrl": "",
  36 + "sort": 1,
35 "config": { 37 "config": {
36 "topK": 0.6, 38 "topK": 0.6,
37 "topP": 0.6, 39 "topP": 0.6,