Skip to content

Latest commit

 

History

History
311 lines (221 loc) · 6.92 KB

File metadata and controls

311 lines (221 loc) · 6.92 KB

Getting Started with LaunchAgencyBot Web UI

📋 Document Summary

What This Document Covers:

  • Quick start guide for setting up and running LaunchAgencyBot Web UI
  • Environment variable configuration (AI services, Firebase, LLM observability)
  • Installation steps and dependency verification
  • Server startup in development and production modes
  • Authentication setup recommendations
  • Common troubleshooting and issue resolution

Sections in This Document:

Related Documentation:

Context Tags: #getting-started #setup #installation #web-ui #configuration #quickstart


Overview

Quick start guide for setting up and running the LaunchAgencyBot Web UI API server.

Related Documentation:


Technology Stack

Component Technology Purpose
Framework FastAPI 0.100+ Async HTTP API server
Runtime asyncio with uvicorn ASGI server
Validation Pydantic v2 Request/response schemas
Vector DB ChromaDB RAG embeddings and search
Persistence Firebase User data and configurations
File Storage Local Filesystem Media files and metadata
Blockchain Solana Web3.py pump.fun integration

Environment Setup

Required Environment Variables

# AI Services (Required)
REPLICATE_API_KEY=your_replicate_token    # CLIP embeddings
OPENAI_API_KEY=your_openai_key            # LLM services (GPT-4)

# LLM Observability (Optional)
LANGFUSE_SECRET_KEY=your_langfuse_key     # LLM call tracking
LANGFUSE_PUBLIC_KEY=your_langfuse_pub     # Dashboard access

# Firebase (Optional - required for persistence features)
FIREBASE_CREDENTIALS=path/to/creds.json   # Firebase service account

Environment File

Create .env in project root:

# .env
REPLICATE_API_KEY=r8_xxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxx
LANGFUSE_SECRET_KEY=sk-lf-xxxxxxxxxxxxxxx
LANGFUSE_PUBLIC_KEY=pk-lf-xxxxxxxxxxxxxxx
FIREBASE_CREDENTIALS=./firebase-credentials.json

Installation

1. Install Dependencies

# Using pip
pip install -r requirements.txt

# Using poetry
poetry install

2. Verify Installation

# Check Python version (3.10+ required)
python --version

# Verify FastAPI installation
python -c "import fastapi; print(fastapi.__version__)"

# Verify ChromaDB installation
python -c "import chromadb; print(chromadb.__version__)"

Running the Server

Development Mode

# Start with auto-reload (recommended for development)
PYTHONPATH=. uvicorn src.web_ui.main:app --port 8000 --host 127.0.0.1 --reload

# The server will be available at:
# http://127.0.0.1:8000

# Interactive API docs at:
# http://127.0.0.1:8000/docs

Production Mode

# Start with multiple workers
PYTHONPATH=. uvicorn src.web_ui.main:app \
  --port 8000 \
  --host 0.0.0.0 \
  --workers 4 \
  --log-level info

# Recommended production setup:
# - Use reverse proxy (nginx/caddy)
# - Enable HTTPS
# - Set up authentication
# - Configure rate limiting

Server Configuration

Base URL Configuration

Environment URL Use Case
Development http://127.0.0.1:8000 Local testing
Staging http://your-staging-ip:8000 Pre-production
Production https://api.yourdomain.com Live deployment

Port Configuration

Default port: 8000

Change port via command line:

uvicorn src.web_ui.main:app --port 3000

Or via environment variable:

PORT=3000 uvicorn src.web_ui.main:app

Authentication Setup

Current Status

Development Mode: No authentication required

Production Recommendations

  1. JWT-Based Authentication

    # Add to src/web_ui/auth.py
    from fastapi.security import HTTPBearer
    from jose import jwt
    
    security = HTTPBearer()
  2. API Key Validation

    • Service-to-service authentication
    • Rate limiting per key
    • Usage tracking
  3. OAuth 2.0

    • User-facing endpoints
    • Social login integration
    • Token refresh flows
  4. Rate Limiting

    # Add rate limiting middleware
    from slowapi import Limiter
    from slowapi.util import get_remote_address
    
    limiter = Limiter(key_func=get_remote_address)

Verifying Installation

1. Check Server Health

# Server should respond with 200
curl http://127.0.0.1:8000/api/health

2. Test Basic Endpoint

# Get generation tags
curl http://127.0.0.1:8000/api/generation/tags

3. Check Interactive Docs

Open browser to:

  • Swagger UI: http://127.0.0.1:8000/docs
  • ReDoc: http://127.0.0.1:8000/redoc

Common Issues

Port Already in Use

# Find process using port 8000
lsof -i :8000

# Kill process
kill -9 <PID>

Missing Environment Variables

# Check if variables are set
echo $REPLICATE_API_KEY
echo $OPENAI_API_KEY

# Source .env file
export $(cat .env | xargs)

Firebase Initialization Failed

# Verify credentials file exists
ls -la ./firebase-credentials.json

# Check file permissions
chmod 600 ./firebase-credentials.json

# Verify JSON format
python -c "import json; json.load(open('firebase-credentials.json'))"

ChromaDB Connection Issues

# Clear ChromaDB directory
rm -rf ./chroma_db

# Restart server to recreate database

Next Steps

  1. Explore API Documentation

    • Read API_ENDPOINTS.md for complete endpoint reference
    • Test endpoints using Swagger UI at /docs
  2. Integration Development

  3. Configure Features

    • Set up Firebase for persistence
    • Configure Solana network (devnet/mainnet)
    • Enable trend detection workflows
  4. Production Deployment

    • Set up reverse proxy (nginx/caddy)
    • Enable HTTPS with SSL certificates
    • Configure authentication
    • Set up monitoring and logging

Last Updated: January 2025 - LaunchAgencyBot Web UI v2.0