feat(manadeck): implement AI deck generation with Google Gemini

- Add AiService using Google Gemini Flash 2.0 for card generation
- Support all card types: text, flashcard, quiz, mixed
- Implement full generateDeckWithAI endpoint with:
  - Credit validation and consumption
  - Structured JSON output with response schema
  - Deck and card creation in PostgreSQL
  - Comprehensive error handling
- Add @google/genai dependency
- Update .env.example with GOOGLE_GENAI_API_KEY
- Support difficulty levels (beginner/intermediate/advanced)
- Support multiple languages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Till-JS 2025-11-25 02:59:46 +01:00
parent be9df4aa85
commit 4bdb5dea85
7 changed files with 717 additions and 84 deletions

View file

@ -5,16 +5,17 @@ PORT=8080
# Mana Core Configuration
MANA_SERVICE_URL=https://mana-core-middleware-111768794939.europe-west3.run.app
APP_ID=your-app-id-from-mana
SERVICE_KEY=your-service-key-from-mana-core # REQUIRED for credit operations
MANA_SUPABASE_SECRET_KEY=your-service-key-from-mana-core # REQUIRED for credit operations
SIGNUP_REDIRECT_URL=https://manadeck.com/welcome
# Supabase Configuration (Your app's database)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_KEY=your-service-key
# PostgreSQL Database (Drizzle ORM)
DATABASE_URL=postgresql://postgres:postgres@localhost:5433/manadeck
# AI Services (Google Gemini)
GOOGLE_GENAI_API_KEY=your-google-genai-api-key # Get from https://aistudio.google.com/apikey
# JWT Configuration
JWT_SECRET=your-jwt-secret
# CORS Configuration
FRONTEND_URL=http://localhost:8081
FRONTEND_URL=http://localhost:8081