Fixed double .data access in template preview:
- Changed response.data.data.rendered_html
- To response.data.rendered_html
templateService already returns response.data, no need to access .data twice.
- Auto-save settings before testing connection
- Make model list clickable for easy selection
- Models auto-populate when clicked
- Better user experience for Ollama configuration
Now users can click on a model from the list to select it instantly.
✨ New Features:
- 🤖 AI-powered mail template generation with Ollama
- 📧 Test mail sending with preview
- 🔧 Ollama server and model management
- 🎨 Beautiful AI generation dialog in Templates page
- ⚙️ Ollama settings panel with connection test
Backend:
- Add ollama.service.js - Ollama API integration
- Add ollama.controller.js - Template generation endpoint
- Add ollama.routes.js - /api/ollama/* routes
- Support for multiple Ollama models (llama3.2, mistral, gemma)
- JSON-formatted AI responses with subject + HTML body
- Configurable server URL and model selection
Frontend:
- Settings: Ollama configuration panel
- Server URL input
- Model selection
- Connection test with model listing
- Templates: AI generation dialog
- Company name, scenario, employee info inputs
- Custom prompt for AI instructions
- Auto-save to database
- Test mail sending functionality
Documentation:
- OLLAMA_SETUP.md - Comprehensive setup guide
- Installation instructions
- Model recommendations
- Usage examples
- Troubleshooting
Tech Stack:
- Ollama API integration (REST)
- Axios HTTP client
- React dialogs with MUI
- Self-hosted AI (privacy-friendly)
- Zero external API dependencies
Example Usage:
Company: Garanti Bankası
Scenario: Account security warning
→ AI generates professional phishing test mail in seconds!
- Fixed handleSave to use separate /gmail and /telegram endpoints
- Changed /test-mail to /test-gmail endpoint
- Added proper null checks in loadSettings to prevent uncontrolled input warnings
- Settings now properly saved to backend with correct endpoint structure
- Updated templateService to return response.data like other services
- Added fallback to empty array in Templates.jsx to prevent map errors
- Ensures consistency across all service modules
- Fixed AuthContext to properly set user to null on auth check failure
- Added loading spinner in PrivateRoute instead of returning null
- Removed automatic redirect from API interceptor (let React Router handle it)
- Improved error handling in checkAuth to prevent stuck loading state
- Added full CRUD endpoints for mail templates (create, update, delete, preview)
- Introduced Joi validators for template create/update/preview
- Updated routes/controller to support ID and type lookups
- Built React Templates page with HTML editor, preview, and clipboard helpers
- Added navigation entry and route for /templates
- Enhanced documentation (README, QUICKSTART, KULLANIM, frontend/backend README)
- Created CompanyDetail page with stats, info, and tokens list
- Created TokenDetail page with click history and full tracking info
- Added routes for /companies/:id and /tokens/:id
- Made table rows clickable to navigate to detail pages
- Added edit, delete, and mail resend functionality
- Shows IP addresses, GeoIP location, device and browser info in click logs
- Fixed dotenv path in app.js to properly load .env from backend root
- Updated CORS to allow http://localhost:5173 (frontend URL)
- Updated README.md with accurate project statistics (58 files, 6677+ lines)
- Updated backend/README.md - marked as Production Ready
- Updated frontend/README.md with complete feature list
- All systems tested and working (backend + frontend)