A multi-session chatbot web application built with Python. I created this project based on Nicegui chatbot implementation as a prototype to have the following technologies working together:
- NiceGUI for a responsive, interactive web UI
- LangChain and langchain_openai for LLM integration (OpenAI GPT-4o)
- Persistent chat history and multi-chat session management
- AI-generated chat titles for each conversation
- Markdown-formatted answers (supports code, links, etc.)
This chatbot is good for study, learning, and experimenting with conversational AI and prompt engineering.
- Simple chat interface with NiceGUI
- Multi-chat support: switch between previous conversations
- Persistent chat history (saved to disk)
- AI-generated short titles for each chat
- Markdown rendering for both user and AI messages
- Secure API key loading from
.env - Modular, maintainable codebase
- Clone this repository.
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile in the project root with your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here
- Run the app:
python main.py
- Start a new chat or select a previous chat from the sidebar.
- Type your message and press Enter.
- The conversation is saved automatically, and you can return to any previous chat.
- Each chat is given a short, AI-generated title for easy identification.
- All messages support markdown formatting.
main.py— Entry point, sets up the NiceGUI page and launches the appchat_app.py— Contains theChatAppclass with all UI and logicchat_storage.py— Handles persistent chat storage and retrieval.env— Your OpenAI API key (not included in git)
Being honest, the docstrings in this project were generated with a little help from AI. 😄
MIT