| # AGENTS.md - Chatm2 Project Guidelines | |
| ## Build/Lint/Test Commands | |
| - **Run app**: `python app.py` or `flask run --host=0.0.0.0 --port=7860` | |
| - **Install dependencies**: `pip install -r requirements.txt` | |
| - **Docker build**: `docker build -t chatm2 .` | |
| - **Docker run**: `docker run -p 7860:7860 chatm2` | |
| ## Code Style Guidelines | |
| ### Python Standards | |
| - **Imports**: Standard library first, then third-party, then local imports. One import per line. | |
| - **Naming**: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants | |
| - **Types**: Use type hints for function parameters and return values when possible | |
| - **Error Handling**: Use try/except blocks with specific exceptions, log errors appropriately | |
| - **Docstrings**: Use triple quotes for function/class documentation in French (matching existing code) | |
| ### Flask/Web Standards | |
| - **Routes**: Use descriptive route names, handle both GET/POST appropriately | |
| - **JSON Responses**: Use `jsonify()` for API responses, include error handling | |
| - **File Uploads**: Validate file types and sizes, use secure_filename() | |
| - **Templates**: Use Jinja2 templating with Tailwind CSS classes | |
| ### Frontend/JavaScript | |
| - **Styling**: Use Tailwind CSS utility classes, maintain dark theme consistency | |
| - **Markdown**: Use marked.js for rendering, apply consistent styling | |
| - **Async**: Use modern async/await patterns for API calls | |
| ### Security | |
| - **Environment Variables**: Store sensitive data in .env files, never commit secrets | |
| - **File Handling**: Validate uploads, limit file sizes (currently 16MB max) | |
| - **API Keys**: Load from environment variables only | |
| ### Project Structure | |
| - Keep documentation in `documentation_gemini/` directory | |
| - Store templates in `templates/` directory | |
| - Use `SESSION_FILE_DIR/` for temporary file storage | |
| - Place system instructions in `instructions/` directory |