Chat MD is an intelligent backend service designed to automate and standardize content creation for the All Star Union community.
It leverages Google Gemini (Generative AI) to transform raw, unstructured notes into professionally formatted Markdown for:
- Public Session Recaps (Web-ready, engaging summaries).
- Internal Task Assignments (Actionable, clear checklists).
- Dual-Persona AI: Automatically switches between an "Energetic Editor" tone for public content and a "Direct Project Lead" tone for internal tasks.
- Multilingual Normalization: Instantly translates Arabic and Franco-Arab input into professional English.
- Smart Formatting:
- Detects image URLs and renders them as banners.
- Converts raw links into descriptive hyperlinks.
- Strips transient logistics (dates/rooms) to keep content evergreen.
- Brand Consistency: Enforces the "All Star" voice and signature ("Reach for the stars! 🌟").
- Framework: Django & Django REST Framework (DRF)
- AI Model: Google Gemini Pro
- Language: Python 3.10+
- Format: JSON / Markdown
Follow these steps to run the project locally.
git clone [https://github.com/YOUR_USERNAME/chat-md.git](https://github.com/YOUR_USERNAME/chat-md.git)
cd chat-md# Windows
python -m venv venv
.\venv\Scripts\activate
# Mac/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThis project requires sensitive API keys. We have provided a template file.
-
Copy
.env.exampleto a new file named.env:cp .env.example .env # Or manually rename the file -
Open
.envand fill in your keys:# .env DEBUG=True DJANGO_SECRET_KEY=your_django_secret_key_here GOOGLE_API_KEY=AIzaSy_YOUR_GEMINI_API_KEY_here
python manage.py migrate
python manage.py runserverThe API will be available at: http://127.0.0.1:8000/
Generates a high-energy, public-facing summary for the website.
- Endpoint:
POST /api/format-description/(Check your specific URL config) - Content-Type:
application/json
Request:
{
"text": "We had a workshop about Flutter. Covered Widgets and State. Here is the banner: [https://example.com/flutter.png](https://example.com/flutter.png)"
}Response:
{
"markdown": "## Flutter Workshop: Building Interactive UIs\n\n\n\nIn this session, we dove deep into..."
}Generates an internal, actionable task checklist.
- Endpoint:
POST /api/format-task/ - Content-Type:
application/json
Request:
{
"text": "Fix the login button. It needs to be blue #0055FF and 50px height."
}Response:
{
"markdown": "## Task: Refactor Login Component\n\n### 📋 Requirements\n- [ ] Update button color to **#0055FF**.\n- [ ] Set height to **50px**."
}The system follows a Service-Oriented Architecture using Django REST Framework:
- View Layer: Receives the POST request and validates data using Serializers.
- Service Layer:
PromptService: Selects the correct "Persona" (Editor vs. Manager) and builds the system prompt.AIService: Handles the communication with Google Gemini API.
- Response: Returns a raw JSON payload containing the Markdown string.
- Secrets: All API keys are managed via
.env. Never commit your.envfile. - Validation: Input is sanitized to prevent prompt injection or empty requests.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request