opencompletion.com/templates
Russell Ballestrini 6400a5eacb Add automatic code error fixing feature
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
2025-11-30 11:59:46 -05:00
..
auth.html Redesign user interface across all pages (#42) 2025-11-12 09:24:49 -05:00
base.html Fix light mode flash on chat page 2025-11-30 10:23:53 -05:00
browse.html Fix theme flash and add logout to profile page 2025-11-30 10:00:48 -05:00
chat.html Add automatic code error fixing feature 2025-11-30 11:59:46 -05:00
index.html Redesign user interface across all pages (#42) 2025-11-12 09:24:49 -05:00
profile.html Fix theme flash and add logout to profile page 2025-11-30 10:00:48 -05:00
search.html Redesign user interface across all pages (#42) 2025-11-12 09:24:49 -05:00