Skip to content

Commit 83bc77f

Browse files
authored
fix: Fix folder hierarchy restrictions and add AI models (#214)
1 parent 46d6cc1 commit 83bc77f

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

base/src/main/java/com/tinyengine/it/common/enums/Enums.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,12 @@ public enum FoundationModel {
793793
* Moonshot v1 8k e foundation model.
794794
*/
795795
// kimi
796-
MOONSHOT_V1_8K("moonshot-v1-8k");
796+
MOONSHOT_V1_8K("moonshot-v1-8k"),
797+
/**
798+
* Moonshot v3 e foundation model.
799+
*/
800+
// deepseek
801+
DEEPSEEK_V3("deepseek-chat");
797802
private final String value;
798803

799804
FoundationModel(String value) {

base/src/main/java/com/tinyengine/it/config/AiChatConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
public class AiChatConfig {
2626
private static final String OPENAI_API_URL = "https://api.openai.com";
2727
private static final String LOCAL_GPT_API_URL = "https://dashscope.aliyuncs.com/compatible-mode";
28+
private static final String DEEPSEEK_V3_URL = "https://api.deepseek.com";
2829

2930

3031
/**
@@ -44,14 +45,22 @@ public static Map<String, AiChatConfigData> getAiChatConfig(String model, String
4445
String localGptApiKey = Enums.FoundationModel.LOCAL_GPT.getValue().equals(model) ? token : null;
4546
localGptHeaders.put("Authorization", "Bearer " + localGptApiKey);
4647

48+
Map<String, String> deepSeekHeaders = new HashMap<>();
49+
String deepSeekApiKey = Enums.FoundationModel.DEEPSEEK_V3.getValue().equals(model) ? token : null;
50+
deepSeekHeaders.put("Authorization", "Bearer " + deepSeekApiKey);
51+
4752
Map<String, String> ernieBotHeaders = new HashMap<>();
4853

54+
4955
config.put(Enums.FoundationModel.GPT_35_TURBO.getValue(), new AiChatConfigData(
5056
OPENAI_API_URL + "/v1/chat/completions", createCommonRequestOption(), openaiHeaders, "openai"));
5157

5258
config.put(Enums.FoundationModel.LOCAL_GPT.getValue(), new AiChatConfigData(
5359
LOCAL_GPT_API_URL + "/v1/chat/completions", createCommonRequestOption(), localGptHeaders, "!openai"));
5460

61+
config.put(Enums.FoundationModel.DEEPSEEK_V3.getValue(), new AiChatConfigData(
62+
DEEPSEEK_V3_URL + "/chat/completions", createCommonRequestOption(), deepSeekHeaders, "DeepSeek"));
63+
5564
String ernieBotAccessToken = Enums.FoundationModel.ERNIBOT_TURBO.getValue().equals(model) ? token : null;
5665
config.put(Enums.FoundationModel.ERNIBOT_TURBO.getValue(),
5766
new AiChatConfigData(

base/src/main/java/com/tinyengine/it/model/dto/AiParam.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
public class AiParam {
2727
private Map<String, String> foundationModel;
2828
private List<AiMessages> messages;
29+
private String model;
2930

3031
public AiParam(Map<String, String> foundationModel, List<AiMessages> messages) {
3132
this.foundationModel = foundationModel;
3233
this.messages = messages;
34+
this.model = foundationModel.get("model");
3335
}
3436

3537
public AiParam() {

base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,7 @@ public Result<Integer> getDepth(String parentId) {
445445
// getFolder 获取父类信息
446446
Page parentInfo = pageMapper.queryPageById(parent);
447447
int depth = parentInfo.getDepth();
448-
if (depth < 5) {
449-
return Result.success(depth);
450-
}
451-
return Result.failed("Exceeded depth");
448+
return Result.success(depth);
452449
}
453450

454451
/**

base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,9 @@ public List<ComponentTree> getSchemaComponentsTree(MetaDto metaDto) {
467467
Map<String, Object> data = Utils.convert(pageInfo);
468468
boolean isToLine = false;
469469
Map<String, Object> page = formatDataFields(data, resKeys, isToLine);
470-
page.put("isHome", String.valueOf(page.get("id")).equals(app.getHomePage().toString()));
470+
if (null != app.getHomePage()) {
471+
page.put("isHome", String.valueOf(page.get("id")).equals(app.getHomePage().toString()));
472+
}
471473
Map<String, Object> schema;
472474
Schema schemaUtil = new Schema();
473475
if (!pageInfo.getIsPage()) {

0 commit comments

Comments
 (0)