Platform chat AI lengkap seperti ChatGPT dengan support multi-model (Ollama, OpenAI, Anthropic, Gemini), RAG, streaming real-time, dan agent capabilities yang dapat di-self host.
- FastAPI backend dengan async/await
- Multi-model LLM support (Ollama, OpenAI, Anthropic, Gemini)
- Streaming real-time dengan Server-Sent Events
- RAG system dengan ChromaDB dan LangChain
- Agent system dengan tools ecosystem
- Authentication JWT + OAuth2
- API key encryption dengan Fernet
- File upload dan processing
- Supabase PostgreSQL database
- Next.js 14 dengan App Router
- TypeScript + TailwindCSS
- Shadcn UI components
- Real-time streaming chat interface
- Model management UI
- Settings dan preferences
- File upload dengan drag-drop
ai-chat-platform/
├── backend/ # FastAPI Backend (SELESAI)
│ ├── app/
│ │ ├── api/
│ │ │ ├── deps.py # Dependencies (auth)
│ │ │ └── routes/ # API Routes
│ │ │ ├── auth.py # Authentication
│ │ │ ├── chat.py # Chat streaming
│ │ │ ├── models.py # Model management
│ │ │ └── files.py # File upload/RAG
│ │ ├── core/
│ │ │ ├── config.py # Configuration
│ │ │ ├── database.py # Database connection
│ │ │ └── security.py # Security utilities
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── services/
│ │ │ ├── llm/ # LLM services
│ │ │ │ ├── base.py # Base service
│ │ │ │ ├── ollama.py # Ollama service
│ │ │ │ ├── openai_service.py # OpenAI service
│ │ │ │ ├── anthropic_service.py # Anthropic
│ │ │ │ ├── gemini_service.py # Gemini
│ │ │ │ └── router.py # Model router
│ │ │ ├── auth_service.py # Auth service
│ │ │ ├── rag_service.py # RAG service
│ │ │ └── agent_service.py # Agent service
│ │ └── main.py # Main application
│ ├── uploads/ # File uploads
│ ├── requirements.txt # Python dependencies
│ └── .env.example # Environment template
├── frontend/ # Next.js Frontend
│ ├── app/ # Next.js 14 App Router
│ ├── components/ # React components
│ ├── lib/ # Utilities
│ ├── hooks/ # Custom hooks
│ └── types/ # TypeScript types
└── docs/ # Documentation
## Quick Start
### 1. Generate Security Keys (CRITICAL)
```bash
cd backend
# Generate SECRET_KEY
python -c "import secrets; print('SECRET_KEY='+secrets.token_urlsafe(32))"
# Generate ENCRYPTION_KEY
python -c "from cryptography.fernet import Fernet; print('ENCRYPTION_KEY='+Fernet.generate_key().decode())"
# Update backend/.env dengan hasil generate di atas
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Pull models
ollama pull llama2
ollama pull nomic-embed-text # untuk RAG embeddingscd backend
# Install dependencies
pip install -r requirements.txt
# Run server
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Backend berjalan di: http://localhost:8000
API Docs: http://localhost:8000/docs
# Health check
curl http://localhost:8000/health
# Register user
curl -X POST http://localhost:8000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","username":"testuser","password":"password123"}'POST /api/auth/register- Register userPOST /api/auth/login- LoginGET /api/auth/me- Get profilePUT /api/auth/me- Update profile
POST /api/chat/stream- Stream chat (SSE)POST /api/chat/message- Non-streaming chat
GET /api/models/available- List modelsGET /api/models/validate- Validate connectionsPOST /api/models/ollama/pull- Pull Ollama model
POST /api/files/upload- Upload filePOST /api/files/process/{id}- Process documentGET /api/files/- List documentsPOST /api/files/query- Query documents
- Setup Guide:
docs/SETUP.md- Comprehensive setup instructions - API Documentation:
docs/API.md- Complete API reference - Deployment Guide:
DEPLOYMENT.md- Deployment summary - Interactive API Docs:
http://localhost:8000/docs(Swagger UI)
- FastAPI (async Python)
- SQLAlchemy + Pydantic
- LangChain + ChromaDB
- Supabase PostgreSQL
- JWT Authentication
- Ollama (local)
- OpenAI (GPT-4, GPT-3.5)
- Anthropic (Claude 3)
- Google Gemini
MIT