Spaces:
Sleeping
Sleeping
Kennedy Johnson Cursor commited on
Commit ·
d8217f8
1
Parent(s): 43eec29
Configure Docker and README for MuscleGrowthAI Hugging Face Space.
Browse filesPoint CONFIG_PATH at muscle_growth_config.yaml and update Space card metadata.
Co-authored-by: Cursor <cursoragent@cursor.com>
- Dockerfile +1 -3
- README.md +18 -478
Dockerfile
CHANGED
|
@@ -62,9 +62,7 @@ RUN --mount=type=cache,target=/home/user/.cache/pip,uid=1000,gid=1000 \
|
|
| 62 |
COPY --chown=user multi_llm_chatbot_backend/ ./
|
| 63 |
|
| 64 |
# ---- Top-level configuration files (config.yaml + persona definitions) ----
|
| 65 |
-
COPY --chown=user
|
| 66 |
-
COPY --chown=user phd_config.yaml ./phd_config.yaml
|
| 67 |
-
COPY --chown=user undergrad_config.yaml ./undergrad_config.yaml
|
| 68 |
COPY --chown=user personas/ ./personas/
|
| 69 |
|
| 70 |
# ---- Frontend bundle ------------------------------------------------------
|
|
|
|
| 62 |
COPY --chown=user multi_llm_chatbot_backend/ ./
|
| 63 |
|
| 64 |
# ---- Top-level configuration files (config.yaml + persona definitions) ----
|
| 65 |
+
COPY --chown=user muscle_growth_config.yaml ./muscle_growth_config.yaml
|
|
|
|
|
|
|
| 66 |
COPY --chown=user personas/ ./personas/
|
| 67 |
|
| 68 |
# ---- Frontend bundle ------------------------------------------------------
|
README.md
CHANGED
|
@@ -10,494 +10,34 @@ app_port: 7860
|
|
| 10 |
|
| 11 |
# MuscleGrowthAI
|
| 12 |
|
| 13 |
-
An AI-powered bodybuilding advisor panel that helps gym-goers build personalized
|
| 14 |
|
| 15 |
## Hugging Face Spaces deployment
|
| 16 |
|
| 17 |
-
This Space ships as a single Docker image built from the repository root [`Dockerfile`](Dockerfile). The container
|
| 18 |
|
| 19 |
-
1. Builds the React frontend
|
| 20 |
-
2. Serves the bundled SPA from FastAPI at `/`, with the API
|
| 21 |
-
3. Persists user data
|
| 22 |
|
| 23 |
### Required Space secrets
|
| 24 |
|
| 25 |
| Secret | Purpose |
|
| 26 |
|--------|---------|
|
| 27 |
-
| `JWT_SECRET_KEY` | Signs auth tokens. Set
|
| 28 |
-
| `GEMINI_API_KEY` | Powers the default Gemini provider (
|
| 29 |
-
| `OPENAI_API_KEY` | Optional — only required if you switch to the OpenAI provider. |
|
| 30 |
-
| `VLLM_API_KEY` | Optional — only required if you point the orchestrator/advisors at a Neon vLLM endpoint. |
|
| 31 |
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
##
|
| 35 |
-
|
| 36 |
-
- **Multiple AI Advisor Personas**: Chat with 10+ specialized advisors including Methodologist, Theorist, Pragmatist, and more
|
| 37 |
-
- **Document Upload & Analysis**: Upload PDFs, Word documents, and text files for context-aware advice
|
| 38 |
-
- **Intelligent Document Retrieval (RAG)**: Advanced semantic search through your uploaded documents
|
| 39 |
-
- **Multi-LLM Backend**: Supports both Gemini API and local Ollama models
|
| 40 |
-
- **User Authentication**: Secure user accounts with persistent chat sessions
|
| 41 |
-
- **Chat Session Management**: Save, load, and manage multiple conversation threads
|
| 42 |
-
- **Export Capabilities**: Export chats and summaries in TXT, PDF, and DOCX formats
|
| 43 |
-
- **Real-time Chat Interface**: Modern, responsive UI with advisor-specific styling
|
| 44 |
-
|
| 45 |
-
## Architecture
|
| 46 |
-
|
| 47 |
-
### Frontend (React)
|
| 48 |
-
- **Technology**: React 18 with modern hooks and functional components
|
| 49 |
-
- **Styling**: CSS custom properties with dark/light theme support
|
| 50 |
-
- **State Management**: React Context and hooks
|
| 51 |
-
- **Authentication**: JWT-based authentication with persistent sessions
|
| 52 |
-
|
| 53 |
-
### Backend (FastAPI)
|
| 54 |
-
- **Framework**: FastAPI with automatic API documentation
|
| 55 |
-
- **Database**: MongoDB for user data and chat sessions
|
| 56 |
-
- **Vector Database**: ChromaDB for document storage and semantic search
|
| 57 |
-
- **LLM Integration**: Support for Gemini API and Ollama models
|
| 58 |
-
- **Document Processing**: PDF, DOCX, and text file extraction with intelligent chunking
|
| 59 |
-
- **Authentication**: JWT tokens with bcrypt password hashing
|
| 60 |
-
|
| 61 |
-
## Quick Start (Docker)
|
| 62 |
-
### Prerequisites
|
| 63 |
-
- **Docker**
|
| 64 |
-
|
| 65 |
-
### Instructions
|
| 66 |
-
1. **Clone the repository**
|
| 67 |
-
```bash
|
| 68 |
-
git clone https://github.com/NeonGeckoCom/CCAI-Demo.git
|
| 69 |
-
cd CCAI-Demo
|
| 70 |
-
```
|
| 71 |
-
|
| 72 |
-
1. **Configure via `.env` file**
|
| 73 |
-
Create a `.env` file in the root of the project with:
|
| 74 |
-
```
|
| 75 |
-
GEMINI_API_KEY=<valid Gemini API key>
|
| 76 |
-
JWT_SECRET_KEY=<Generated UUID>
|
| 77 |
-
REACT_APP_API_URL=http://localhost:8000
|
| 78 |
-
CORS_ORIGINS=http://localhost:3000
|
| 79 |
-
```
|
| 80 |
-
> `REACT_APP_API_URL` and `CORS_ORIGINS` must match the real addresses used if accessing the demo from a remote host.
|
| 81 |
-
|
| 82 |
-
2. **Build and Run Containers**
|
| 83 |
-
```bash
|
| 84 |
-
docker compose up -d
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
3. **Access the application**
|
| 88 |
-
- Frontend: `http://localhost:3000`
|
| 89 |
-
- Backend API: `http://localhost:8000`
|
| 90 |
-
|
| 91 |
-
## Local Installation Prerequisites
|
| 92 |
-
- **Python 3.8+** (3.9+ recommended)
|
| 93 |
-
- **Node.js 16+** and npm
|
| 94 |
-
- **MongoDB** (Community Edition)
|
| 95 |
-
- **Git**
|
| 96 |
-
|
| 97 |
-
## Installation Guide
|
| 98 |
-
|
| 99 |
-
### Step 1: Clone the Repository
|
| 100 |
-
|
| 101 |
-
```bash
|
| 102 |
-
git clone https://github.com/NeonGeckoCom/CCAI-Demo.git
|
| 103 |
-
cd CCAI-Demo
|
| 104 |
-
```
|
| 105 |
-
|
| 106 |
-
### Step 2: MongoDB Setup
|
| 107 |
-
|
| 108 |
-
#### Option A: Local MongoDB Installation
|
| 109 |
-
|
| 110 |
-
**On Windows:**
|
| 111 |
-
1. Download MongoDB Community Server from [mongodb.com](https://www.mongodb.com/try/download/community)
|
| 112 |
-
2. Install with default settings
|
| 113 |
-
3. MongoDB will run as a Windows Service automatically
|
| 114 |
-
|
| 115 |
-
**On macOS:**
|
| 116 |
-
```bash
|
| 117 |
-
# Using Homebrew
|
| 118 |
-
brew tap mongodb/brew
|
| 119 |
-
brew install mongodb-community
|
| 120 |
-
brew services start mongodb/brew/mongodb-community
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
**On Linux (Ubuntu/Debian):**
|
| 124 |
-
```bash
|
| 125 |
-
# Import MongoDB public GPG key
|
| 126 |
-
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
|
| 127 |
-
|
| 128 |
-
# Create list file
|
| 129 |
-
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
| 130 |
-
|
| 131 |
-
# Install MongoDB
|
| 132 |
-
sudo apt-get update
|
| 133 |
-
sudo apt-get install -y mongodb-org
|
| 134 |
-
|
| 135 |
-
# Start MongoDB
|
| 136 |
-
sudo systemctl start mongod
|
| 137 |
-
sudo systemctl enable mongod
|
| 138 |
-
```
|
| 139 |
-
|
| 140 |
-
#### Option B: MongoDB Atlas (Cloud)
|
| 141 |
-
1. Create a free account at [MongoDB Atlas](https://www.mongodb.com/atlas)
|
| 142 |
-
2. Create a new cluster
|
| 143 |
-
3. Get your connection string
|
| 144 |
-
4. Skip the local MongoDB setup
|
| 145 |
-
|
| 146 |
-
### Step 3: Ollama Installation (for Local LLM Support)
|
| 147 |
-
|
| 148 |
-
#### Install Ollama
|
| 149 |
-
|
| 150 |
-
**On Windows:**
|
| 151 |
-
1. Download Ollama from [ollama.ai](https://ollama.ai)
|
| 152 |
-
2. Run the installer
|
| 153 |
-
3. Ollama will start automatically
|
| 154 |
-
|
| 155 |
-
**On macOS:**
|
| 156 |
-
```bash
|
| 157 |
-
# Using Homebrew
|
| 158 |
-
brew install ollama
|
| 159 |
-
|
| 160 |
-
# Or download from ollama.ai
|
| 161 |
-
```
|
| 162 |
-
|
| 163 |
-
**On Linux:**
|
| 164 |
-
```bash
|
| 165 |
-
# Install Ollama
|
| 166 |
-
curl -fsSL https://ollama.ai/install.sh | sh
|
| 167 |
-
|
| 168 |
-
# Start Ollama service
|
| 169 |
-
sudo systemctl start ollama
|
| 170 |
-
sudo systemctl enable ollama
|
| 171 |
-
```
|
| 172 |
-
|
| 173 |
-
#### Download Required Models
|
| 174 |
-
|
| 175 |
-
Once Ollama is installed, download the recommended models:
|
| 176 |
-
|
| 177 |
-
```bash
|
| 178 |
-
# Download the default model (recommended for development)
|
| 179 |
-
ollama pull llama3.2:1b
|
| 180 |
-
|
| 181 |
-
# Optional: Download larger, more capable models
|
| 182 |
-
ollama pull llama3.2:3b
|
| 183 |
-
ollama pull mistral:7b
|
| 184 |
-
|
| 185 |
-
# Verify installation
|
| 186 |
-
ollama list
|
| 187 |
-
```
|
| 188 |
-
|
| 189 |
-
**Note**: The `llama3.2:1b` model is small (~1.3GB) and fast, perfect for development. For production, consider larger models for better quality.
|
| 190 |
-
|
| 191 |
-
### Step 4: Backend Setup
|
| 192 |
-
|
| 193 |
-
1. **Navigate to the backend directory:**
|
| 194 |
-
```bash
|
| 195 |
-
cd multi_llm_chatbot_backend
|
| 196 |
-
```
|
| 197 |
-
|
| 198 |
-
2. **Create a Python virtual environment:**
|
| 199 |
-
```bash
|
| 200 |
-
# Create virtual environment
|
| 201 |
-
python -m venv venv
|
| 202 |
-
|
| 203 |
-
# Activate virtual environment
|
| 204 |
-
# On Windows:
|
| 205 |
-
venv\Scripts\activate
|
| 206 |
-
# On macOS/Linux:
|
| 207 |
-
source venv/bin/activate
|
| 208 |
-
```
|
| 209 |
-
|
| 210 |
-
3. **Install Python dependencies:**
|
| 211 |
-
```bash
|
| 212 |
-
pip install -r requirements.txt
|
| 213 |
-
```
|
| 214 |
-
|
| 215 |
-
4. **Set up environment variables:**
|
| 216 |
-
Create a `.env` file in the `multi_llm_chatbot_backend` directory:
|
| 217 |
-
|
| 218 |
-
```env
|
| 219 |
-
# MongoDB Configuration
|
| 220 |
-
MONGODB_CONNECTION_STRING=mongodb://localhost:27017
|
| 221 |
-
MONGODB_DATABASE_NAME=phd_advisor
|
| 222 |
-
|
| 223 |
-
# JWT Configuration
|
| 224 |
-
JWT_SECRET_KEY=your-super-secret-jwt-key-change-this-in-production-please-make-it-long-and-random
|
| 225 |
-
|
| 226 |
-
# Gemini API Configuration (Optional - for cloud LLM)
|
| 227 |
-
GEMINI_API_KEY=your_gemini_api_key_here
|
| 228 |
-
GEMINI_MODEL=gemini-2.0-flash
|
| 229 |
-
|
| 230 |
-
# Ollama Configuration (for local LLM)
|
| 231 |
-
OLLAMA_BASE_URL=http://localhost:11434
|
| 232 |
-
|
| 233 |
-
# Application Settings
|
| 234 |
-
CORS_ORIGINS=http://localhost:3000
|
| 235 |
-
```
|
| 236 |
-
|
| 237 |
-
**Getting a Gemini API Key (Optional):**
|
| 238 |
-
1. Go to [Google AI Studio](https://makersuite.google.com/app/apikey)
|
| 239 |
-
2. Create a new API key
|
| 240 |
-
3. Add it to your `.env` file
|
| 241 |
-
|
| 242 |
-
5. **Start the backend server:**
|
| 243 |
-
```bash
|
| 244 |
-
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
| 245 |
-
```
|
| 246 |
-
|
| 247 |
-
The API will be available at `http://localhost:8000` with interactive docs at `http://localhost:8000/docs`
|
| 248 |
-
|
| 249 |
-
### Step 5: Frontend Setup
|
| 250 |
-
|
| 251 |
-
1. **Navigate to the frontend directory:**
|
| 252 |
-
```bash
|
| 253 |
-
cd ../phd-advisor-frontend
|
| 254 |
-
```
|
| 255 |
-
|
| 256 |
-
2. **Install dependencies:**
|
| 257 |
-
```bash
|
| 258 |
-
npm install
|
| 259 |
-
```
|
| 260 |
-
|
| 261 |
-
3. **Start the development server:**
|
| 262 |
-
```bash
|
| 263 |
-
npm start
|
| 264 |
-
```
|
| 265 |
-
|
| 266 |
-
The application will open at `http://localhost:3000`
|
| 267 |
-
|
| 268 |
-
## Quick Start Guide
|
| 269 |
-
|
| 270 |
-
### First Time Setup Checklist
|
| 271 |
-
|
| 272 |
-
1. MongoDB is running (check with `mongosh` or MongoDB Compass)
|
| 273 |
-
2. Ollama is running with models downloaded (`ollama list`)
|
| 274 |
-
3. Backend is running on port 8000
|
| 275 |
-
4. Frontend is running on port 3000
|
| 276 |
-
5. Create your first user account
|
| 277 |
-
|
| 278 |
-
### Basic Usage
|
| 279 |
-
|
| 280 |
-
1. **Create an Account:**
|
| 281 |
-
- Open `http://localhost:3000`
|
| 282 |
-
- Click "Sign Up"
|
| 283 |
-
- Fill in your details
|
| 284 |
-
|
| 285 |
-
2. **Start Your First Chat:**
|
| 286 |
-
- Click "New Chat"
|
| 287 |
-
- Ask a question like "I need help with my research methodology"
|
| 288 |
-
- Get responses from multiple advisor personas
|
| 289 |
-
|
| 290 |
-
3. **Upload Documents:**
|
| 291 |
-
- Click the upload button in the chat
|
| 292 |
-
- Upload a PDF, DOCX, or TXT file
|
| 293 |
-
- Ask questions about your document
|
| 294 |
-
|
| 295 |
-
4. **Manage Chats:**
|
| 296 |
-
- Save important conversations
|
| 297 |
-
- Switch between different chat sessions
|
| 298 |
-
- Export chats in various formats
|
| 299 |
-
|
| 300 |
-
## 🔧 Configuration
|
| 301 |
-
|
| 302 |
-
### Environment Variables Reference
|
| 303 |
-
|
| 304 |
-
| Variable | Description | Default | Required |
|
| 305 |
-
|----------|-------------|---------|----------|
|
| 306 |
-
| `MONGODB_CONNECTION_STRING` | MongoDB connection URL | `mongodb://localhost:27017` | Yes |
|
| 307 |
-
| `MONGODB_DATABASE_NAME` | Database name | `phd_advisor` | Yes |
|
| 308 |
-
| `JWT_SECRET_KEY` | Secret key for JWT tokens | - | Yes |
|
| 309 |
-
| `GEMINI_API_KEY` | Google Gemini API key | - | No |
|
| 310 |
-
| `GEMINI_MODEL` | Gemini model to use | `gemini-2.0-flash` | No |
|
| 311 |
-
| `OLLAMA_BASE_URL` | Ollama server URL | `http://localhost:11434` | No |
|
| 312 |
-
|
| 313 |
-
### Switching Between LLM Providers
|
| 314 |
-
|
| 315 |
-
The application supports two LLM providers:
|
| 316 |
-
|
| 317 |
-
1. **Ollama (Local, Free):**
|
| 318 |
-
- Ensure Ollama is running
|
| 319 |
-
- Models run locally on your machine
|
| 320 |
-
- No API costs, complete privacy
|
| 321 |
-
|
| 322 |
-
2. **Gemini (Cloud, Paid):**
|
| 323 |
-
- Requires API key
|
| 324 |
-
- Higher quality responses
|
| 325 |
-
- Faster response times
|
| 326 |
-
|
| 327 |
-
Switch providers using the API:
|
| 328 |
-
```bash
|
| 329 |
-
curl -X POST "http://localhost:8000/switch-provider" \
|
| 330 |
-
-H "Content-Type: application/json" \
|
| 331 |
-
-d '{"provider": "ollama"}'
|
| 332 |
-
```
|
| 333 |
-
|
| 334 |
-
## API Documentation
|
| 335 |
-
|
| 336 |
-
### Authentication Endpoints
|
| 337 |
-
- `POST /auth/signup` - Create new user account
|
| 338 |
-
- `POST /auth/login` - Login with email/password
|
| 339 |
-
- `GET /auth/me` - Get current user profile
|
| 340 |
-
|
| 341 |
-
### Chat Endpoints
|
| 342 |
-
- `POST /chat-stream` - Get streaming responses from all advisors (NDJSON)
|
| 343 |
-
- `POST /chat/{persona_id}` - Chat with specific advisor
|
| 344 |
-
- `POST /reply-to-advisor` - Reply to specific advisor message
|
| 345 |
-
|
| 346 |
-
### Document Management
|
| 347 |
-
- `POST /upload-document` - Upload PDF, DOCX, or TXT files
|
| 348 |
-
- `GET /uploaded-files` - List uploaded files
|
| 349 |
-
- `GET /document-stats` - Get document statistics
|
| 350 |
-
|
| 351 |
-
### Session Management
|
| 352 |
-
- `GET /context` - Get current session context
|
| 353 |
-
- `POST /reset-session` - Reset current session
|
| 354 |
-
- `GET /session-stats` - Get session statistics
|
| 355 |
-
|
| 356 |
-
### Export & Summary
|
| 357 |
-
- `GET /export-chat` - Export chat (txt, pdf, docx)
|
| 358 |
-
- `GET /chat-summary` - Generate chat summary
|
| 359 |
-
|
| 360 |
-
Full API documentation is available at `http://localhost:8000/docs` when the server is running.
|
| 361 |
-
|
| 362 |
-
## Troubleshooting
|
| 363 |
-
|
| 364 |
-
### Common Issues
|
| 365 |
-
|
| 366 |
-
**Backend won't start:**
|
| 367 |
-
```bash
|
| 368 |
-
# Check if port 8000 is already in use
|
| 369 |
-
netstat -an | grep :8000
|
| 370 |
-
|
| 371 |
-
# Check Python virtual environment is activated
|
| 372 |
-
which python # Should point to your venv
|
| 373 |
-
|
| 374 |
-
# Check all dependencies are installed
|
| 375 |
-
pip list
|
| 376 |
-
```
|
| 377 |
-
|
| 378 |
-
**MongoDB connection issues:**
|
| 379 |
-
```bash
|
| 380 |
-
# Test MongoDB connection
|
| 381 |
-
mongosh
|
| 382 |
-
|
| 383 |
-
# Check if MongoDB service is running
|
| 384 |
-
# Windows: Check Services app
|
| 385 |
-
# macOS: brew services list | grep mongodb
|
| 386 |
-
# Linux: systemctl status mongod
|
| 387 |
-
```
|
| 388 |
-
|
| 389 |
-
**Ollama not working:**
|
| 390 |
-
```bash
|
| 391 |
-
# Check if Ollama is running
|
| 392 |
-
curl http://localhost:11434/api/tags
|
| 393 |
-
|
| 394 |
-
# Check downloaded models
|
| 395 |
-
ollama list
|
| 396 |
-
|
| 397 |
-
# Test model directly
|
| 398 |
-
ollama run llama3.2:1b "Hello"
|
| 399 |
-
```
|
| 400 |
-
|
| 401 |
-
**Frontend won't connect to backend:**
|
| 402 |
-
- Verify backend is running on port 8000
|
| 403 |
-
- Check CORS settings in backend `.env`
|
| 404 |
-
- Check browser developer console for errors
|
| 405 |
-
|
| 406 |
-
### Performance Tips
|
| 407 |
-
|
| 408 |
-
1. **For faster local LLM responses:**
|
| 409 |
-
- Use smaller models like `llama3.2:1b` for development
|
| 410 |
-
- Ensure sufficient RAM (8GB+ recommended)
|
| 411 |
-
- Use SSD storage for better model loading
|
| 412 |
-
|
| 413 |
-
2. **For better document search:**
|
| 414 |
-
- Upload focused, relevant documents
|
| 415 |
-
- Use clear, descriptive filenames
|
| 416 |
-
- Break large documents into smaller sections
|
| 417 |
-
|
| 418 |
-
3. **For production deployment:**
|
| 419 |
-
- Use larger, more capable models
|
| 420 |
-
- Consider GPU acceleration for Ollama
|
| 421 |
-
- Use MongoDB Atlas for cloud database
|
| 422 |
-
- Set up proper authentication and HTTPS
|
| 423 |
-
|
| 424 |
-
## Development
|
| 425 |
-
|
| 426 |
-
### Running Tests
|
| 427 |
-
|
| 428 |
-
```bash
|
| 429 |
-
# Backend tests
|
| 430 |
-
cd multi_llm_chatbot_backend
|
| 431 |
-
python -m pytest app/tests/
|
| 432 |
-
|
| 433 |
-
# Test specific functionality
|
| 434 |
-
python app/tests/test_rag_system.py
|
| 435 |
-
python app/tests/debug_rag.py
|
| 436 |
-
```
|
| 437 |
-
|
| 438 |
-
### Project Structure
|
| 439 |
-
|
| 440 |
-
```
|
| 441 |
-
phd-advisor-panel/
|
| 442 |
-
├── multi_llm_chatbot_backend/
|
| 443 |
-
│ ├── app/
|
| 444 |
-
│ │ ├── api/routes/ # API route handlers
|
| 445 |
-
│ │ ├── core/ # Core business logic
|
| 446 |
-
│ │ ├── llm/ # LLM client implementations
|
| 447 |
-
│ │ ├── models/ # Data models and schemas
|
| 448 |
-
│ │ ├── utils/ # Utility functions
|
| 449 |
-
│ │ └── tests/ # Test files
|
| 450 |
-
│ ├── requirements.txt
|
| 451 |
-
│ └── .env
|
| 452 |
-
├── phd-advisor-frontend/
|
| 453 |
-
│ ├── src/
|
| 454 |
-
│ │ ├── components/ # React components
|
| 455 |
-
│ │ ├── pages/ # Page components
|
| 456 |
-
│ │ ├── styles/ # CSS files
|
| 457 |
-
│ │ └── utils/ # Frontend utilities
|
| 458 |
-
│ ├── package.json
|
| 459 |
-
│ └── public/
|
| 460 |
-
└── README.md
|
| 461 |
-
```
|
| 462 |
-
|
| 463 |
-
### Adding New Advisor Personas
|
| 464 |
-
|
| 465 |
-
1. Edit `app/models/default_personas.py`
|
| 466 |
-
2. Add your persona configuration
|
| 467 |
-
3. Restart the backend server
|
| 468 |
-
4. The new persona will be available in chat
|
| 469 |
-
|
| 470 |
-
### Extending Document Support
|
| 471 |
-
|
| 472 |
-
1. Add new file type to `app/utils/document_extractor.py`
|
| 473 |
-
2. Update the upload endpoint in `app/api/routes/documents.py`
|
| 474 |
-
3. Test with sample files
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
## Contributing
|
| 478 |
-
|
| 479 |
-
1. Fork the repository
|
| 480 |
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
| 481 |
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
| 482 |
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
| 483 |
-
5. Open a Pull Request
|
| 484 |
-
|
| 485 |
-
## Support
|
| 486 |
-
|
| 487 |
-
- Check the [API Documentation](http://localhost:8000/docs)
|
| 488 |
-
- Report bugs by opening an issue
|
| 489 |
-
- Request features by opening an issue
|
| 490 |
-
- Contact the development team
|
| 491 |
-
|
| 492 |
-
## Acknowledgments
|
| 493 |
-
|
| 494 |
-
- Built with [FastAPI](https://fastapi.tiangolo.com/) and [React](https://reactjs.org/)
|
| 495 |
-
- Powered by [Ollama](https://ollama.ai/) for local LLM support
|
| 496 |
-
- Uses [ChromaDB](https://www.trychroma.com/) for vector storage
|
| 497 |
-
- Document processing with [PyPDF2](https://pypdf2.readthedocs.io/) and [python-docx](https://python-docx.readthedocs.io/)
|
| 498 |
-
|
| 499 |
-
## Copyright
|
| 500 |
-
|
| 501 |
-
© 2025 University of Colorado Boulder. All rights reserved.
|
| 502 |
|
| 503 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
# MuscleGrowthAI
|
| 12 |
|
| 13 |
+
An AI-powered bodybuilding advisor panel that helps gym-goers build personalized muscle-building plans. Get guidance on hypertrophy programming, nutrition, recovery, form, and progress tracking from five specialized fitness AI advisors. Built on Neon AI's Collaborative Conversational AI (CCAI) framework.
|
| 14 |
|
| 15 |
## Hugging Face Spaces deployment
|
| 16 |
|
| 17 |
+
This Space ships as a single Docker image built from the repository root [`Dockerfile`](Dockerfile). The container:
|
| 18 |
|
| 19 |
+
1. Builds the React frontend at image-build time with `REACT_APP_API_URL=""` so every `fetch` uses relative URLs.
|
| 20 |
+
2. Serves the bundled SPA from FastAPI at `/`, with the API on `/api/...`, `/auth/...`, etc., on the same `:7860` origin.
|
| 21 |
+
3. Persists user data in **SQLite via `aiosqlite`** at `${DATA_DIR}/`. Mount a Hugging Face Storage Bucket at `/data` to survive Space rebuilds.
|
| 22 |
|
| 23 |
### Required Space secrets
|
| 24 |
|
| 25 |
| Secret | Purpose |
|
| 26 |
|--------|---------|
|
| 27 |
+
| `JWT_SECRET_KEY` | Signs auth tokens. Set to a long random string. |
|
| 28 |
+
| `GEMINI_API_KEY` | Powers the default Gemini provider (`gemini-2.5-flash`). |
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
### Optional secrets
|
| 31 |
|
| 32 |
+
| Secret | Purpose |
|
| 33 |
+
|--------|---------|
|
| 34 |
+
| `OPENAI_API_KEY` | Only if switching to the OpenAI provider. |
|
| 35 |
+
| `VLLM_API_KEY` | Only if pointing at a Neon vLLM endpoint. |
|
| 36 |
|
| 37 |
+
## Advisors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
1. **Hypertrophy Coach** — splits, sets/reps, programming
|
| 40 |
+
2. **Nutrition Strategist** — protein, macros, fueling
|
| 41 |
+
3. **Recovery Specialist** — rest, mobility, post-workout care
|
| 42 |
+
4. **Form & Safety Coach** — technique, breathing, injury prevention
|
| 43 |
+
5. **Program Planner** — scheduling, tracking, progression
|