🚀 Advanced RAG System

Persian, Arabic & English Document Processing with OCR Support

Query Engine: checking…

📤 Upload Documents

📁 Drag & Drop files here or click to browse

Supported: PDF, DOC, DOCX, TXT, HTML, Images (PNG, JPG, TIFF)

Max files per upload: loading…

Model used to convert documents into vectors. Must match the collection's vector dimension.

Simple upload still extracts text, chunks, and indexes — it only skips the slow LLM/vLLM metadata step. «Full LLM metadata» infers document title, author(s), chapter/section titles, topics, key entities, and a summary for every file (even well-structured ones). Profile default is unchanged unless you pick another option here.

Processing documents...

🔬 پیش‌نمایش متادیتا (Metadata Preview)

قبل از بارگذاری گروهی، یک فایل را اینجا آزمایش کنید. برای TXT، HTML و اسناد بدون ساختار، LLM metadata (محلی vLLM یا همان LLM Provider پروفایل) عنوان، موضوعات، خلاصه و بخش‌ها را استنتاج می‌کند.

در حال بارگذاری قابلیت‌ها…

💬 Ask Questions

Searching...

Your answers will appear here...

📊 System Statistics

0

Documents

0

Queries

Not Ready

Index Status

Query Engine (ChatUI API)

detecting…

GPU

🕵️ Recent Query Audit (last 5)

Per-phase timings help find bottlenecks. Slow retrieve → reduce num_queries, disable multi-query, or lower vector_top_k. Slow rewrite → disable query rewriting. Slow synthesize → LLM latency.

No queries recorded yet.

📋 لاگ دائمی پرسش‌ها (پایگاه داده جدا — برای تنظیم دقیق RAG)

همه پرسش‌های ChatUI و داشبورد با اطلاعات کاربر، پارامترهای RAG، متن ارسالی به LLM و پاسخ نهایی نمایش‌داده‌شده ذخیره می‌شوند. برای ثبت نام/ایمیل کاربر ChatUI، ENABLE_FORWARD_USER_INFO_HEADERS=true را در Open WebUI فعال کنید.

در حال بارگذاری...

💳 اعتبار، هدایا و پرداخت

مدیریت اعتبار کاربران ChatUI، کدهای هدیه رایگان، بسته‌های پولی، طرح‌های اشتراک (زیبال) و نرخ مصرف توکن. برای درگاه زیبال متغیرهای ZIBAL_MERCHANT و ZIBAL_CALLBACK_BASE را در docker-compose تنظیم کنید.

در حال بارگذاری…

⚙️ نرخ مصرف

👤 تنظیم دستی اعتبار

🎁 هدیه جدید (رایگان)

در popup ChatUI نمایش داده می‌شود. از <p>، <strong>، <ul>، <li> استفاده کنید.

شروع (شمسی)
پایان (شمسی)

🏷️ بسته پولی (زیبال)

شروع (شمسی)
پایان (شمسی)

📅 طرح اشتراک (زیبال)

شروع (شمسی)
پایان (شمسی)

📋 هدایا، بسته‌ها و طرح‌ها

در حال بارگذاری…

👥 کاربران و موجودی

در حال بارگذاری…

🖥️ کنترل ChatUI

مسدودسازی موقت چت، پیام‌های چندزبانه به کاربر، و یکپارچگی با Open WebUI / اپ اندروید. برای ثبت نام کاربر در لاگ‌ها: ENABLE_FORWARD_USER_INFO_HEADERS=true

🔧 حالت تعمیر / مسدودسازی ChatUI در حال بارگذاری…

وقتی فعال باشد، کاربران با مدل advanced_rag نمی‌توانند پرسش بفرستند — همانند زمان آپلود اسناد.

پیام‌های مسدودسازی هنگام آپلود اسناد

💬 یکپارچگی Open WebUI

adv-rag پرامپت، بازیابی و نمایش منابع را کنترل می‌کند — ChatUI نباید RAG یا ترجمهٔ خودش را تزریق کند.

🔄 Query rewrite cache

بازنویسی‌های LLM برای ترکیب سؤال کاربر + پرامپت بازنویسی ذخیره می‌شوند. پرسش تکراری با همان پرامپت بدون فراخوانی مجدد LLM پاسخ داده می‌شود.

➕ افزودن دستی به کش

Loading…

🧠 Local Models

Download, inspect, assign, and remove HuggingFace models stored under the persistent data volume. Changes apply without restarting the container.

⬇ Download from HuggingFace

Loading models…

⚙️ RAG Settings

