A modern AI-powered chat interface built with Flet UI, integrated with Ollama LLMs and enhanced by LangChain. This project demonstrates a complete conversational AI agent with interactive animations, context-aware prompting, and real-time user interaction — all running locally.
---- Features
- Project Structure
- Installation
- Usage Guide
- Built With
- License
- Contributing
- Acknowledgements
- Future Enhancements
- Contact
- Responsive and modern UI built with Flet
- Smooth animations (fade, slide, scale)
- Collapsible side navigation with toggle
- Chat interface using bubble-style messages
- User and AI avatars for a clean experience
- Built-in Ollama LLM (
qwen2.5-coder:1.5b) - Intelligent prompt formatting using LangChain
- In-memory caching for improved response time
- Response formatting criteria:
- Accurate and complete information
- Context-aware and easy to understand
- Grammatically correct and natural phrasing
- Real-time message updates and streaming
- Typing/loading animation for AI responses
- Send message via Enter key or Send button
- Input box with emoji icon and placeholder
- Auto-scroll to latest message on update
- Modular, component-based project structure
- Clear separation of UI, AI logic, and state management
- Uses modern design patterns
- Fully commented and formatted codebase
├── core/
│ ├── animations/ # Animation helpers
│ ├── widegets/ # Reusable UI elements
│ ├── model_llm/ # LLM integration and prompt templates
│ ├── providers/ # State and screen management
│ └── interface/ # Main screens and layout views
└── LICENSE
└── README.md # Project documentation file.
└── demo.png
└── requirements-chatbot # Python dependences
└── main_app.py
└── struc.txt
- Prerequisites:
- Python 3.8+
- Clone the repository:
git clone https://github.com/paht2005/mini-AI-Agent-Chatbot-with-Flet.git
cd mini-AI-Agent-Chatboit-with-Flet- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate- Install required packages:
pip install -r requirements-chatbot.txt- Run the app:
python main_app.py # or python3 main_app.py
- Type your question in the text box at the bottom of the screen.
- Press Enter or click the Send button.
- Wait for a response (AI typing animation shown).
- Use the side menu to toggle navigation panel.
- Flet – Python UI framework based on Flutter
- LangChain – Prompt engineering and LLM orchestration
- Ollama – Lightweight, local LLM deployment
This project is licensed under the MIT License. See the LICENSE file for details.
I welcome contributions to improve this project! Feel free to:
- Submit pull requests
- Report bugs
- Suggest new features
- Support for switching between multiple LLMs (e.g., Mistral, LLaMA)
- Add memory and context window for longer conversations
- Export chat history as PDF or Markdown
- Add user authentication for personalized AI agents
- Light/Dark theme toggle
Contact for work: Nguyễn Công Phát – [email protected]
