Skip to content

talirezun/moj-ai-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Moj AI - AI-Powered Slovenian Building Legislation Assistant

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


🎯 What is Moj AI?

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.

Core Value Proposition

  • 🎯 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

⚑ Dual-Mode AI Orchestration

Moj AI offers two AI modes optimized for different use cases:

πŸš€ Frontier Mode (Research-Quality Responses)

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

⚑ Lightning Mode (Fast Answers)

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)

🌟 Key Features

πŸ€– AI Orchestration (V7.2)

  • βœ… 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

πŸ“š Dual RAG System

  • βœ… 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

πŸ‘€ User Experience

  • βœ… 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

βš™οΈ Admin Panel

  • βœ… 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

πŸ’³ Billing & Subscriptions (Stripe)

  • βœ… 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 Stack

Frontend

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

Backend

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

Databases

Database Purpose
PostgreSQL Core data (users, conversations, messages, admin settings, subscriptions)
Weaviate Vector database for RAG (semantic search, embeddings)
Redis Caching and session management

AI/LLM Providers

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)

Infrastructure & Services

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

πŸ—οΈ System Architecture

High-Level Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         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 β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

V7 Orchestration Flow

  1. Query Analysis - Detect if query needs RAG, internet research, or legal reasoning
  2. Tool Selection - Choose required tools based on analysis and selected mode (Frontier/Lightning)
  3. Tool Execution - Execute tools in parallel/sequence with context passing
  4. Response Synthesis - Combine results with inline citations and source attribution
  5. Quality Validation - Verify response quality and completeness
  6. Usage Tracking - Deduct appropriate questions (0.5 or 1.0) based on mode

See: docs/architecture/ai-orchestration.md for complete details


πŸ“š Documentation

Comprehensive documentation is available in the docs/ directory and the public documentation repository at github.com/talirezun/moj-ai-docs.

Architecture Documentation (docs/architecture/)

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

UI/UX Features (docs/ui-ux-features/)

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

User Scenarios (docs/user-scenarios/)

Document Description
00_USER_SCENARIOS_INDEX.md Complete index of user scenarios
01_BUILDING_PERMITS.md Building permit application scenarios

Public Documentation Repository

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

πŸ’‘ Use Cases & Examples

Example 1: Building Permit Application (Frontier Mode)

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

Example 2: Quick Legalization Question (Lightning Mode)

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

Example 3: Document-Specific Analysis (User RAG)

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

πŸ”§ Development

Project Structure

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

Key Files

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

🏒 Company

Skupina Svetilnik d.o.o. Cesta 24. Junija 25 1000 Ljubljana, Slovenia

Production URL: app.mojai.xyz


πŸ“ž Contact & Support

For inquiries about:

  • Licensing: See LICENSE file
  • Partnerships: Contact via GitHub
  • Technical Support: Review documentation first
  • Private Repository Access: Contact repository owner

πŸ™ Acknowledgments

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published