Implements an AI-powered auto-fix system that automatically attempts to repair code execution errors up to 3 times. Backend changes (app.py): - Add /api/fix-code endpoint that uses MODEL_1 (Hermes) to analyze stderr output and generate corrected code - System prompt instructs AI to output only raw fixed code without explanations or markdown formatting - Accepts code, language, stderr, exit_code, and attempt number Frontend changes (templates/chat.html): - Modify executeCodeBlock() to detect failed executions (exit_code !== 0) - Track fix attempts per code block (max 3) using dataset attributes - Call /api/fix-code when errors are detected - Display fixed code as new chat message with markdown formatting - Automatically re-execute the corrected code recursively - Show progress messages during auto-fix attempts - Display warning when max attempts (3) are exhausted Features: - Fixes common issues: missing imports, syntax errors, type errors - Posts fixed code to chat for transparency - Prevents infinite loops with 3-attempt limit - Graceful error handling with user-friendly status messages |
||
|---|---|---|
| .. | ||
| auth.html | ||
| base.html | ||
| browse.html | ||
| chat.html | ||
| index.html | ||
| profile.html | ||
| search.html | ||