Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR upgrades the existing Chat Application into a secure, scalable AI-Powered Todo Chatbot by refactoring the core architecture, fixing security flaws, and adding major new features including task management and AI chat support.
🔧 Architecture Refactor (Security & Stability)
❌ Previous Issues
Client connected directly to MySQL, exposing DB credentials.
Required a local database installation on every client machine.
Tight coupling between UI and persistence logic.
✅ Improvements
Implemented a Thin Client / Server-centric architecture.
Moved all database logic to the server via db_manager.py.
Replaced MySQL with SQLite (chatbot.db) for zero-config portability.
Added a secure AUTH handshake protocol between Client and Server.
This significantly improves security, deployment simplicity, and maintainability.
✨ New Features
📝 Todo List Management
Added a dedicated Todo List tab in the GUI.
Users can:
Add tasks
List tasks
Mark tasks as completed
Tasks are persisted server-side and survive restarts.
🤖 AI Chat Integration
Added an AI Bot users can chat with.
Introduced AIHandler abstraction for LLM routing.
Ready for Gemini / OpenAI API keys via environment variables.
Falls back to Echo Mode when no API key is provided.
🧹 Code Quality & Testing
Refactored Server.py to cleanly handle multiple command types.
Simplified and stabilized threading logic in Client.py.
Added verification and regression tests:
test_architecture.py – Auth & client/server separation
test_todos.py – Todo CRUD logic
test_ai.py – AI bot response handling
Added .env.example and improved .gitignore.
✅ Verification Checklist
Server runs without external dependencies
Client authenticates using server-side auth
Todos persist across restarts
AI Bot responds correctly