A sleek, dark-themed AI chat application built with Streamlit. This app mimics a modern chat interface, integrates with the OpenRouter API (specifically the openai/gpt-oss-120b model), and offers robust local chat management with conversation summarization capabilities.
-
Dark Mode UI: A custom-styled, dark-themed interface inspired by modern chat apps.
-
OpenRouter Integration: Powered by the
openai/gpt-oss-120bmodel via OpenRouter. -
Persistent Chat History: Automatically saves all conversations to local JSON files.
-
Chat Management:
-
Create new chats.
-
Switch between historical chats instantly.
-
Delete individual chats.
-
Clear current chat history.
-
Smart Summarization: Includes an expander to generate and view a 3-4 bullet point summary of the current conversation using the AI model.
Before you begin, ensure you have the following installed on your machine:
- Python 3.8 or higher: Download Python
- A Code Editor: VS Code is recommended.
- OpenRouter API Key: Get your key from openrouter.ai.
Follow these steps to get the app running locally.
(If you haven't already, download this code to a folder)
git clone <your-repo-url>
cd <your-project-folder>
It is best practice to run Python apps in a virtual environment to avoid conflicts.
Windows:
python -m venv venv
.\venv\Scripts\activate
Mac/Linux:
python3 -m venv venv
source venv/bin/activate
Install the required Python libraries (Streamlit and OpenAI).
pip install streamlit openai
You must configure your API key for the app to work. Streamlit uses a secure secrets management system.
- In your project root directory, create a folder named
.streamlit. - Inside that folder, create a file named
secrets.toml. - Add your API key to the file:
File Path: .streamlit/secrets.toml
OPENROUTER_API_KEY = "sk-or-your-actual-api-key-here"
Once installed and configured, run the application with the following command:
streamlit run app.py
The application will automatically open in your default web browser at http://localhost:8501.
my_chatbot/
├── .streamlit/
│ └── secrets.toml # Your API Key (Do not share this file!)
├── chats/ # Automatically created folder for chat history JSONs
├── app.py # Main application code
└── README.md # This documentation
- Start a Chat: Type your question in the input bar at the bottom.
- New Conversation: Click "+ New Chat" in the sidebar to start fresh.
- Summarize: Click the "📝 Conversation Summary" expander at the top and hit the "Generate" button to get a quick recap of your discussion.
- Manage History: Select old chats from the sidebar list or click the Trash Icon (🗑️) to delete them permanently.
Built with Streamlit.