A responsive, animated AI chatbot powered by IBM Watson Assistant, built with Flask (Python), MongoDB, and a modern HTML/JS/CSS frontend.
- Natural conversation using IBM Watson Assistant through a web interface
- Chat history storage per session using MongoDB
- Animated background (Canvas stars effect)
- Responsive, modern UI
- One-click session reset (clear chat)
- Easy deployment via Flask
- Python (Flask) — backend API
- IBM Watson Assistant — AI-powered conversation
- MongoDB — message history per session
- HTML/CSS/JS — custom frontend interface and effects
- Python 3.7+
- Pip
- MongoDB Atlas or local MongoDB instance
- IBM Cloud account with Watson Assistant setup
- Clone the repository
git clone https://github.com/gitgyana/ginger.git
cd ginger- Create and activate a virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Create
credentials.pyAdd your API keys and MongoDB URL:
api_key = "YOUR_IBM_WATSON_API_KEY"
assistant_id = "YOUR_IBM_WATSON_ASSISTANT_ID"
assistant_url = "YOUR_WATSON_ASSISTANT_URL"
mongodb_url = "YOUR_MONGODB_CONNECTION_STRING"- Start MongoDB (if using local setup).
- Run the Flask app
python app.pyThe app by default runs on http://0.0.0.0:5000.
7. Visit in Browser
Open http://localhost:5000/ to interact with your chatbot.
- Type a message in the chatbox and hit Send or press
Enter. - Click the trash/reset icon to clear chat and start a new conversation session.
- Each new session is also recorded in MongoDB for history.
ginger-ai-chatbot/
│
├── app.py # Flask backend & IBM Watson API
├── credentials.py # Your secret credentials (not included here)
├── templates/
│ └── index.html # Main HTML page
├── static/
│ ├── script.js # Frontend JS (chat logic + canvas effect)
│ └── style.css # Main Stylesheet
├── requirements.txt # Python requirements
├── README.md
- Chatbot Tone & Model: Adjust logic in
app.pyand your Watson Assistant instance as needed. - UI: Edit
style.cssand HTML structure for theming or layout changes. - Effects: The starfield in
script.jscan be tweaked or replaced.
Q: "Oops! Something went wrong. ... IBM's enterprise servers..." appears. A: This appears when the backend Watson API fails or has expired. Double-check your API keys/limits and ensure your IBM Watson Assistant instance is active.
Q: How is MongoDB used? A: Each new Watson Assistant session gets its own collection in MongoDB, where user/assistant message pairs are stored.
- IBM Watson Assistant
- Flask
- MongoDB
- Poppins Font
- Starfield animation based on open web code snippets
Happy chatting! 🤖
Please remember to secure your API credentials! Never commit
credentials.pyor other secrets to public repositories.