Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: rag clean-up

Bingxi Zhao (Frank)0f21d9c4e870
diff --git a/deeptutor/services/rag/components/routing.py b/deeptutor/services/rag/components/routing.py
index 807cae7d2..024770c61 100644
--- a/deeptutor/services/rag/components/routing.py
+++ b/deeptutor/services/rag/components/routing.py
@@ -290,7 +290,7 @@ class FileTypeRouter:
"""
# Only llamaindex is supported; keep provider param for forward compatibility.
if provider and provider != "llamaindex":
- logger.warning("Unknown/legacy provider '%s', using llamaindex extension set", provider)
+ logger.warning(f"Unknown/legacy provider '{provider}', using llamaindex extension set")
return cls.PARSER_EXTENSIONS | cls.TEXT_EXTENSIONS
@classmethod
diff --git a/requirements.txt b/requirements.txt
index 900410d28..6c6648734 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,13 +6,13 @@
# For lighter installs, use the layered requirements:
# pip install -r requirements/core.txt # CLI only (~80MB)
# pip install -r requirements/server.txt # + API server
-# pip install -r requirements/rag-lite.txt # + lightweight RAG
-# pip install -r requirements/rag-full.txt # + all RAG providers
+# pip install -r requirements/rag-lite.txt # + LlamaIndex RAG
+# pip install -r requirements/rag-full.txt # compatibility alias of rag-lite
# pip install -r requirements/providers.txt # + native LLM SDKs
# pip install -r requirements/dev.txt # + dev/test tools
-r requirements/server.txt
--r requirements/rag-full.txt
+-r requirements/rag-lite.txt
-r requirements/providers.txt
# ============================================
diff --git a/requirements/dev.txt b/requirements/dev.txt
index c474d6a35..f3f0e56ed 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -4,7 +4,7 @@
# Install: pip install -r requirements/dev.txt
-r server.txt
--r rag-full.txt
+-r rag-lite.txt
-r providers.txt
pytest>=7.0.0
diff --git a/requirements/providers.txt b/requirements/providers.txt
index 656683283..d7f38a594 100644
--- a/requirements/providers.txt
+++ b/requirements/providers.txt
@@ -2,7 +2,8 @@
# DeepTutor Optional LLM Provider SDKs
# ============================================
# Install: pip install -r requirements/providers.txt
-# Only needed if using native SDKs instead of OpenAI-compatible endpoints
+# Optional add-on layer for native provider SDKs.
+# Skip this if you only use OpenAI-compatible endpoints.
anthropic>=0.30.0
dashscope>=1.14.0
diff --git a/requirements/rag-full.txt b/requirements/rag-full.txt
index 245f8eb75..96ac3e19d 100644
--- a/requirements/rag-full.txt
+++ b/requirements/rag-full.txt
@@ -2,6 +2,6 @@
# DeepTutor Full RAG Dependencies
# ============================================
# Install: pip install -r requirements/rag-full.txt
-# Compatibility alias for rag-lite (llamaindex-only)
+# Compatibility alias for rag-lite (llamaindex-only add-on layer).
-r rag-lite.txt
diff --git a/requirements/rag-lite.txt b/requirements/rag-lite.txt
index 8b1bbc05e..73a8bfa4b 100644
--- a/requirements/rag-lite.txt
+++ b/requirements/rag-lite.txt
@@ -2,7 +2,8 @@
# DeepTutor Lightweight RAG Dependencies
# ============================================
# Install: pip install -r requirements/rag-lite.txt
-# LlamaIndex-only RAG pipeline + PDF parsing
+# Add-on layer for LlamaIndex-only RAG + PDF parsing.
+# Use with core/server (e.g., `core + rag-lite` or `server + rag-lite`).
llama-index>=0.14.12
PyMuPDF>=1.26.0
diff --git a/scripts/start_tour.py b/scripts/start_tour.py
index b7edadb58..0aafe12d7 100644
--- a/scripts/start_tour.py
+++ b/scripts/start_tour.py
@@ -85,13 +85,17 @@ def _load_runtime_deps():
PROFILE_COMMANDS: dict[str, list[str]] = {
"cli-core": ["requirements/core.txt"],
- "cli-rag-lite": ["requirements/core.txt", "requirements/rag-lite.txt"],
- # Backward-compatible alias; keep accepted but hidden from UI choices.
- "cli-rag-full": ["requirements/core.txt", "requirements/rag-lite.txt"],
+ "cli-rag": ["requirements/core.txt", "requirements/rag-lite.txt"],
"web-basic": ["requirements/server.txt"],
- "web-rag-lite": ["requirements/server.txt", "requirements/rag-lite.txt"],
- # Backward-compatible alias; keep accepted but hidden from UI choices.
- "web-rag-full": ["requirements/server.txt", "requirements/rag-lite.txt"],
+ "web-rag": ["requirements/server.txt", "requirements/rag-lite.txt"],
+}
+
+# Legacy aliases kept for backward compatibility (hidden from UI).
+PROFILE_ALIASES: dict[str, str] = {
+ "cli-rag-lite": "cli-rag",
+ "cli-rag-full": "cli-rag",
+ "web-rag-lite": "web-rag",
+ "web-rag-full": "web-rag",
}
CACHE_PATH = PROJECT_ROOT / "data" / "user" / "settings" / ".tour_cache.json"
@@ -185,6 +189,10 @@ def _needs_providers(catalog: dict[str, Any]) -> bool:
# ---------------------------------------------------------------------------
def _install_commands(profile: str, catalog: dict[str, Any]) -> list[tuple[list[str], Path]]:
+ profile = PROFILE_ALIASES.get(profile, profile)
+ if profile not in PROFILE_COMMANDS:
+ raise ValueError(f"Unknown install profile: {profile}")
+
cmds: list[tuple[list[str], Path]] = []
for req in PROFILE_COMMANDS[profile]:
cmds.append(([sys.executable, "-m", "pip", "install", "-r", req], PROJECT_ROOT))
@@ -406,7 +414,7 @@ def _run_web_tour() -> None:
"Choose a dependency profile",
[
("web-basic", "web-basic", "FastAPI + Next.js"),
- ("web-rag-lite", "web-rag-lite", "+ LlamaIndex RAG"),
+ ("web-rag", "web-rag", "+ LlamaIndex RAG"),
],
)
_save_cache({"step": 1, "mode": "web", "profile": profile, "status": "running"})
@@ -543,7 +551,7 @@ def _run_cli_tour() -> None:
"Choose a dependency profile",
[
("cli-core", "cli-core", "Minimal CLI (~80 MB)"),
- ("cli-rag-lite", "cli-rag-lite", "+ LlamaIndex RAG"),
+ ("cli-rag", "cli-rag", "+ LlamaIndex RAG"),
],
)
_save_cache({"step": 1, "mode": "cli", "profile": profile})