📁 RAG Profiles (compare embedding / LLM stacks)

هر پروفایل تنظیمات مستقل دارد: LLM، embedding، reranker، collection در Qdrant، پرامپت‌ها و بقیه گزینه‌ها. برای مقایسه مدل embedding، پروفایل بسازید، اسناد را در collection مربوط آپلود کنید، سپس Activate کنید.

🔑 LLM Provider & API Keys

.env default:

🔌 Custom LLM API (OpenAI-like / Yarabot / Rakhshai)

⚡ vLLM server (GPU — exclusive with local HuggingFace)

When LLM or Embedding provider is vLLM, the vLLM container owns the GPU and local HuggingFace embed/reranker run on CPU. Otherwise vLLM stops and adv-rag uses the GPU.
.env:
Same folder as Settings → Download model
Must match vLLM served-model-name
Leave empty to use the model's native max from config.json. Values above the model limit are clamped on Apply.
vLLM --gpu-memory-utilization (0.40–0.95). Use ~0.92 on 6 GB for one model at a time.

Choose provider above, then fill the matching API fields. vLLM: separate GPU server with OpenAI API. Rakhshai: URL https://rakhshai.ir:2083/v1, engine iran-llm-zal. Yarabot: full completion URL + model id. OpenAI-like: base URL ending in /v1.

Merged into LLM API requests. For openai_like / DeepSeek, thinking is controlled by the master switch above and Chat UI think; reasoning_content is streamed when enabled. Do not set stream here — Open WebUI and RAG control streaming. Metadata extraction still disables thinking.
Example: DeepSeek / reasoning APIs
{
  "thinking": {"type": "enabled"},
  "reasoning_effort": "high",
  "max_tokens": 8192
}

📑 Metadata extraction & KB build GPU

All settings are stored in this profile (not .env). With Sequential GPU, KB upload loads the metadata chat model first, then swaps to the embedding model — one vLLM model on GPU at a time.

برای متادیتای دقیق‌تر فارسی: Qwen2.5-7B-Instruct-AWQ (نیاز ~۸ گیگ VRAM) یا Qwen2.5-3B-Instruct-AWQ روی ~۶ گیگ. مدل ۳B اغلب فارسی را «ar» اشتباه می‌گیرد؛ با ۷B+ یا «Metadata language hint = fa» بهتر می‌شود.

معمولاً همان مسیر مدل بالا. اگر با مسیر فرق دارد، هنگام بارگذاری پروفایل خودکار هم‌گام می‌شود.

خالی = خودکار (۷B روی ~۶ گیگ VRAM → ۴۰۹۶). اگر خالی بگذارید و vLLM OOM بدهد، اینجا ۴۰۹۶ یا ۸۱۹۲ بگذارید.

سقف پروفایل — خودکار به اندازهٔ context مدل (مثلاً ~۵۹۰۰ برای ۸۱۹۲ توکن) کوتاه می‌شود. ۵۰۰۰۰+ باعث context_too_long می‌شود.

وقتی تیک برداشته شود، استخراج متادیتا از همان تنظیمات «LLM Provider» (OpenAI، OpenAI-like، Yarabot، Rakhshai، …) استفاده می‌کند. مدل اختصاصی vLLM متادیتا (در صورت تنظیم) همچنان اولویت دارد.

حداکثر منابع بعد از فیلتر relevance
منابع زیر این آستانه (بعد از rerank) به LLM فرستاده نمی‌شوند. پیشنهاد: ۲۵–۳۵
Previous Q&A turns passed to LLM (0 = off)
Surrounding sentences per chunk (re-upload to apply)
Repeat document title / author / section in every chunk — book & catalog chunks stay findable by major title or author (re-upload to apply)

🧩 Semantic chunking

Used when Upload tab strategy is Semantic. Same embedding model as indexing should split boundaries. Re-upload after changes.
Lower → more/smaller chunks. Higher → fewer/larger chunks.
Sentences grouped per similarity check (2–3 smoother for FA/AR).
0 = auto. Use 1 on tight GPU VRAM.
Chunks shorter than this merge into a neighbor (0 = off). Kills tiny citation-only chunks.

🔍 Retrieval engine (live from /status)

Loading retrieval status…

BM25 برای فارسی/عربی: بدون stemmer انگلیسی، نرمال‌سازی ی/ي و ک/ك، stopword فارسی/عربی. راهنمای کامل: readme/PERSIAN_BM25.md

