Enterprise-grade AI chat platform with multi-provider support, intelligent model orchestration, autonomous AI agents, document studio, marketplace, and VS Code extension.
Current version: 2.1.65
Repository: github.com/marypas74/ai_enterprise
- Intelligent Model Orchestrator β Automatic model selection via rule-based scoring + semantic embedding routing. Routes queries to Fast/Balanced/Powerful tiers with circuit breaker, cascade escalation, and feedback loop.
- Multi-Provider AI β OpenAI, Anthropic Claude, Google Gemini, Ollama (local models) with automatic failover. LiteLLM proxy support.
- Autonomous AI Agents β Claude Agent SDK integration with terminal orchestration, worktree isolation, task management, and iterative execution via Auto-Claude dashboard.
- Document Studio β PDF editor (pdftohtml + LibreOffice + Ollama Vision OCR), PAdES-B-B digital signatures, DOCX/XLSX/PPTX generation, OnlyOffice integration.
- Marketplace β Plugin/skill catalog with approval workflow, catalog service, KB integration, Qdrant vector search, and backend client for automated installs.
- Vector Memory β 4-tier RAG pipeline (episodic/declarative/procedural/working) with HyDE, embeddings, semantic search, and memory stats dashboard.
- Async Document Queue β Large RAG requests (>8K tokens) are intercepted and dispatched to a background
DocumentJobWorkerwith Redis-backed job queue, WebSocket notifications (/ws/jobs), and stale job recovery on worker restart. - Summary Intent Detection β Document queries are classified as "summary" vs "specific" to either pull distributed chunks covering the whole document or run semantic search (IT/EN patterns for "riassumi", "di che argomenti/temi/tematiche parla", "what is this document about", etc.).
- Plugin System β File-based plugins with EventBus hooks, MCP server support, skill management, prompt templates.
- EU AI Act Compliance β Art. 50.1/50.2 disclosure, consent management, bias monitoring, audit logging, AI transparency page, DPIA documentation.
- VS Code Extension β 19 commands: chat, code explain/fix/improve/document, agent sessions, inline editing, provider switching.
- Voice Interface β OpenAI Whisper STT + OpenAI TTS / local Piper TTS fallback with animated Avatar Orb overlay.
- Image Generation β OllamaDiffuser integration (FLUX.1 schnell) inline in chat.
- Admin Dashboard β User/group management, provider config, orchestrator dashboard, pipeline visualizer, plugin graph, hooks, guides, kanban.
- Security β JWT + MFA (TOTP), Google OAuth, Zod input validation, OWASP hardening, rate limiting, network policies.
- Kubernetes Ready β Production deployment on MicroK8s with auto-scaling, backup CronJobs, Cloudflare Tunnel, OnlyOffice, Open-WebUI, Parlant.
- Mobile β Android APK (Capacitor 6) with native SSE + PWA for iOS (installable from Safari).
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React 18 + Vite) β
β Chat β Admin β Projects/Kanban β Agents β Documents β
β Zustand stores β Tailwind CSS β Playwright E2E β
βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β Nginx reverse proxy
ββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ
β Backend (Fastify 5 + TypeScript) β
β 25 modules β JWT/MFA/OAuth β WebSocket β SSE streaming β Zod validation β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Model Orchestrator β
β β
β User Query βββΆ ModelRouter βββΆ Tier Selection βββΆ Provider β
β β β β β
β Rule-based Semantic Circuit Breaker β
β scoring embedding + Cascade Fallback β
β βΌ βΌ βΌ β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
β β FAST β β BALANCED β β POWERFUL β β
β β Haiku 4.5 β β Sonnet 4.6 β β Opus 4.6 β β
β β GPT-4.1-mini β β GPT-4.1 β β o3-mini β β
β β Gemini Flash β β Gemini Pro β β β β
β β Ollama β β β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββ β
ββββββββββ¬βββββββββββ¬βββββββββ¬βββββββββββ¬βββββββββββ¬βββββββββββ¬ββββββββββββββββ€
β Auth β Chat β Agents β Projects β Tools β Docs β Compliance β
β MFA β Complete β SDK β Kanban β PDF/DOCX β Studio β EU AI Act β
β OAuth β Stream β Orchst β Boards β PPTX/XLS β OnlyOff β Consent/Audit β
β Sessi β Memory β Worktr β Cards β Sandbox β PAdES-BB β Bias Monitor β
ββββββββββ΄βββββ¬ββββββ΄βββββββββ΄βββββββββββ΄βββββββββββ΄βββββββββββ΄ββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ¬βββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββ
β β β β β β
ββΌββββββββ ββββΌββββββ ββββββΌββββββ βββββββΌβββββ ββββββββΌβββββββ ββββββββΌβββ
βMariaDB β β Redis β β Qdrant β β Parlant β β Ollama β βLiteLLM β
βUsers β βSession β β Vectors β β Agents β β Local LLMs β β Proxy β
βChat β βCache β βEmbeddingsβ βGuidlines β β GPU/Docker β β Router β
βHistory β βTokens β β RAG/KB β β Sessions β β β β β
ββββββββββ ββββββββββ ββββββββββββ ββββββββββββ βββββββββββββββ βββββββββββ
Automatically selects the optimal AI model for each query without user intervention.
- Rule-Based Router β Analyzes query length, keywords, attachments, conversation depth, and tool usage to compute a complexity score.
- Semantic Router β Uses embedding similarity against pre-computed route examples for sub-millisecond task classification (greeting, coding, analysis, complex reasoning, etc.).
- Response Quality Checker β Evaluates response quality without LLM calls (refusal detection, truncation, uncertainty). Supports cascade escalation to a more powerful model.
- Circuit Breaker β Tracks provider health, opens circuit on consecutive failures, auto-recovers.
- Feedback Loop β Records routing decisions with latency, cost, and user overrides. Admin dashboard shows routing distribution and cost savings.
| Tier | Default Models | Use Case |
|---|---|---|
| Fast | Haiku 4.5, GPT-4.1-mini, Gemini Flash, Ollama | Greetings, simple questions, formatting |
| Balanced | Sonnet 4.6, GPT-4.1, Gemini Pro | Coding, analysis, writing, standard tasks |
| Powerful | Opus 4.6, o3-mini | Architecture, complex reasoning, multi-step agents |
- Node.js 20+
- Docker
- MicroK8s (Kubernetes deployment)
# Clone
git clone https://github.com/marypas74/ai_enterprise.git
cd ai_enterprise
# Backend
cd backend
npm install
cp .env.example .env # Configure API keys, DB, Redis, JWT secrets
npm run dev # Hot reload on port 3000
# Frontend
cd frontend
npm install
npm run dev # Vite dev server on port 5173 (proxies /api β :3000)
# Tests
cd backend && npm test # Vitest unit tests
cd frontend && npm test # Vitest + Testing Library
cd frontend && npm run test:e2e # Playwright E2E
# VS Code Extension
cd vscode-extension
npm run build:all # Build webview + compile extension
npm run package # Create .vsixbash BUILD.sh # Full build: npm install + Docker + MicroK8s import + K8s deploy
sudo bash DEPLOY.sh # Quick deploy: import pre-built images + restart podsai_enterprise/
βββ backend/ # Fastify 5 API server (TypeScript)
β βββ src/
β βββ modules/ # 25 feature modules
β β βββ auth/ # JWT + MFA (TOTP) + Google OAuth
β β βββ chat/ # Completions, conversations, models, SSE streaming
β β βββ admin/ # Users, providers, plugins, settings, orchestrator, guides
β β βββ agents/ # AI agent sessions + Claude Agent SDK routes
β β βββ projects/ # Kanban boards, cards, access control
β β βββ memory/ # Vector memory + observations (4-tier RAG)
β β βββ tools/ # DOCX/XLSX/PPTX/PDF/OnlyOffice generation
β β βββ documents/ # Document studio management
β β βββ attachments/ # File upload + OCR processing
β β βββ compliance/ # EU AI Act (consent, feedback, bias monitor, audit)
β β βββ orchestrator/ # Terminal slot management (Auto-Claude)
β β βββ parlant/ # Parlant AI agent proxy
β β βββ ingestion/ # URL/text/memory import pipeline
β β βββ forms/ # Conversational forms engine
β β βββ scheduler/ # Job scheduling (WhiteRabbit)
β β βββ marketplace/ # Plugin/skill catalog routes (via marketplace service)
β β βββ activity/ # Activity logging
β βββ services/ # Business logic (30+ services)
β β βββ ModelRouter.ts # Rule-based model selection
β β βββ SemanticRouter.ts # Embedding task classification
β β βββ ResponseQualityChecker.ts # Cascade quality assessment
β β βββ CircuitBreakerService.ts # Provider health tracking
β β βββ HyDEService.ts # Hypothetical Document Embeddings
β β βββ LLMSyncWorker.ts # Background LLM sync
β β βββ MCPClientManager.ts # MCP protocol manager
β β βββ ParlantProvider.ts # Parlant integration
β β βββ VisionService.ts # Ollama Vision OCR
β β βββ WebSearchService.ts # Web search integration
β β βββ document-processing/ # PDF edit session manager
β βββ database/ # Connection pool + auto-migrations
βββ frontend/ # React 18 + Vite + Tailwind CSS
β βββ src/
β βββ pages/ # Route pages
β β βββ ChatPage.tsx # Main chat interface
β β βββ DocumentsPage.tsx # Document studio
β β βββ ProjectsPage.tsx # Kanban project management
β β βββ AutoClaudePage.tsx # Autonomous agent dashboard
β β βββ MarketplacePage.tsx # Plugin/skill marketplace
β β βββ ParlantPage.tsx # Parlant agent management
β β βββ AITransparencyPage.tsx # EU AI Act transparency
β β βββ SettingsPage.tsx # User settings + voice config
β β βββ admin/ # 20+ admin pages
β βββ components/ # Reusable UI components
β βββ hooks/ # Zustand stores (auth, agents, parlant, documents)
β βββ services/ # API client (axios + SSE with routing events)
βββ marketplace/ # Standalone marketplace service (Fastify + SQLite)
β βββ src/
β βββ catalog/ # Catalog service + routes
β βββ install/ # Install service
β βββ approval/ # Approval workflow
β βββ backend/ # Backend client for automated installs
β βββ kb/ # Knowledge base integration
β βββ qdrant/ # Vector search
β βββ database/ # SQLite connection + migrations
βββ vscode-extension/ # VS Code companion extension
β βββ src/ # Extension entry + 19 commands
β βββ webview-ui/ # React webview bundles (webpack + esbuild)
βββ doc-processor/ # Document processing microservice
βββ k8s/ # Kubernetes manifests (Kustomize)
β βββ backend/ # Deployment + Service + HPA
β βββ frontend/ # Deployment + Service (Nginx)
β βββ mariadb/ # StatefulSet + init ConfigMap + schema
β βββ redis/ # StatefulSet
β βββ litellm/ # LiteLLM proxy deployment + configmap
β βββ parlant/ # Parlant AI service
β βββ qdrant/ # Qdrant vector DB
β βββ marketplace/ # Marketplace service deployment
β βββ onlyoffice/ # OnlyOffice document server
β βββ open-webui/ # Open-WebUI deployment
β βββ tls/ # TLS certificates
β βββ storage/ # PersistentVolumes
β βββ kustomization.yaml
βββ BUILD.sh # Full build pipeline
βββ DEPLOY.sh # Quick deploy script
βββ ROADMAP.md # Development roadmap
# Server
PORT=3000
NODE_ENV=production
# Database (MariaDB)
DB_HOST=mariadb
DB_PORT=3306
DB_USER=enterprise_ai_chat
DB_PASSWORD=your_password
DB_NAME=enterprise_ai_chat
DB_CONNECTION_LIMIT=25
# Redis
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=your_redis_password
# JWT
JWT_SECRET=your_jwt_secret_min_32_chars
JWT_ACCESS_EXPIRES_IN=15m
JWT_REFRESH_SECRET=your_refresh_secret
# MFA
MFA_BYPASS_EMAILS= # comma-separated emails exempt from MFA
TRUSTED_IPS= # comma-separated trusted IPs (bypass rate limit)
# AI Providers (or configure via Admin Panel)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
# Ollama (Docker host, NOT Kubernetes)
OLLAMA_BASE_URL=http://10.0.1.1:8086/ollama
OLLAMA_AUTH_KEY=your_ollama_auth_key
# Storage
STORAGE_ROOT=/data/projects
EXTENSION_DIR=/data/projects/extensions
# Encryption (for stored secrets)
ENCRYPTION_KEY=your_32_char_hex_key
# CORS
CORS_ORIGIN=https://your-domain.comDeployed on MicroK8s in namespace enterprise-ai-chat:
| Service | Type | Notes |
|---|---|---|
| backend | Deployment (2 replicas) | Fastify API, port 3000 |
| frontend | Deployment (2 replicas) | Nginx, port 80 |
| mariadb | StatefulSet | Port 3306, PVC 20Gi |
| redis | StatefulSet | Port 6379, PVC 5Gi |
| qdrant | Deployment | Vector DB, port 6333 |
| litellm | Deployment | LLM proxy, port 4000 |
| parlant | Deployment | AI agent framework, port 8800 |
| marketplace | Deployment | Plugin catalog, port 3001 |
| onlyoffice | Deployment | Document server, port 80 |
| open-webui | Deployment | Alternative UI |
| doc-processor | Deployment | Document processing microservice |
All external traffic goes through Cloudflare Tunnel. Ingress uses TLS with cert-manager.
# Backend
cd backend
npm run dev # Dev server with tsx watch
npm run build # TypeScript compilation β dist/
npm run lint # ESLint
npm run test # Vitest unit tests
npx vitest run path/to/test.ts # Single test file
# Frontend
cd frontend
npm run dev # Vite dev server (port 5173)
npm run build # tsc + vite build β dist/
npm run lint # ESLint
npm run test:e2e # Playwright E2E tests
npm run test:e2e:prod # E2E against production
# Marketplace
cd marketplace
npm run dev # Dev server
npm run build # TypeScript compilation
# VS Code Extension
cd vscode-extension
npm run build:all # Build webview + compile extension
npm run webpack # Production webpack build
npm run webpack:dev # Dev build with watch
npm run package # Create .vsix with vsce
npm run release # Bump version + build + package
# Kubernetes
sudo microk8s kubectl get pods -n enterprise-ai-chat
sudo microk8s kubectl logs -l app=backend -n enterprise-ai-chat
sudo microk8s kubectl rollout status deployment/backend -n enterprise-ai-chat- Authentication: JWT (access 15m + refresh 7d) + MFA TOTP + Google OAuth
- Authorization: Role-based (admin/user) with per-group permissions
- Input validation: Zod schemas on all API endpoints
- Rate limiting: Per-IP + per-user limits via @fastify/rate-limit
- Headers: Helmet CSP, HSTS, X-Frame-Options
- Network: K8s NetworkPolicy restricts pod-to-pod traffic
- Secrets: Kubernetes secrets for API keys, never in source
- Cloudflare: All traffic via Cloudflare Tunnel, IP restrictions via CF-Connecting-IP header
- Art. 50.1 β Mandatory AI disclosure banner on all AI-generated content
- Art. 50.2 β Synthetic media watermarking (images)
- Consent management β Granular consent collection and audit trail
- Bias monitoring β Automated bias detection on model responses
- Audit logging β Immutable log of all AI interactions
- AI Transparency page β User-facing explanation of AI system behavior
- DPIA β Data Protection Impact Assessment documented in
DPIA.md
mainβ Production branch, tracks live deployment.abandoned/*β Archived feature branches preserved for historical reference (no longer maintained):abandoned/archive-legacyabandoned/feat-ai-act-complianceabandoned/feature-agent-framework-v1.6abandoned/feature-document-studioabandoned/feature-v2.0.0-image-gen-voiceabandoned/feature-vision-document-pipelineabandoned/feature-vllm-async-document-queue(merged intomain)abandoned/feature-vllm-integrationabandoned/pre-vllm-migration-backupabandoned/worktree-marketplace
Proprietary. See DPIA.md and PRIVACY_POLICY.md for compliance documentation.