Peacebot-AI is an AI-powered mental health chatbot designed to provide empathetic conversations, stress management tips, and mindfulness guidance to users seeking emotional support.
It aims to create a safe, non-judgmental, and supportive environment through intelligent and compassionate AI-driven dialogue. πΈ
- π¬ Conversational support for stress, anxiety, and emotional wellness
- π§ Natural language responses powered by OpenAIβs GPT models
- π Personalized mindfulness & coping strategies
- π Privacy-first β no user data storage or profiling
- π Available anytime, anywhere, for daily motivation and reflection
- βοΈ Modular architecture for easy customization and expansion
| Component | Technology |
|---|---|
| Language | Python |
| Backend Framework | Flask |
| AI Integration | OpenAI GPT API |
| Frontend | HTML, CSS, JavaScript |
| Configuration Management | configparser, .env support |
| Logging | Python logging (JSON-structured logs) |
| Version Control | Git & GitHub |
peacebot-ai/
βββ src/
β βββ app.py # Flask entry point
β βββ peacebot.py # Core AI response logic
β βββ utils/
β β βββ config_loader.py # Handles .ini config and fallbacks
β β βββ logger_config.py # JSON-based structured logging
β β βββ retry_utils.py # Retry & exponential backoff logic
β β βββ init.py
β βββ static/
β β βββ index.html # Frontend chat interface
β β βββ js/
β β βββ script.js
β βββ init.py
β
βββ gratitude_log.json # Logs user gratitude entries
βββ peacebot.ini # Config file (API keys, retry, etc.)
βββ requirements.txt # Python dependencies
βββ .env # (Optional) API key storage
βββ README.md # Project documentation
βββ LICENSE # MIT Licensepython -m venv .venv
.venv\Scripts\Activate.ps1python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtOption 1 β Using Environment Variable
setx OPENAI_API_KEY "your_openai_key_here"Option 2 β Using .env File
Create a .env file in the project root:
OPENAI_API_KEY=your_openai_key_herepython src/app.pyVisit http://127.0.0.1:5000 in your browser. You can chat with Peacebot directly in the web interface.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/chat | Send a message to Peacebot and receive a response |
Example Request:
{
"message": "I'm feeling anxious today."
}Example Response:
{
"response": "I hear you. It sounds like you're having a tough day. Try a short breathing exercise β inhale deeply for 4 seconds..."
}Example peacebot.ini:
[openai]
api_key = your_openai_key_here
model = gpt-3.5-turbo
[retry]
max_retries = 3
base_delay = 2
[logging]
level = INFOPeacebot logs structured information for traceability:
{"time": "2025-11-08 14:42:01", "level": "INFO", "module": "peacebot", "message": "Response generated successfully"}
{"time": "2025-11-08 14:42:05", "level": "WARNING", "module": "peacebot.retry", "message": "Retry 1/3 for OpenAI request"}- π§© Integrate emotion detection using NLP
- π Add mood visualization dashboard
- ποΈ Implement daily mental wellness check-ins
- π Optional user authentication for personal sessions
- πΎ Support cloud-based session storage
- π§ Add local LLM fallback (offline mode)
We welcome all contributions!
Please read the CONTRIBUTING.md file before submitting pull requests.
To suggest new ideas or report bugs:
Open an issue in the Issues tab with descriptive titles and clear acceptance criteria
Example Issue Ideas
| ID | Issue Title | Summary |
|---|---|---|
| #2 | Add Config System | Introduce configparser-based modular configuration |
| #3 | Retry & Failure Handling | Add exponential backoff for API resilience |
| #4 | Add Emotion Classification | Use sentiment analysis to tailor responses |
| #5 | Web Dashboard | Visualize user moods and gratitude logs |
- β Star the repository to show your support.
- π΄ Fork the repo and create a new branch for your feature, fix, or idea.
- π» Make your changes β code, design, documentation, anything that improves the project!
- β Commit your updates with a meaningful message.
- π Create a Pull Request β our team will review, suggest, and merge if all looks great.
- πΌοΈ Add screenshots or demo links if applicable.
For more detailed steps, see the CONTRIBUTING.md file.
We welcome all contributions and ideas β whether it's:
- A new feature β¨
- UI/UX improvements π¨
- Bug fixes π
- or Documentation updates π
Your voice matters!
Feel free to open issues, start discussions, or reach out with feedback π¬
Thanks to these wonderful people for contributing to PeaceBot-AI π
Peacebot now includes a robust test suite for its core backend utilities and tracing middleware.
From your project root:
pytest -v
For example, to only test the retry utility:
pytest tests/test_retry_utils.py -v
===================== test session starts =====================
collected 9 items
tests/test_request_id_context.py .... [ 25%]
tests/test_logger_config.py .... [ 50%]
tests/test_retry_utils.py .... [ 75%]
tests/test_decorators.py .... [100%]
====================== 9 passed in 1.52s ======================
This project is licensed under the MIT License.
See the LICENSE file for details.
π§ββοΈ PeaceBot-AI β Because everyone deserves a moment of peace.
βThe greatest weapon against stress is our ability to choose one thought over another.β β William James
β If you find this project helpful, consider giving it a star on GitHub!
