Version: v11.0 (AI Orchestration V7.2.1) | Last Updated: October 20, 2025
Advanced AI orchestration platform for Slovenian building permits and legislation Combining Claude Sonnet 4 (or higher), GPT-4o (or higher), and Perplexity with multimodal RAG for research-quality legal analysis
Live Application: app.mojai.xyz
Moj AI is a production-grade, multi-tenant SaaS platform that helps users navigate complex Slovenian building legislation using advanced AI orchestration. The system intelligently combines multiple AI models, legal document databases, and real-time internet research to deliver comprehensive, source-backed answers.
- π― Specialized Knowledge: Multi core Slovenian building legislation PDFs (Pravilnik, TSG, Uredba, Zakon, OPN_MOM, GZ, Odlok_OPN_MOL_ID) permanently loaded
- π€ Dual-Mode AI: Choose between comprehensive research (Frontier) or fast answers (Lightning)
- π Multimodal RAG: Upload your own PDFs, DOCX, or scanned documents for conversation-specific analysis
- π Real-Time Research: Internet research via Perplexity for current prices, regulations, and market data
- β Source Attribution: Every claim backed by clickable sources (RAG documents, internet links, or general knowledge)
- β‘ Transparent Processing: Real-time progress showing actual AI orchestration steps
Moj AI offers two AI modes optimized for different use cases:
Perfect for: Complex legal analysis, building permit applications, comprehensive research
| Feature | Details |
|---|---|
| AI Model | Claude Sonnet 4 (Anthropic) |
| Response Length | 10,000-25,000 characters |
| Tools Used | RAG + Perplexity + General Knowledge + Anti-Hallucination |
| Processing Time | 60-240 seconds |
| Question Cost | 1.0 questions |
| Real Example | 15,277 characters, 138s, 5 sources |
What you get:
- Comprehensive 5-10 page reports
- Detailed legal analysis with court cases
- Real-time market data and prices
- Step-by-step procedures
- Complete source citations
Perfect for: Quick questions, simple queries, cost-effective responses
| Feature | Details |
|---|---|
| AI Model | GPT-4.1 April 2025 (OpenAI) |
| Response Length | 2,000-3,000 characters |
| Tools Used | RAG + General Knowledge (Perplexity skipped for cost savings) |
| Processing Time | 15-30 seconds |
| Question Cost | 0.5 questions (half price!) |
| Real Example | 2,929 characters, 17.1s, 3 sources |
What you get:
- Concise, focused answers
- Essential legal information
- Quick turnaround
- Cost-effective (50% cheaper)
- β Dual-Mode Selection - User chooses Frontier or Lightning mode
- β Intelligent Query Analysis - Automatically detects when RAG, internet research, or legal reasoning is needed
- β Multi-Source Intelligence - Combines RAG documents, Perplexity research, and LLM knowledge
- β Real-Time Progress - Live updates showing actual orchestration steps ("Searching legal documents...", "Researching current prices...")
- β Orchestration Reports - Detailed breakdown of tools used, processing time, confidence scores
- β Fractional Question Deduction - 0.5 questions for Lightning, 1.0 for Frontier
- β Admin-Configurable - Master system messages, model selection, API keys managed via admin UI
- β Admin RAG - 7 core Slovenian building legislation PDFs permanently loaded for all users
- β User RAG - Upload conversation-specific documents (PDF, DOCX, DOC, TXT, scanned PDFs with OCR)
- β Quality Validation - Document quality scoring (0-100) prevents bad uploads
- β Multimodal Processing - Table extraction, OCR for scanned documents, semantic chunking
- β Source Attribution - Every RAG-sourced claim includes document name and page reference
- β Google OAuth - Secure authentication with role-based access (user/admin)
- β Conversation Management - Create, rename, delete, persist conversations across sessions
- β Question Allowance - Stacking system (Premium + Bonus + Free questions)
- β Real-Time Streaming - Server-Sent Events for live progress updates
- β Dual Language - Slovenian/English UI with error notifications in both languages
- β Mobile Compatible - Responsive design for all devices
- β File Upload - Drag-and-drop document upload with quality validation
- β AI Configuration - Configure orchestration strategies, select models (Claude/GPT-4), manage API keys
- β RAG Management - Upload/manage 7 core legal PDFs, view extracted text, test retrieval accuracy
- β Subscription Management - Sync Stripe products, manage subscription plans
- β Bonus Questions - Grant additional questions to users with expiration dates
- β System Monitoring - Real-time health checks, API status, database connections
- β Master System Messages - Fine-tune AI behavior for Frontier and Lightning modes separately
- β Subscription Tiers - Free (5 questions), Basic (15/month), Advanced (50/month), Max (150/month)
- β Question Stacking - Purchased questions add to remaining balance (3 remaining + 15 purchased = 18 total)
- β Fractional Deduction - Lightning mode costs 0.5 questions, Frontier costs 1.0 questions
- β Bonus Questions - Admin can grant bonus questions that stack on top of purchased questions
- β Stripe Integration - Checkout sessions, webhook handling, subscription management
| Technology | Purpose |
|---|---|
| Next.js 14 | React framework with App Router |
| TypeScript | Type-safe development |
| Tailwind CSS | Utility-first styling |
| Shadcn/ui | Modern UI components (Radix UI) |
| Zustand | State management |
| Server-Sent Events | Real-time progress streaming |
| Technology | Purpose |
|---|---|
| FastAPI | High-performance async Python web framework |
| Python 3.11 | Core programming language |
| SQLAlchemy | ORM for PostgreSQL |
| Pydantic | Data validation and settings |
| Alembic | Database migrations |
| aiofiles | Async file operations |
| Database | Purpose |
|---|---|
| PostgreSQL | Core data (users, conversations, messages, admin settings, subscriptions) |
| Weaviate | Vector database for RAG (semantic search, embeddings) |
| Redis | Caching and session management |
| Provider | Models | Purpose |
|---|---|---|
| Anthropic | Claude Sonnet 4 | Frontier mode orchestrator, legal reasoning |
| OpenAI | GPT-4o, text-embedding-3-small | Lightning mode orchestrator, embeddings |
| Perplexity | sonar-pro | Real-time internet research (Frontier mode only) |
| Service | Purpose |
|---|---|
| DigitalOcean App Platform | Application hosting (backend + frontend) |
| DigitalOcean Managed PostgreSQL | Production database |
| DigitalOcean Managed Redis | Production cache |
| DigitalOcean Spaces | S3-compatible object storage for file uploads |
| Docker Compose | Local development environment |
| Google OAuth | Authentication |
| Stripe | Payment processing and subscriptions |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Interface β
β (Next.js 14 + TypeScript) β
β - Chat Interface - Admin Panel - Subscription Management β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β - REST API - Server-Sent Events - Google OAuth - Stripe β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β V7 AI Orchestration Engine β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β βQuery Analyzerββ βTool Executor ββ βResponse Synthβ β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β Tools: RAG Search | Perplexity | Legal Reasoning β
ββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β β β
ββββββββββββ ββββββββββββ ββββββββββββ
βPostgreSQLβ β Weaviate β β Redis β
β(Core Data)β β(Vectors) β β (Cache) β
ββββββββββββ ββββββββββββ ββββββββββββ
β
ββββββββββββββΌβββββββββββββ
β β β
ββββββββββββ ββββββββββββ ββββββββββββ
β Claude β β OpenAI β βPerplexityβ
βSonnet 4.5β βGPT-4o-miniβ βsonar-pro β
ββββββββββββ ββββββββββββ ββββββββββββ
- Query Analysis - Detect if query needs RAG, internet research, or legal reasoning
- Tool Selection - Choose required tools based on analysis and selected mode (Frontier/Lightning)
- Tool Execution - Execute tools in parallel/sequence with context passing
- Response Synthesis - Combine results with inline citations and source attribution
- Quality Validation - Verify response quality and completeness
- Usage Tracking - Deduct appropriate questions (0.5 or 1.0) based on mode
See: docs/architecture/ai-orchestration.md for complete details
Comprehensive documentation is available in the docs/ directory and the public documentation repository at github.com/talirezun/moj-ai-docs.
| Document | Description |
|---|---|
| system-overview.md | High-level system architecture, component interactions, data flow |
| ai-orchestration.md | V7.2.1 dual-mode orchestration, anti-hallucination tool, response synthesis |
| database-schema.md | Complete database schema, relationships, indexes |
| multimodal-rag-architecture.md | Dual RAG system, document processing, quality validation |
| authentication-system.md | Google OAuth implementation, JWT tokens, role-based access |
| master-system-message.md | VERSION 4 AI system prompts for Frontier and Lightning modes |
| PROJECT_STRUCTURE.md | Codebase organization, file structure, key components |
| Document | Description |
|---|---|
| README.md | Complete UI/UX documentation index |
| 01_AI_ORCHESTRATION_OVERVIEW.md | Core orchestration system from user perspective |
| 02_MODE_SELECTOR.md | Lightning vs Frontier mode selection UI |
| 03_RAG_SYSTEM.md | Dual RAG architecture and document upload |
| 04_QUESTION_ALLOWANCE.md | Fractional question deduction system |
| Document | Description |
|---|---|
| 00_USER_SCENARIOS_INDEX.md | Complete index of user scenarios |
| 01_BUILDING_PERMITS.md | Building permit application scenarios |
The following documentation is also available in the public repository at github.com/talirezun/moj-ai-docs:
- Architecture Documentation - System design and technical architecture
- UI/UX Features - User interface and experience documentation
- User Scenarios - Real-world use cases and examples
User Query: "I want to build a 4-unit residential building in Ljubljana's BeΕΎigrad district. What permits do I need, what are the costs, and how long will it take?"
AI Response (10,000+ characters):
- Complete list of required permits (building permit, location permit, etc.)
- Step-by-step application process
- Current fees and costs (from Perplexity real-time research)
- Timeline estimates
- Required documentation
- Relevant legal articles from RAG (Zakon, Pravilnik, OPN_MOL)
- Court cases and precedents
- 20+ clickable sources
Processing: 90 seconds | Cost: 1.0 questions
User Query: "Can I legalize a 15mΒ² extension to my house built in 2018?"
AI Response (2,500 characters):
- Yes/No answer with conditions
- Key legal requirements
- Simplified procedure steps
- Estimated costs
- 4-5 relevant sources from RAG
Processing: 25 seconds | Cost: 0.5 questions
User Action: Uploads building inspection decision PDF
User Query: "What violations are mentioned in this document and how do I fix them?"
AI Response:
- Extracts specific violations from uploaded document
- Cross-references with legal requirements from Admin RAG
- Provides remediation steps
- Cites both uploaded document and legal framework
moj-ai-v11/
βββ backend/ # FastAPI backend
β βββ app/
β β βββ api/v1/ # API endpoints
β β βββ services/ # Business logic
β β β βββ orchestration_v7/ # V7 orchestration engine
β β β βββ rag_service_multimodal.py # RAG system
β β β βββ storage_service.py # DigitalOcean Spaces
β β β βββ ...
β β βββ models/ # Database models
β β βββ schemas/ # Pydantic schemas
β β βββ core/ # Config, auth, database
β βββ alembic/ # Database migrations
β βββ .env.example # Environment template
β
βββ frontend/ # Next.js frontend
β βββ app/ # Pages (App Router)
β β βββ admin/ # Admin panel pages
β β βββ dashboard/ # User dashboard
β β βββ ...
β βββ components/ # React components
β β βββ chat/ # Chat interface components
β β βββ admin/ # Admin components
β β βββ ...
β βββ contexts/ # React contexts (auth, usage, language)
β βββ hooks/ # Custom hooks (useChat, useAuth, etc.)
β βββ lib/ # Utilities and API client
β
βββ docs/ # Documentation
β βββ architecture/ # Architecture docs
β βββ ui-ux-features/ # UI/UX documentation
β βββ user-scenarios/ # User scenarios
β βββ admin/ # Admin guides
β βββ agent_manuals/ # Operations guides
β
βββ training-files/ # Multi core legal PDFs
β βββ Pravilnik_o_projektni_in_drugi_dokumentaciji_PISRS.pdf
β βββ TSG-V-006_2022_razvrscanje_objektov.pdf
β βββ Uredba_o_razvrscanju_objektov_PISRS.pdf
β βββ Zakon_o_urejanju_prostora_ZUreP-3_PISRS.pdf
β βββ 220528_OPN_MOM.pdf
β βββ GZ 1.pdf
β βββ Odlok_OPN_MOL_ID.pdf
β
βββ docker-compose.yml # Local development services
βββ LICENSE # Proprietary license
βββ README.md # This file
| File | Purpose |
|---|---|
backend/app/main.py |
FastAPI application entry point |
backend/app/services/orchestration_v7/orchestration_engine_v7.py |
V7 orchestration engine |
backend/app/services/rag_service_multimodal.py |
Dual RAG system |
backend/app/services/storage_service.py |
DigitalOcean Spaces integration |
frontend/hooks/useChat.ts |
Chat logic with SSE streaming |
frontend/components/chat/ModeSelector.tsx |
Frontier/Lightning mode selector |
frontend/components/chat/QuestionAllowanceDisplay.tsx |
Question balance display |
Skupina Svetilnik d.o.o. Cesta 24. Junija 25 1000 Ljubljana, Slovenia
Production URL: app.mojai.xyz
For inquiries about:
- Licensing: See LICENSE file
- Partnerships: Contact via GitHub
- Technical Support: Review documentation first
- Private Repository Access: Contact repository owner
Built with:
- Anthropic Claude - Frontier mode orchestration
- OpenAI GPT-4 - Lightning mode orchestration and embeddings
- Perplexity - Real-time internet research
- Weaviate - Vector database
- DigitalOcean - Infrastructure
- Stripe - Payment processing
- Next.js & FastAPI - Application frameworks
Last Updated: October 20, 2025 | Version: v7.2.1 | Status: Production Ready