-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(n2sql): reconstruct the prompt word configuration to support the… #2112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(n2sql): reconstruct the prompt word configuration to support the… #2112
Conversation
… optimization of prompt word functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the prompt word configuration system to support multiple optimization configurations and prevent user prompt interference. The changes move from a single custom prompt replacement system to a multi-configuration optimization approach that enhances the original prompt template.
- Restructured UI to use a new PromptOptimizationConfig component for better configuration management
- Modified backend services to support multiple prompt optimization configurations instead of single prompt replacement
- Updated the report generator to apply optimization configurations additively to the base template
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
AgentDetail.vue | Replaced inline prompt configuration section with new PromptOptimizationConfig component |
PromptOptimizationConfig.vue | New component for managing multiple prompt optimization configurations with CRUD operations |
PromptConfigController.java | Updated controller comments and added endpoint for retrieving all active optimization configs |
report-generator.txt | Added optimization_section placeholder to the prompt template |
UserPromptConfigService.java | Refactored to support multiple active configurations with in-memory caching |
PromptHelper.java | Updated to build optimization sections from multiple configs instead of replacing entire prompt |
ReportGeneratorNode.java | Modified to use optimization configs instead of custom prompt replacement |
UserPromptConfig.java | Updated entity documentation to reflect optimization usage |
PromptConfigDTO.java | Renamed systemPrompt field to optimizationPrompt to better reflect usage |
...-alibaba-nl2sql-chat/src/main/java/com/alibaba/cloud/ai/service/UserPromptConfigService.java
Outdated
Show resolved
Hide resolved
...pring-ai-alibaba-nl2sql-chat/src/main/java/com/alibaba/cloud/ai/entity/UserPromptConfig.java
Show resolved
Hide resolved
...-alibaba-nl2sql-chat/src/main/java/com/alibaba/cloud/ai/service/UserPromptConfigService.java
Outdated
Show resolved
Hide resolved
...ql/spring-ai-alibaba-nl2sql-chat/src/main/java/com/alibaba/cloud/ai/prompt/PromptHelper.java
Outdated
Show resolved
Hide resolved
fix optimizationPrompt
improve optimization section handling
目前用户可以添加提示词干扰用户报告输出内容

这是前端界面,可能要优化一下,配置的提示词如下:
在配置提示词后,用户提问如下:
查询每个商品分类下,已成交且销量最高的商品及其销售总量。每个分类仅返回销量最高的商品。不要用Python
结果如下:


发现可以成功干预
在没有配置提示词,用户相同提问下,就没有出现上述图中标红的部分:
