AI implementation for openai and claude.

This commit is contained in:
2026-01-15 21:20:30 +01:00
parent fe70f3892c
commit 5bbec0e240
20 changed files with 623 additions and 24 deletions

View File

@@ -6,11 +6,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
DevDen is a self-hosted AI chat platform that enables organizations to provide AI-powered Q&A based on their own knowledge bases. Users interact through a clean chat interface while administrators manage knowledge bases, AI providers, and user access through a terminal-style dashboard.
**Current Status:** Early prototype stage with static frontend (HTML/CSS/JS). Backend infrastructure is not yet implemented.
**Current Status:** MVP with AI integration complete. Backend FastAPI server with Claude and OpenAI support. Frontend streams responses in real-time.
## Architecture
**Planned Technology Stack:**
**Technology Stack:**
- **Frontend:** Vanilla JavaScript (prototype), potential migration to Svelte
- **Backend:** FastAPI (Python)
- **Database:** PostgreSQL (users, conversations, settings)
@@ -25,9 +25,24 @@ DevDen is a self-hosted AI chat platform that enables organizations to provide A
## Current Files
- `index.html` - Main chat interface structure
- `script.js` - Chat interaction logic (mock responses currently)
- `style.css` - UI styling with fox-themed color scheme (accent: `#d4a574`)
**Frontend:**
- `index.html` - Main chat interface structure with welcome screen
- `script.js` - Chat interaction logic with SSE streaming
- `style.css` - Catppuccin Mocha theme with pixel aesthetic
**Backend:**
- `backend/app/main.py` - FastAPI application entry point
- `backend/app/config.py` - Environment configuration
- `backend/app/api/chat.py` - Chat endpoints (POST /api/chat, POST /api/chat/stream)
- `backend/app/services/provider_manager.py` - Provider abstraction and fallback
- `backend/app/services/provider_claude.py` - Claude implementation
- `backend/app/services/provider_openai.py` - OpenAI implementation
- `backend/app/models/schemas.py` - Pydantic request/response models
**Infrastructure:**
- `docker-compose.yml` - Multi-service orchestration
- `backend/Dockerfile.backend` - Backend container
- `.env.example` - Environment template
## Development Phases (from project.md)
@@ -39,14 +54,36 @@ DevDen is a self-hosted AI chat platform that enables organizations to provide A
6. Git Integration - Auto-sync from repositories
7. Polish - Production readiness
## Commands (Future)
## Commands
When Docker infrastructure is implemented:
**Start the application:**
```bash
docker-compose up -d
docker-compose exec devden-web python manage.py init-db
docker-compose exec devden-web python manage.py create-admin --email admin@company.com
docker-compose logs -f devden-web
docker compose up -d --build
```
**View logs:**
```bash
docker compose logs -f backend
docker compose logs -f frontend
```
**Stop the application:**
```bash
docker compose down
```
**Test backend API:**
```bash
# Health check
curl http://localhost:8000/health
# List available providers
curl http://localhost:8000/api/chat/providers
# Test chat (non-streaming)
curl -X POST http://localhost:8000/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "Hello!"}'
```
## Design Decisions