6 Commits

Author SHA1 Message Date
e3debb3f71 feat: Enhanced Mode v2 with Smart Adaptive strategy, section-based editing, and comprehensive logging
## Enhanced Mode v2 - Smart Section-Based Editing (routes/ai.js)

  ### Server-Side Section Replacement Architecture
  - Add cleanMarkdownFromTitle() to normalize section titles for matching
  - Add extractHeaders() to list all document sections for debugging
  - Add replaceSection() to surgically replace only modified sections
  - AI now returns ONLY the modified section, not entire document
  - Server automatically replaces section in original document
  - Automatic header level correction if AI changes ## to ### or vice versa
  - Section boundary detection based on header hierarchy

  ### Enhanced Prompt and Response Format
  - Modified prompt to explicitly request ONLY modified section
  - New closing format: document (mandatory)
  - Added fallback regex for old format with warnings
  - Explicit rules: keep exact header level (## stays ##)
  - Clear section boundary definition in prompt
  - Examples with proper formatting guidelines

  ### Comprehensive Logging System
  - Log all API requests with method, endpoint, payload size
  - Log AI responses with length and preview
  - Log section matching and replacement operations
  - Log header level corrections
  - Log section not found errors with available sections list
  - Track modified sections across iterations

  ## AI Button Mutex and Preview Mode Controls (assets/js/app.js)

  ### AI Button Mutex (Prevent API Overload)
  - Add disableAIButtons() to disable all AI buttons during operations
  - Add enableAIButtons() to re-enable after completion or error
  - Disable all AI buttons at start of any AI operation
  - Re-enable in finally blocks to ensure cleanup even on errors
  - Re-enable on validation failures (e.g., no text selected for rephrase)
  - Re-enable when user clicks Apply/Cancel in rephrase mode

  ### Preview Mode Button Restrictions
  - Disable Preview button during Enhanced Mode operation
  - Disable all AI buttons in preview mode (rephrase, inconsistencies, duplications, advice, liberty)
  - Disable Save and Load buttons in preview mode
  - Re-enable all buttons when returning to edit mode
  - Proper cleanup with finally blocks

  ## Mermaid Auto-Fix System - Complete Removal

  ### Removed from assets/js/app.js
  - Remove mermaidFixAttempts Set from constructor
  - Remove setupMessageListener() and postMessage handler
  - Remove fixMermaidDiagramBackground() function
  - Simplify Mermaid error display to inline messages only
  - Remove hash-based tracking mechanism

  ### Removed from routes/index.js (Present Mode)
  - Remove entire auto-fix fetch and retry logic
  - Remove status div updates and fix notifications
  - Remove postMessage to parent window
  - Simplify to display styled error message only

  ### Current Behavior
  - Preview mode: Shows inline error with simple message
  - Present mode: Shows styled error box with instructions
  - No automatic fix attempts - manual correction only

  ## Additional Improvements
  - Clean markdown formatting (##, **, etc.) from section titles in UI badges
  - Proper section title matching ignoring markdown syntax
  - Enhanced error handling with detailed logging
  - Better user feedback during Enhanced Mode iterations

  This release improves Enhanced Mode reliability, prevents API overload through button mutex,
  simplifies Mermaid error handling, and adds comprehensive logging for debugging.
2025-10-15 14:22:40 +02:00
86eb68c0e6 feat: Enhanced mode v2 with Smart Adaptive strategy, comprehensive logging, and internationalization
Major Features:
  - Enhanced Mode v2: Smart Adaptive section selection strategy
    * AI automatically selects ONE optimal section per iteration
    * Intelligent selection based on quality assessment and strategic importance
    * Section tracking to avoid duplicate modifications
    * Fixed header level preservation (## stays ##, ### stays ###)
    * Updated document code block format (document)

  - Mermaid Auto-Fix System
    * New POST /api/ai/fix-mermaid endpoint for automatic diagram correction
    * Automatic error detection in preview and presentation modes
    * Inter-window communication for seamless editor updates
    * AI-powered syntax error resolution

  - Comprehensive Logging System
    * Centralized logger utility (utils/logger.js)
    * API request/response middleware logging
    * AI operations: rephrase, check-inconsistencies, check-duplications, give-advice, liberty-mode, fix-mermaid
    * Storage operations: create, read, update, delete journals
    * Export operations: PDF and Web ZIP generation
    * Structured logging with timestamps, levels, categories, and metadata

  Improvements:
  - Table of Contents: Clean display with markdown formatting stripped from titles
  - Section badges: Fixed visibility with hardcoded blue background (#2563eb)
  - Internationalization: Complete English translation (lang, UI text, placeholders, comments)
  - Code cleanup: Removed all emojis from codebase

  Technical Changes:
  - routes/ai.js: Enhanced mode implementation, Mermaid fix endpoint, comprehensive logging
  - routes/api.js: Storage operation logging
  - routes/export.js: Export operation logging
  - routes/index.js: Presentation mode Mermaid auto-fix
  - assets/js/app.js: TOC markdown stripping, Mermaid error handling, message listeners
  - assets/css/style.css: Dark mode comment, English placeholders, header icon
  - views/page.js: English lang attribute, favicon, scroll-to-top button
  - views/header.js: Theme toggle icon
  - utils/logger.js: New centralized logging system
  - app.js: API request/response logging middleware
2025-10-15 10:21:54 +02:00
21f165afb0 enchace app 2025-10-14 17:05:19 +02:00
aa0a3863b6 Refactor: Complete internationalization and modernization to v2.0.0
Major Changes:
  - Remove all emojis from UI, code, and documentation for professional appearance
  - Translate entire codebase from French to English (code, comments, strings, UI)
  - Simplify template system: 18 templates → single default template
  - Rename "Mode Liberté Total" to "Enhanced Mode" throughout
  - Add comprehensive English README with installation and usage guides
  - Add MIT License (open source, no attribution required)
  - Update package.json with proper metadata and keywords

  Breaking Changes:
  - Template API endpoint changed from /api/templates/:domain/:level to /api/templates/default
  - All French UI text and notifications replaced with English
  - Template directory structure simplified

  Technical Improvements:
  - Cleaner, more maintainable codebase
  - Improved internationalization
  - Better developer experience with English documentation
  - Professional appearance suitable for production use
2025-10-14 15:05:39 +02:00
Augustin
4a8b6d1cf8 Amélioration complète de l'application web Journal de Conception
- Refonte complète du design avec système de panneaux latéraux rétractables
- Ajout de templates de projets par domaine (recherche, informatique, mathématiques, etc.)
- Implémentation système d'export PDF avec Puppeteer
- Amélioration de l'API REST avec nouvelles routes d'export et templates
- Ajout de JavaScript client pour interactions dynamiques
- Configuration environnement étendue pour futures fonctionnalités IA
- Amélioration responsive design et expérience utilisateur

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-25 12:09:49 +02:00
Augustin
750e2c4fe8 Add conception-assistant web application with journal management
- Express server with routes for index and API endpoints
- CRUD operations for markdown journals via REST API
- Modular view components (header, main, footer, page)
- UUID-based file management system for journals
- Content-editable journal editor with AI assistant features
- Package.json with express and uuid dependencies
- Basic project structure with assets, config, tests, views directories

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 16:17:28 +02:00