fix: Fix folder hierarchy restrictions and add AI models#214
fix: Fix folder hierarchy restrictions and add AI models#214hexqi merged 98 commits intoopentiny:developfrom
Conversation
WalkthroughA new AI model, DEEPSEEK_V3, has been integrated across the codebase, including its enumeration, configuration, and DTO handling. The depth restriction in the page service has been removed, and a null check was added to prevent exceptions in the app service. No changes were made to method signatures. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AiParam
participant AiChatConfig
participant FoundationModel
Client->>FoundationModel: Select DEEPSEEK_V3
Client->>AiParam: Construct with foundationModel map
AiParam->>AiParam: Extract and set model field
Client->>AiChatConfig: getAiChatConfig("DEEPSEEK_V3", token)
AiChatConfig->>AiChatConfig: Set DeepSeek headers and URL
AiChatConfig-->>Client: Return config for DEEPSEEK_V3
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
base/src/main/java/com/tinyengine/it/model/dto/AiParam.java (1)
34-34: Consider adding null check for model initializationWhile the code works correctly, consider adding a null check when retrieving the "model" key from the foundationModel map to prevent potential NullPointerExceptions.
-this.model = foundationModel.get("model"); +this.model = foundationModel != null ? foundationModel.get("model") : null;base/src/main/java/com/tinyengine/it/config/AiChatConfig.java (1)
54-54: Remove unnecessary empty line.There's an extra empty line that appears to be unnecessary and inconsistent with the spacing pattern in the rest of the file.
52 Map<String, String> ernieBotHeaders = new HashMap<>(); 53 - 55 config.put(Enums.FoundationModel.GPT_35_TURBO.getValue(), new AiChatConfigData(
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
base/src/main/java/com/tinyengine/it/common/enums/Enums.java(1 hunks)base/src/main/java/com/tinyengine/it/config/AiChatConfig.java(2 hunks)base/src/main/java/com/tinyengine/it/model/dto/AiParam.java(1 hunks)base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java(1 hunks)base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
base/src/main/java/com/tinyengine/it/config/AiChatConfig.java (1)
base/src/main/java/com/tinyengine/it/common/enums/Enums.java (1)
Enums(20-911)
🔇 Additional comments (7)
base/src/main/java/com/tinyengine/it/service/app/impl/v1/AppV1ServiceImpl.java (1)
470-472: Good defensive programming with null checkAdding this null check is a good practice to prevent NullPointerExceptions when app.getHomePage() is null. This improves the robustness of the code.
base/src/main/java/com/tinyengine/it/common/enums/Enums.java (1)
797-801: DEEPSEEK_V3 model addition looks goodThe new AI model enum value is properly added with appropriate documentation and follows the existing pattern.
base/src/main/java/com/tinyengine/it/model/dto/AiParam.java (1)
29-29: New model field looks goodThis field will store the foundation model identifier.
base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java (1)
448-448:Details
❓ Verification inconclusive
Removed depth limit restriction
The depth limit check has been removed, allowing unlimited folder nesting depth. However, note that there's still a depth limit check in the
getTreeNodesmethod at line 719 that throws an exception if level > 5. Consider whether this inconsistency is intentional or if both methods should have the same depth limit behavior.
🏁 Script executed:
#!/bin/bash # Check for other depth limit checks in the codebase rg -A 2 "Exceeded depth" --type javaLength of output: 666
Inconsistent depth limit enforcement in PageServiceImpl
The method at line 448 now returns unlimited depth (
Result.success(depth)), whereasgetTreeNodes(around line 719) still throws aServiceException("Exceeded depth")when depth > 5 (and is covered byPageServiceImplTest). Please confirm the intended behavior and either:
- Restore a consistent depth check in the first method, or
- Remove/adjust the limit in
getTreeNodes(and update its tests) if unlimited nesting is desired.Locations to review:
- base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java
• Line 448: unlimited return
• Line 719: throws on> 5- base/src/test/java/com/tinyengine/it/service/app/impl/PageServiceImplTest.java
• Assertion for “Exceeded depth”base/src/main/java/com/tinyengine/it/config/AiChatConfig.java (3)
28-28: API URL for DEEPSEEK_V3 model added correctly.The constant follows the established naming convention and provides the base URL for the DeepSeek API.
48-50: Authentication headers for DEEPSEEK_V3 model implemented correctly.The implementation follows the same pattern as other AI models, correctly setting up the authorization header with the API key when the DEEPSEEK_V3 model is selected.
61-62: Configuration for DEEPSEEK_V3 model added correctly.The configuration correctly maps the DEEPSEEK_V3 model to its API endpoint, using the appropriate headers and manufacturer name. Note that the endpoint path differs slightly from other models ("/chat/completions" vs "/v1/chat/completions"), which appears to be specific to the DeepSeek API.
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Bug Fixes
Improvements