mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-03 21:49:57 +08:00
A broad consolidation release across four product surfaces. - Learning Space: Space becomes a learning dashboard; My Agents imports local Claude Code / Codex chat history into resumable agents (with an objective explore_context briefing so the tutor never role-plays the user); Memory is promoted to a top-level /memory route; Partner conversations flow into Memory; EduHub skills install inline. - Knowledge Center: /knowledge rebuilt as a console with per-engine detail pages; GraphRAG / PageIndex / LightRAG engines join LlamaIndex; linked-KB read-only mounts; Obsidian live-vault capability. - Settings: pluggable document parsing (MinerU / Docling / MarkItDown) with a content-addressed cache and MinerU cloud/local backends; voice TTS/STT; image & video generation; rebuilt settings navigation. - Platform: per-user capability gating by assigned model; Solve rebuilt on the chat loop with a per-step gate and mid-run failure fallback; username login + inline errors; CLI skill publish/update; picker polish; math-before-citation render fix. Docs were split out to a standalone site, so site/ is now landing-page only. Bumps __version__ to 1.4.6 and adds assets/releases/ver1-4-6.md. Folds in mypy fixes surfaced by pre-commit (mineru/local Path typing, knowledge/manager no-redef, explore_context token kwargs, CLI set_dist_tag capability probe) plus prettier reformatting of previously-committed web files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
71 lines
2.6 KiB
Python
71 lines
2.6 KiB
Python
"""GraphRAG + LightRAG engine knobs stored in RuntimeSettingsService."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from deeptutor.services.config.runtime_settings import RuntimeSettingsService
|
|
|
|
|
|
def test_graphrag_defaults_and_clamp(tmp_path: Path) -> None:
|
|
svc = RuntimeSettingsService(tmp_path, process_env={})
|
|
defaults = svc.load_graphrag()
|
|
assert defaults["response_type"] == "Multiple Paragraphs"
|
|
assert defaults["community_level"] == 2
|
|
assert defaults["dynamic_community_selection"] is False
|
|
|
|
saved = svc.save_graphrag(
|
|
{
|
|
"community_level": 99,
|
|
"dynamic_community_selection": "yes",
|
|
"response_type": " Single Paragraph ",
|
|
}
|
|
)
|
|
assert saved["community_level"] == 5 # clamped to max
|
|
assert saved["dynamic_community_selection"] is True
|
|
assert saved["response_type"] == "Single Paragraph"
|
|
assert (tmp_path / "graphrag.json").exists()
|
|
|
|
|
|
def test_lightrag_defaults_and_clamp(tmp_path: Path) -> None:
|
|
svc = RuntimeSettingsService(tmp_path, process_env={})
|
|
defaults = svc.load_lightrag()
|
|
assert defaults["top_k"] == 60
|
|
assert defaults["response_type"] == "Multiple Paragraphs"
|
|
|
|
saved = svc.save_lightrag({"top_k": 9999})
|
|
assert saved["top_k"] == 200 # clamped to max
|
|
assert (tmp_path / "lightrag.json").exists()
|
|
|
|
floored = svc.save_lightrag({"top_k": 0})
|
|
assert floored["top_k"] == 1 # clamped to min
|
|
|
|
|
|
def test_response_type_capped(tmp_path: Path) -> None:
|
|
svc = RuntimeSettingsService(tmp_path, process_env={})
|
|
saved = svc.save_graphrag({"response_type": "x" * 500})
|
|
assert len(saved["response_type"]) == 80
|
|
|
|
|
|
def test_preflight_shape_for_all_engines() -> None:
|
|
from deeptutor.services.rag.preflight import engine_preflight
|
|
|
|
for provider in ("llamaindex", "pageindex", "graphrag", "lightrag"):
|
|
report = engine_preflight(provider)
|
|
assert set(report) == {"ok", "checks"}
|
|
assert isinstance(report["ok"], bool)
|
|
assert report["checks"], f"{provider} should report at least one check"
|
|
for check in report["checks"]:
|
|
assert set(check) == {"key", "label", "ok", "detail", "optional"}
|
|
# Overall ok ignores optional checks.
|
|
required_ok = all(c["ok"] for c in report["checks"] if not c["optional"])
|
|
assert report["ok"] == required_ok
|
|
|
|
|
|
def test_preflight_unknown_provider_falls_back_to_default() -> None:
|
|
from deeptutor.services.rag.preflight import engine_preflight
|
|
|
|
# Unknown providers normalize to the default (llamaindex) engine.
|
|
report = engine_preflight("does-not-exist")
|
|
assert any(c["key"] == "embedding" for c in report["checks"])
|