DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
Merge dev into PR #1665 and preserve integrated behavior
Bingxi Zhao (Frank)895c41999cb7
diff --cc deeptutor/reading/captions.pyindex 7cfc3222f,17f18053b..7174f402a--- a/deeptutor/reading/captions.py+++ b/deeptutor/reading/captions.py@@@ -22,8 -22,7 +22,8 @@@ from typing import Anfrom deeptutor.reading.store import ReadingStorefrom deeptutor.services.config.runtime_settings import load_document_parsing_settings- from deeptutor.services.llm.client import get_llm_client+from deeptutor.services.llm.image_caption_cache import complete_image_caption+ from deeptutor.services.llm.image_description import get_image_description_clientfrom deeptutor.services.rag.pipelines.llamaindex.config import image_description_limitslogger = logging.getLogger(__name__)diff --cc deeptutor/services/rag/pipelines/llamaindex/document_loader.pyindex 541c4c8b1,11db7fc04..488ff50d6--- a/deeptutor/services/rag/pipelines/llamaindex/document_loader.py+++ b/deeptutor/services/rag/pipelines/llamaindex/document_loader.py@@@ -24,8 -24,7 +24,8 @@@ from llama_index.core.schema import Imafrom deeptutor.services.config.runtime_settings import DOCUMENT_PARSING_ENGINE_LITEPARSEfrom deeptutor.services.embedding import get_embedding_client- from deeptutor.services.llm.client import get_llm_client+from deeptutor.services.llm.image_caption_cache import complete_image_caption+ from deeptutor.services.llm.image_description import get_image_description_clientfrom deeptutor.services.rag.file_routing import FileTypeRouterfrom deeptutor.services.rag.visual_assets import VisualAssetCandidate, collect_visual_assetsfrom deeptutor.utils.document_validator import DocumentValidatordiff --cc tests/reading/test_reading_captions.pyindex d32f3efb9,f8dadf7b8..8e809aee7--- a/tests/reading/test_reading_captions.py+++ b/tests/reading/test_reading_captions.py@@@ -100,32 -100,6 +100,32 @@@ async def test_existing_captions_are_skassert stub.calls == []+async def test_missing_captions_reuse_cache_but_force_refreshes(store, monkeypatch, tmp_path):+ from types import SimpleNamespace++ from deeptutor.services.llm import image_caption_cache+ from deeptutor.services.llm.config import LLMConfig++ stub = _StubClient()+ stub.config = LLMConfig(model="vision-test", api_key="test-key")- monkeypatch.setattr(captions_module, "get_llm_client", lambda: stub)++ monkeypatch.setattr(captions_module, "get_image_description_client", lambda: stub)+ monkeypatch.setattr(+ image_caption_cache,+ "get_path_service",+ lambda: SimpleNamespace(get_parse_cache_root=lambda: tmp_path / "cache"),+ )+ rows = store.media_items(_MATERIAL_ID)+ index = tmp_path / "reading" / _MATERIAL_ID / "media.json"+ assert await captions_module.caption_material_media(_MATERIAL_ID, store=store) == 3+ index.write_text(json.dumps(rows)) # Retry ingest with the same source images.+ assert await captions_module.caption_material_media(_MATERIAL_ID, store=store) == 3+ assert len(stub.calls) == 3+ # The stub returns identical text, so the store reports no changed rows.+ assert await captions_module.caption_material_media(_MATERIAL_ID, store=store, force=True) == 0+ assert len(stub.calls) == 6++@pytest.mark.asyncioasync def test_single_failure_keeps_the_rest(store: ReadingStore, monkeypatch: pytest.MonkeyPatch