متغیرهای پویا (از انتخاب زبان ترجمه در ai-chatui پر می‌شوند): {LANG} نام فارسی زبان پاسخ، {LANG_CODE} کد locale (مثل fa-TJ)، {LANG_INSTRUCTION} دستور ترجمه به همان زبان.
مثال: «پاسخ را فقط به {LANG} بنویس و در صورت نیاز کل متن را به {LANG} ترجمه کن.»

Cross-encoder / reranker models only — not for embeddings. Full download/delete/assign controls: 🧠 مدل‌ها tab.

🔧 Query Engineering

Rewrites are cached by user query + rewrite prompt in the 🔄 کش بازنویسی tab — duplicate queries skip the LLM.
از {query} به‌عنوان جایگزین متن سؤال کاربر استفاده کنید.

🧭 Content-Type Routing (agentic tool selection)

Tag special files first via the collections tab («🏷 Set content type»). Untagged files count as general. Selections are cached per query — repeated queries add no LLM cost.
The description tells the LLM when to pick that tool. IDs must be latin (poem, book_catalog, …).
Route used when the LLM is unsure or fails (normally general).
Changing provider or model requires re-uploading all documents (vectors become incompatible).
.env defaults — Provider: - | Model: -

🧬 BGE-M3 hybrid (dense + sparse)

Optional Phase 1: stores BGE-M3 lexical sparse vectors in Qdrant alongside dense vectors. Requires HuggingFace provider + BAAI/bge-m3. Use a dedicated collection (e.g. docs-1024-bge-hybrid) and re-upload. vLLM embed API cannot produce sparse vectors. When disabled, existing dense-only + BM25 pipeline is unchanged.

🎯 BGE-M3 ColBERT (late interaction)

Optional Phase 2: stores BGE-M3 ColBERT token multivectors in Qdrant (bge-m3-colbert) and reranks with MaxSim. Dense prefetch + ColBERT scoring. Requires HuggingFace + BAAI/bge-m3. Use a dedicated collection (e.g. docs-1024-bge-colbert) and re-upload. Can combine with hybrid sparse above.
Qdrant caps vector payload at ~255 tokens (1024-dim). head_tail balances intro + conclusion. multi_point stores all segments but uses more disk and slower indexing.
When disabled, ColBERT vectors are not stored or queried.

🥐 RAGatouille (ColBERT index)

Optional standalone ColBERT index on disk — no Qdrant 1 MiB token limit. Default: colbert-ir/colbertv2.0 (English). For Persian/Arabic, use jinaai/jina-colbert-v2 (download via Models tab first). Qdrant dense/BM25 indexing still runs; retrieval uses RAGatouille when enabled (takes priority over Qdrant ColBERT). Requires optional pip deps — see requirements.txt.
Default 512 — beats Qdrant BGE-M3 ColBERT (~255 tokens / 1 MiB point limit). Dense BGE-M3 in Qdrant is separate (8192 tokens).
Index stored under /app/data/ragatouille_registry.json + ColBERT index files. Re-upload after enabling.

📤 Upload Limits

Controls the dashboard upload tab. .env defaults: files, MB per file.
Single request limit (1–500)
Per-file size limit (1–1000 MB)

📁 مدیریت مجموعه‌های Qdrant

Browse uploaded files, inspect chunks, filter, and delete vectors per file or per chunk. Click Load collections to fetch data — nothing loads automatically when you open this tab.

Uploaded files

Upload date Display name Chunks Type Content type
Click «Load collections» to fetch data from Qdrant.

Chunks

File Preview Strategy
Click a file row to view its chunks.

🐳 لاگ کانتینرها (فقط برای دیباگ — بدون استریم زنده)

با کلیک روی «دریافت لاگ» آخرین خطوط stdout/stderr از Docker خوانده می‌شود. برای مشاهده لاگ‌های قدیمی‌تر، تعداد خط را افزایش دهید (حداکثر ۱۰۰٬۰۰۰).

روی «دریافت لاگ» کلیک کنید.

📈 تست بار Locust (استریم /v1/chat/completions)

شبیه‌سازی کاربران همزمان با خواندن کامل پاسخ استریم‌شده (نه فقط ارسال درخواست). هدف پیش‌فرض http://127.0.0.1:8000 داخل همین کانتینر است. مدت را بیشتر از زمان تقریبی یک پاسخ بگذارید (مثلاً ۱۸۰ثانیه). از کاربران کم (۵→۸→۱۲) شروع کنید. موتور RAG باید سبز/آماده باشد؛ وگرنه شروع مسدود می‌شود.

آماده.
Name # Fail% Median (s) p95 (s) Avg (s) RPS
هنوز آماری نیست.
لاگ Locust