diff --git a/skills/data_analysis_skill.json b/skills/data_analysis_skill.json deleted file mode 100644 index c5283f5f8..000000000 --- a/skills/data_analysis_skill.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "metadata": { - "name": "data_analysis_assistant", - "description": "Data analysis assistant for processing and visualizing data", - "version": "1.0.0", - "author": "DB-GPT Team", - "skill_type": "data_analysis", - "tags": ["data", "analysis", "visualization"] - }, - "prompt_template": "You are a data analysis assistant. Help users analyze data, generate insights, and create visualizations. Use the available tools to process data and generate reports.", - "required_tools": ["python_interpreter", "plotting_tool"], - "required_knowledge": ["statistics", "data_science"], - "config": { - "max_dataframe_rows": 10000, - "enable_auto_visualization": true - } -} diff --git a/skills/user/code-review/SKILL.md b/skills/user/code-review/SKILL.md deleted file mode 100644 index e6fbe4206..000000000 --- a/skills/user/code-review/SKILL.md +++ /dev/null @@ -1,246 +0,0 @@ ---- -name: code-review -description: Systematic approach to reviewing code quality and best practices -version: 1.0.0 -author: DB-GPT Team -skill_type: coding -tags: [code, review, quality] -allowed-tools: -license: MIT ---- - -# Code Review Skill - -## When to Use -- User requests code review -- Need to evaluate code quality -- Looking for bugs or issues -- Checking for best practices -- Assessing security vulnerabilities -- Reviewing performance considerations - -## Code Review Checklist - -### Functionality -- [ ] Does the code implement the required features? -- [ ] Are edge cases handled properly? -- [ ] Does it handle errors gracefully? -- [ ] Are there any obvious bugs? - -### Code Quality -- [ ] Is the code readable and well-structured? -- [ ] Are variable and function names descriptive? -- [ ] Is there unnecessary code duplication? -- [ ] Are comments clear and helpful? - -### Performance -- [ ] Are there any performance bottlenecks? -- [ ] Are data structures chosen appropriately? -- [ ] Are there inefficient loops or operations? -- [ ] Is caching appropriate? - -### Security -- [ ] Are there any security vulnerabilities? -- [ ] Is user input properly validated? -- [ ] Are sensitive data handled correctly? -- [ ] Are there injection risks? - -### Best Practices -- [ ] Does it follow language conventions? -- [ ] Are common patterns used appropriately? -- [ ] Is the code modular and reusable? -- [ ] Are dependencies managed properly? - -## Review Structure - -### 1. Summary -- Brief overview of what the code does -- Overall impression -- Key strengths and weaknesses - -### 2. Issues by Category - -#### Critical Issues -```markdown -**Issue**: [Brief description] -**Location**: [File:Line] -**Impact**: [Why this matters] -**Suggestion**: [How to fix] -``` - -#### Style and Convention Issues -```markdown -**Issue**: [Brief description] -**Location**: [File:Line] -**Suggestion**: [How to fix] -``` - -#### Optimization Opportunities -```markdown -**Opportunity**: [Brief description] -**Location**: [File:Line] -**Current**: [Current approach] -**Suggested**: [Better approach] -**Impact**: [Expected improvement] -``` - -#### Best Practices -```markdown -**Suggestion**: [Improvement] -**Location**: [File:Line] -**Reason**: [Why this is better] -``` - -### 3. Positive Feedback -- Well-implemented features -- Good practices observed -- Notable strengths - -### 4. Recommendations -- Prioritized list of improvements -- Long-term suggestions -- Additional resources - -## Common Patterns to Check - -### Python -- Use list comprehensions appropriately -- Follow PEP 8 guidelines -- Use context managers (`with` statements) -- Implement `__str__` and `__repr__` -- Use type hints -- Handle exceptions properly -- Avoid mutable default arguments - -### JavaScript/TypeScript -- Use `const` and `let` instead of `var` -- Use arrow functions appropriately -- Handle promises correctly -- Avoid implicit globals -- Use modern ES6+ features -- Properly scope variables - -### SQL -- Use parameterized queries -- Index common query columns -- Avoid SELECT * -- Use appropriate JOIN types -- Handle NULL values correctly -- Optimize subqueries - -## Security Checks - -### Input Validation -```python -# Bad -user_input = request.form.get('data') -# Direct use without validation - -# Good -user_input = request.form.get('data', '').strip() -if not is_valid_input(user_input): - raise ValueError("Invalid input") -``` - -### SQL Injection -```python -# Bad -query = f"SELECT * FROM users WHERE name = '{name}'" - -# Good -query = "SELECT * FROM users WHERE name = %s" -cursor.execute(query, (name,)) -``` - -### XSS Prevention -```python -# Bad -return f"
{user_content}
" - -# Good -from markupsafe import escape -return f"
{escape(user_content)}
" -``` - -## Code Review Principles - -1. **Be Constructive**: Focus on improvement, not criticism -2. **Be Specific**: Point to exact locations and issues -3. **Provide Context**: Explain why something is a problem -4. **Offer Solutions**: Suggest how to fix issues -5. **Be Thorough**: Don't miss important issues -6. **Be Timely**: Review code while it's fresh -7. **Be Respectful**: Consider the author's perspective - -## Performance Considerations - -### Time Complexity -- Identify O(n²) operations that could be O(n log n) or O(n) -- Check nested loops -- Look for unnecessary repeated computations - -### Space Complexity -- Check for memory leaks -- Consider using generators instead of lists -- Release resources when done - -### Database Queries -- N+1 query problems -- Missing indexes -- Unnecessary joins -- Fetching too much data - -## Example Review Output - -```markdown -# Code Review: user_authentication.py - -## Summary -The code implements user authentication with JWT tokens. Overall, it's well-structured -but has some security concerns and opportunities for improvement. - -## Critical Issues - -**Issue**: Hardcoded secret key -**Location**: Line 15 -**Impact**: Security vulnerability - JWT secret should be in environment -**Suggestion**: Move to `os.environ.get('JWT_SECRET_KEY')` - -**Issue**: SQL injection vulnerability -**Location**: Line 42 -**Impact**: Attackers could execute arbitrary SQL -**Suggestion**: Use parameterized queries - -## Style and Convention Issues - -**Issue**: Missing type hints -**Location**: Functions throughout -**Suggestion**: Add type hints for better IDE support and documentation - -## Optimization Opportunities - -**Opportunity**: Repeated password hashing -**Location**: Line 58 -**Current**: Hashing password on every validation -**Suggested**: Cache hashed password or use constant-time comparison -**Impact**: Performance improvement for authentication - -## Positive Feedback -- Good error handling overall -- Clean function separation -- Good use of logging - -## Recommendations (Prioritized) -1. Fix security vulnerabilities immediately -2. Add comprehensive tests -3. Add type hints throughout -4. Consider using a password hashing library -5. Add rate limiting -``` - -## Resources - -- [PEP 8 - Style Guide](https://peps.python.org/pep-0008/) -- [Clean Code](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882) -- [Effective Java](https://www.amazon.com/Effective-Java-Joshua-Bloch/dp/0134685997) -- [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) diff --git a/skills/user/web-research/SKILL.md b/skills/user/web-research/SKILL.md deleted file mode 100644 index fd7b9b0f6..000000000 --- a/skills/user/web-research/SKILL.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -name: web-research -description: Structured approach to conducting thorough web research -version: 1.0.0 -author: DB-GPT Team -skill_type: research -tags: [web, research, analysis] -allowed-tools: web-search -license: MIT ---- - -# Web Research Skill - -## When to Use -- User asks you to research a topic -- You need to gather information from the web -- Research requires a structured approach -- User wants comprehensive information on a subject - -## Workflow - -### 1. Define Research Scope -- Clarify the research topic -- Identify key questions to answer -- Determine time period and geographic scope -- Note any constraints or preferences - -### 2. Search for Information -- Use web-search tools to find relevant sources -- Search for multiple keywords and phrases -- Include both popular and specialized sources -- Search across different domains (news, academic, blogs) - -### 3. Evaluate Sources -- Check source credibility and authority -- Identify potential biases -- Verify information across multiple sources -- Consider publication dates for currency - -### 4. Synthesize Findings -- Organize information by theme -- Identify common patterns and disagreements -- Highlight key insights and statistics -- Note gaps in available information - -### 5. Present Results -- Structure findings clearly -- Use headings and bullet points for readability -- Include sources and citations -- Provide summary and conclusions - -## Best Practices - -- Start with broad searches, then narrow down -- Cross-reference information from multiple sources -- Be transparent about uncertainty -- Cite sources when possible -- Use quotes for key information -- Organize findings logically - -## Example Output Structure - -```markdown -# Research: [Topic] - -## Overview -[Brief summary of findings] - -## Key Findings -- Finding 1 -- Finding 2 -- Finding 3 - -## Details -[Detailed information organized by theme] - -## Sources -- Source 1 -- Source 2 -``` - -## Tips for Deep Research - -- Use specific search terms for better results -- Try variations of keywords -- Look for both recent and foundational sources -- Check for opposing viewpoints -- Consider searching in different languages if relevant -- Look for official reports and studies - -## Common Mistakes to Avoid - -- Relying on a single source -- Ignoring source credibility -- Not verifying facts -- Overlooking recent developments -- Misrepresenting source information diff --git a/web/new-components/chat/content/ManusRightPanel.tsx b/web/new-components/chat/content/ManusRightPanel.tsx index f8fda51ef..9e0c0424f 100644 --- a/web/new-components/chat/content/ManusRightPanel.tsx +++ b/web/new-components/chat/content/ManusRightPanel.tsx @@ -514,6 +514,109 @@ const HtmlTabbedRenderer: React.FC<{ code?: ExecutionOutput; html: ExecutionOutp HtmlTabbedRenderer.displayName = 'HtmlTabbedRenderer'; +/** Tabbed code-execution renderer: shows images vs code+results as switchable tabs when images exist */ +const CodeExecutionRenderer: React.FC<{ + group: { codes: ExecutionOutput[]; results: ExecutionOutput[]; images: ExecutionOutput[] }; +}> = memo(({ group }) => { + const hasImages = group.images.length > 0; + const [activeTab, setActiveTab] = useState<'chart' | 'code'>(hasImages ? 'chart' : 'code'); + + const codeContent = ( + <> +
+ + 代码 + + String(c.content)).join('\n')} + language='python' + customStyle={{ background: '#0f172a', margin: 0, borderRadius: 0 }} + /> +
+ {group.results.length > 0 && ( + <> +
+
+ + 执行结果 + +
+ {group.results.map(r => String(r.content)).join('\n')} +
+
+ + )} + + ); + + const imageContent = ( +
+ {group.images.map((img, imgIdx) => ( +
+ Generated chart +
+ ))} +
+ ); + + // No images — just code + results, no tabs + if (!hasImages) { + return ( +
+ {codeContent} +
+ ); + } + + // Images exist — tabbed view + return ( +
+
+ + +
+ {activeTab === 'chart' ? imageContent : codeContent} +
+ ); +}); + +CodeExecutionRenderer.displayName = 'CodeExecutionRenderer'; + // Main Component const ManusRightPanel: React.FC = ({ activeStep, @@ -896,50 +999,7 @@ const ManusRightPanel: React.FC = ({
{outputGroups.map((group, gIdx) => group.type === 'code-execution' ? ( -
-
- - 代码 - - String(c.content)).join('\n')} - language='python' - customStyle={{ background: '#0f172a', margin: 0, borderRadius: 0 }} - /> -
- {group.results.length > 0 && ( - <> -
-
- - 执行结果 - -
- {group.results.map(r => String(r.content)).join('\n')} -
-
- - )} - {group.images.length > 0 && ( - <> -
-
- {group.images.map((img, imgIdx) => ( -
- Generated chart -
- ))} -
- - )} -
+ ) : group.type === 'html-tabbed' ? ( ) : ( diff --git a/web/pages/index.tsx b/web/pages/index.tsx index 2a833b126..3325f0e66 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -1781,7 +1781,7 @@ const Playground: NextPage = () => { {/* Top Header */}
- DB-GPT 0.6.0 Data Edition + DB-GPT
{messages.length > 0 && (