Skip to content

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

fix(rag): parallelize image descriptions in the LlamaIndex RAG pipeline with timeout and progress (#933)

LamXwah965885b7605b
diff --git a/deeptutor/api/routers/knowledge.py b/deeptutor/api/routers/knowledge.py
index 8db846287..1a968b058 100644
--- a/deeptutor/api/routers/knowledge.py
+++ b/deeptutor/api/routers/knowledge.py
@@ -1293,6 +1293,8 @@ class LlamaIndexConfigUpdate(BaseModel):
bm25_top_k_multiplier: int | None = None
chunk_size: int | None = None
chunk_overlap: int | None = None
+ image_description_concurrency: int | None = None
+ image_description_timeout_seconds: int | None = None
@router.get("/rag-pipelines/llamaindex/config")
@@ -1311,8 +1313,8 @@ async def get_llamaindex_pipeline_config():
async def update_llamaindex_pipeline_config(payload: LlamaIndexConfigUpdate):
"""Persist the LlamaIndex engine knobs.
- Retrieval knobs take effect on the next query; chunk geometry only changes
- how documents indexed *after* the save are split.
+ Retrieval knobs take effect on the next query; indexing knobs only affect
+ documents processed after the save.
"""
try:
from deeptutor.services.config import get_runtime_settings_service
diff --git a/deeptutor/knowledge/initializer.py b/deeptutor/knowledge/initializer.py
index 6740eeca6..feddc126a 100644
--- a/deeptutor/knowledge/initializer.py
+++ b/deeptutor/knowledge/initializer.py
@@ -187,11 +187,20 @@ class KnowledgeBaseInitializer:
total=total_batches,
)
+ def _on_image_progress(current: int, total: int):
+ self.progress_tracker.update(
+ ProgressStage.PROCESSING_DOCUMENTS,
+ f"Describing images: {current}/{total}",
+ current=current,
+ total=total,
+ )
+
try:
success = await rag_service.initialize(
kb_name=self.kb_name,
file_paths=file_paths,
progress_callback=_on_progress,
+ image_progress_callback=_on_image_progress,
)
if not success:
self.progress_tracker.update(
diff --git a/deeptutor/services/config/runtime_settings.py b/deeptutor/services/config/runtime_settings.py
index 9148feca1..f11bf9dca 100644
--- a/deeptutor/services/config/runtime_settings.py
+++ b/deeptutor/services/config/runtime_settings.py
@@ -253,6 +253,8 @@ DEFAULT_IMA_SETTINGS: dict[str, Any] = {
# candidates each child retriever fetches before fusion re-ranks to ``top_k``.
# * ``chunk_size`` / ``chunk_overlap`` — indexing chunk geometry; changes apply
# on the next (re-)index, not retroactively.
+# * ``image_description_concurrency`` / ``image_description_timeout_seconds`` —
+# bounded multimodal LLM work while indexing image-heavy documents.
#
# ``fusion_num_queries`` is intentionally NOT exposed: query generation needs a
# real LLM, but the fusion retriever runs on a MockLLM, so any value > 1 would
@@ -269,6 +271,8 @@ DEFAULT_LLAMAINDEX_SETTINGS: dict[str, Any] = {
"bm25_top_k_multiplier": 2,
"chunk_size": 512,
"chunk_overlap": 50,
+ "image_description_concurrency": 4,
+ "image_description_timeout_seconds": 60,
}
# GraphRAG retrieval knobs (microsoft/graphrag). Only query-time params that the
@@ -821,6 +825,12 @@ class RuntimeSettingsService:
),
"chunk_size": chunk_size,
"chunk_overlap": chunk_overlap,
+ "image_description_concurrency": _coerce_clamped_int(
+ settings.get("image_description_concurrency"), 4, 1, 16
+ ),
+ "image_description_timeout_seconds": _coerce_clamped_int(
+ settings.get("image_description_timeout_seconds"), 60, 5, 600
+ ),
}
def _normalize_response_type(self, value: Any) -> str:
diff --git a/deeptutor/services/rag/pipelines/llamaindex/config.py b/deeptutor/services/rag/pipelines/llamaindex/config.py
index 785916e97..9144dd4e0 100644
--- a/deeptutor/services/rag/pipelines/llamaindex/config.py
+++ b/deeptutor/services/rag/pipelines/llamaindex/config.py
@@ -95,6 +95,17 @@ def chunk_geometry() -> tuple[int, int]:
return 512, 50
+def image_description_limits() -> tuple[int, float]:
+ """Return the configured vision-call concurrency and per-image timeout."""
+ try:
+ settings = _load_runtime_settings()
+ concurrency = int(settings.get("image_description_concurrency", 4) or 4)
+ timeout_seconds = float(settings.get("image_description_timeout_seconds", 60) or 60)
+ return min(16, max(1, concurrency)), min(600.0, max(5.0, timeout_seconds))
+ except Exception:
+ return 4, 60.0
+
+
__all__ = [
"HYBRID_PROFILE",
"RetrievalConfig",
@@ -102,6 +113,7 @@ __all__ = [
"VECTOR_PROFILE",
"chunk_geometry",
"default_top_k",
+ "image_description_limits",
"normalize_retrieval_profile",
"retrieval_config_from_env",
"retrieval_config_from_settings",
diff --git a/deeptutor/services/rag/pipelines/llamaindex/document_loader.py b/deeptutor/services/rag/pipelines/llamaindex/document_loader.py
index d4809900b..d81ed12b7 100644
--- a/deeptutor/services/rag/pipelines/llamaindex/document_loader.py
+++ b/deeptutor/services/rag/pipelines/llamaindex/document_loader.py
@@ -17,7 +17,7 @@ from dataclasses import dataclass
import logging
import mimetypes
from pathlib import Path
-from typing import Any, Iterable
+from typing import Any, Callable, Iterable
from llama_index.core import Document
from llama_index.core.schema import ImageNode
@@ -27,6 +27,8 @@ from deeptutor.services.llm.client import get_llm_client
from deeptutor.services.rag.file_routing import FileTypeRouter
from deeptutor.utils.document_validator import DocumentValidator
+from .config import image_description_limits
+
IMAGE_DESCRIPTION_SYSTEM_PROMPT = (
"You describe images for a retrieval-augmented knowledge base. "
"Be factual, concise, and include any visible text, labels, diagrams, "
@@ -60,7 +62,11 @@ class LlamaIndexDocumentLoader:
def __init__(self, logger=None) -> None:
self.logger = logger or logging.getLogger(__name__)
- async def load(self, file_paths: Iterable[str]) -> list[Any]:
+ async def load(
+ self,
+ file_paths: Iterable[str],
+ image_progress_callback: Callable[[int, int], None] | None = None,
+ ) -> list[Any]:
documents: list[Any] = []
image_sources: list[_ImageSource] = []
classification = FileTypeRouter.classify_files(list(file_paths))
@@ -87,7 +93,11 @@ class LlamaIndexDocumentLoader:
image_sources.append(_ImageSource(path=path, origin=path))
if image_sources:
- documents.extend(await self._load_image_nodes(image_sources))
+ documents.extend(
+ await self._load_image_nodes(
+ image_sources, image_progress_callback=image_progress_callback
+ )
+ )
for file_path_str in classification.unsupported:
self.logger.warning(f"Skipped unsupported file: {Path(file_path_str).name}")
@@ -149,7 +159,12 @@ class LlamaIndexDocumentLoader:
)
return images
- async def _load_image_nodes(self, sources: list[_ImageSource]) -> list[ImageNode]:
+ async def _load_image_nodes(
+ self,
+ sources: list[_ImageSource],
+ *,
+ image_progress_callback: Callable[[int, int], None] | None = None,
+ ) -> list[ImageNode]:
try:
embedding_client = get_embedding_client()
except Exception as exc:
@@ -182,36 +197,77 @@ class LlamaIndexDocumentLoader:
embedded: list[_ImageSource] = []
descriptions: list[str] = []
- contents = []
- for source in sources:
+ contents: list[dict[str, str]] = []
+ completed = 0
+ total = len(sources)
+ concurrency, timeout_seconds = image_description_limits()
+ semaphore = asyncio.Semaphore(concurrency)
+
+ async def _describe_one(
+ source: _ImageSource,
+ ) -> tuple[_ImageSource, str, dict[str, str]] | None:
+ nonlocal completed
+ result: tuple[_ImageSource, str, dict[str, str]] | None = None
try:
- image_payload = self._load_image_payload(source.path)
- description = await self._describe_image(
- llm_client,
- source.path,
- image_payload["base64"],
- image_payload["mimetype"],
- )
- if not description:
- self.logger.warning(
- "Skipped image because the configured multimodal LLM "
- f"returned no description: {source.path.name}"
+ try:
+ async with semaphore:
+ image_payload = self._load_image_payload(source.path)
+ description = await asyncio.wait_for(
+ self._describe_image(
+ llm_client,
+ source.path,
+ image_payload["base64"],
+ image_payload["mimetype"],
+ ),
+ timeout=timeout_seconds,
+ )
+ except asyncio.TimeoutError:
+ self.logger.error(
+ "Image description timed out after %ss: %s",
+ timeout_seconds,
+ source.path.name,
)
- continue
- contents.append({"image": image_payload["data_uri"]})
- embedded.append(source)
- descriptions.append(description)
- except OSError as exc:
- self.logger.error(f"Failed to read image {source.path.name}: {exc}")
- except Exception as exc:
- self.logger.error(
- "Failed to describe image %s with configured multimodal LLM "
- "(binding=%s, model=%s): %s",
- source.path.name,
- llm_client.config.binding,
- llm_client.config.model,
- exc,
- )
+ except OSError as exc:
+ self.logger.error(f"Failed to read image {source.path.name}: {exc}")
+ except Exception as exc:
+ self.logger.error(
+ "Failed to describe image %s with configured multimodal LLM "
+ "(binding=%s, model=%s): %s",
+ source.path.name,
+ llm_client.config.binding,
+ llm_client.config.model,
+ exc,
+ )
+ else:
+ if not description:
+ self.logger.warning(
+ "Skipped image because the configured multimodal LLM "
+ f"returned no description: {source.path.name}"
+ )
+ else:
+ result = (
+ source,
+ description,
+ {"image": image_payload["data_uri"]},
+ )
+ finally:
+ completed += 1
+ if image_progress_callback:
+ try:
+ image_progress_callback(completed, total)
+ except Exception:
+ pass
+ return result
+
+ # gather preserves input order, so embedded/descriptions/contents stay
+ # aligned regardless of completion order.
+ results = await asyncio.gather(*(_describe_one(source) for source in sources))
+ for result in results:
+ if result is None:
+ continue
+ embedded.append(result[0])
+ descriptions.append(result[1])
+ contents.append(result[2])
if not contents:
return []
diff --git a/deeptutor/services/rag/pipelines/llamaindex/pipeline.py b/deeptutor/services/rag/pipelines/llamaindex/pipeline.py
index 193206226..ec16ac718 100644
--- a/deeptutor/services/rag/pipelines/llamaindex/pipeline.py
+++ b/deeptutor/services/rag/pipelines/llamaindex/pipeline.py
@@ -74,6 +74,7 @@ class LlamaIndexPipeline:
async def initialize(self, kb_name: str, file_paths: List[str], **kwargs) -> bool:
progress_callback = kwargs.get("progress_callback")
+ image_progress_callback = kwargs.get("image_progress_callback")
self._configure_settings()
self.logger.info(
@@ -86,7 +87,9 @@ class LlamaIndexPipeline:
try:
await self._verify_embedding_connectivity()
- documents = await self.document_loader.load(file_paths)
+ documents = await self.document_loader.load(
+ file_paths, image_progress_callback=image_progress_callback
+ )
if not documents:
self.logger.error("No valid documents found")
return False
@@ -224,6 +227,7 @@ class LlamaIndexPipeline:
async def add_documents(self, kb_name: str, file_paths: List[str], **kwargs) -> bool:
progress_callback = kwargs.get("progress_callback")
+ image_progress_callback = kwargs.get("image_progress_callback")
self._configure_settings()
self.logger.info(f"Adding {len(file_paths)} documents to KB '{kb_name}' using LlamaIndex")
@@ -237,7 +241,9 @@ class LlamaIndexPipeline:
if progress_callback:
set_progress_callback(progress_callback)
- documents = await self.document_loader.load(file_paths)
+ documents = await self.document_loader.load(
+ file_paths, image_progress_callback=image_progress_callback
+ )
if not documents:
self.logger.warning("No valid documents to add")
return False
diff --git a/tests/services/config/test_llamaindex_settings.py b/tests/services/config/test_llamaindex_settings.py
index c6e9253b2..93342128b 100644
--- a/tests/services/config/test_llamaindex_settings.py
+++ b/tests/services/config/test_llamaindex_settings.py
@@ -16,12 +16,21 @@ def test_llamaindex_defaults_when_absent(tmp_path: Path) -> None:
assert loaded["bm25_top_k_multiplier"] == 2
assert loaded["chunk_size"] == 512
assert loaded["chunk_overlap"] == 50
+ assert loaded["image_description_concurrency"] == 4
+ assert loaded["image_description_timeout_seconds"] == 60
def test_llamaindex_roundtrip(tmp_path: Path) -> None:
svc = RuntimeSettingsService(tmp_path, process_env={})
svc.save_llamaindex(
- {"retrieval_profile": "vector", "top_k": 8, "chunk_size": 1024, "chunk_overlap": 0}
+ {
+ "retrieval_profile": "vector",
+ "top_k": 8,
+ "chunk_size": 1024,
+ "chunk_overlap": 0,
+ "image_description_concurrency": 8,
+ "image_description_timeout_seconds": 120,
+ }
)
loaded = svc.load_llamaindex(include_process_overrides=False)
@@ -29,6 +38,8 @@ def test_llamaindex_roundtrip(tmp_path: Path) -> None:
assert loaded["top_k"] == 8
assert loaded["chunk_size"] == 1024
assert loaded["chunk_overlap"] == 0
+ assert loaded["image_description_concurrency"] == 8
+ assert loaded["image_description_timeout_seconds"] == 120
# Its own file beside the other per-feature settings.
assert (tmp_path / "llamaindex.json").exists()
@@ -42,6 +53,8 @@ def test_llamaindex_clamps_out_of_range(tmp_path: Path) -> None:
"bm25_top_k_multiplier": 0,
"chunk_size": 8,
"chunk_overlap": 99999,
+ "image_description_concurrency": 999,
+ "image_description_timeout_seconds": 0,
}
)
loaded = svc.load_llamaindex(include_process_overrides=False)
@@ -52,6 +65,8 @@ def test_llamaindex_clamps_out_of_range(tmp_path: Path) -> None:
assert loaded["chunk_size"] == 64
# Overlap is clamped below the chunk size so chunking never degenerates.
assert loaded["chunk_overlap"] == 63
+ assert loaded["image_description_concurrency"] == 16
+ assert loaded["image_description_timeout_seconds"] == 5
def test_llamaindex_profile_env_override(tmp_path: Path) -> None:
@@ -73,3 +88,18 @@ def test_chunk_geometry_preserves_zero_overlap(monkeypatch) -> None:
)
assert config.chunk_geometry() == (512, 0)
+
+
+def test_image_description_limits_use_runtime_settings(monkeypatch) -> None:
+ from deeptutor.services.rag.pipelines.llamaindex import config
+
+ monkeypatch.setattr(
+ config,
+ "_load_runtime_settings",
+ lambda: {
+ "image_description_concurrency": 7,
+ "image_description_timeout_seconds": 90,
+ },
+ )
+
+ assert config.image_description_limits() == (7, 90.0)
diff --git a/tests/services/rag/test_llamaindex_image_description.py b/tests/services/rag/test_llamaindex_image_description.py
new file mode 100644
index 000000000..9b99100fc
--- /dev/null
+++ b/tests/services/rag/test_llamaindex_image_description.py
@@ -0,0 +1,153 @@
+"""Concurrency, per-image timeout, and progress for image description.
+
+``_load_image_nodes`` describes each extracted image with the configured
+multimodal LLM. With ~92 images per KB this is the slowest indexing step, so it
+now fans out (bounded by a Semaphore), enforces a per-image timeout, and
+reports progress via ``image_progress_callback``. These tests pin that behavior.
+"""
+
+from __future__ import annotations
+
+import asyncio
+from pathlib import Path
+import time
+
+import pytest
+
+
+def _make_images(tmp_path: Path, names: list[str]) -> list[Path]:
+ paths: list[Path] = []
+ for name in names:
+ p = tmp_path / name
+ p.write_bytes(b"\x89PNG\r\n")
+ paths.append(p)
+ return paths
+
+
+def _install_multimodal_clients(
+ monkeypatch: pytest.MonkeyPatch,
+ *,
+ complete_fn,
+ limits: tuple[int, float] = (4, 60.0),
+) -> None:
+ """Wire fake multimodal embedding + vision clients so images are described."""
+ from types import SimpleNamespace
+
+ from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
+
+ monkeypatch.setattr(loader_module, "image_description_limits", lambda: limits)
+
+ class _EmbeddingClient:
+ config = SimpleNamespace(binding="siliconflow", model="qwen3-vl")
+
+ def supports_multimodal_contents(self) -> bool:
+ return True
+
+ async def embed_contents(self, contents):
+ return [[0.1, 0.2, 0.3] for _ in contents]
+
+ class _VisionClient:
+ config = SimpleNamespace(binding="openai", model="gpt-4o")
+
+ def supports_multimodal_images(self) -> bool:
+ return True
+
+ async def complete(self, prompt, **kwargs):
+ return await complete_fn(prompt, **kwargs)
+
+ monkeypatch.setattr(loader_module, "get_embedding_client", lambda: _EmbeddingClient())
+ monkeypatch.setattr(loader_module, "get_llm_client", lambda: _VisionClient())
+
+
+async def test_image_description_runs_bounded_concurrently(tmp_path, monkeypatch):
+ pytest.importorskip("llama_index.core")
+ from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
+
+ state = {"inflight": 0, "max": 0}
+
+ async def complete(prompt, **kwargs):
+ state["inflight"] += 1
+ state["max"] = max(state["max"], state["inflight"])
+ await asyncio.sleep(0.05) # let multiple calls overlap
+ state["inflight"] -= 1
+ return "desc"
+
+ _install_multimodal_clients(monkeypatch, complete_fn=complete)
+
+ paths = _make_images(tmp_path, [f"img{i}.png" for i in range(10)])
+ docs = await loader_module.LlamaIndexDocumentLoader().load([str(p) for p in paths])
+
+ assert 2 <= state["max"] <= 4 # concurrent, but capped by the semaphore
+ assert len(docs) == 10
+
+
+async def test_image_description_per_image_timeout_skips_and_keeps_order(tmp_path, monkeypatch):
+ pytest.importorskip("llama_index.core")
+ from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
+
+ async def complete(prompt, image_filename=None, **kwargs):
+ if "slow" in (image_filename or ""):
+ await asyncio.sleep(1.0) # exceeds the 0.2s timeout -> skipped
+ return "ok"
+
+ _install_multimodal_clients(monkeypatch, complete_fn=complete, limits=(4, 0.2))
+
+ names = ["slow0.png", "fast0.png", "slow1.png", "fast1.png", "slow2.png", "fast2.png"]
+ paths = _make_images(tmp_path, names)
+
+ start = time.monotonic()
+ docs = await loader_module.LlamaIndexDocumentLoader().load([str(p) for p in paths])
+ elapsed = time.monotonic() - start
+
+ # Slow images time out and are skipped; fast ones are kept in original order.
+ assert [d.metadata["file_name"] for d in docs] == ["fast0.png", "fast1.png", "fast2.png"]
+ assert elapsed < 2.0 # did not hang
+
+
+async def test_image_description_reports_progress(tmp_path, monkeypatch):
+ pytest.importorskip("llama_index.core")
+ from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
+
+ async def complete(prompt, **kwargs):
+ return "desc"
+
+ _install_multimodal_clients(monkeypatch, complete_fn=complete)
+
+ callbacks: list[tuple[int, int]] = []
+ paths = _make_images(tmp_path, [f"img{i}.png" for i in range(5)])
+ await loader_module.LlamaIndexDocumentLoader().load(
+ [str(p) for p in paths],
+ image_progress_callback=lambda c, t: callbacks.append((c, t)),
+ )
+
+ assert len(callbacks) == 5
+ # `current` is a completion counter, so it climbs 1..N regardless of order.
+ assert [c for c, _ in callbacks] == [1, 2, 3, 4, 5]
+ assert all(t == 5 for _, t in callbacks)
+ assert callbacks[-1] == (5, 5)
+
+
+async def test_image_description_skips_failed_and_empty(tmp_path, monkeypatch):
+ pytest.importorskip("llama_index.core")
+ from deeptutor.services.rag.pipelines.llamaindex import document_loader as loader_module
+
+ async def complete(prompt, image_filename=None, **kwargs):
+ name = image_filename or ""
+ if "raise" in name:
+ raise RuntimeError("boom")
+ if "empty" in name:
+ return ""
+ return "ok"
+
+ _install_multimodal_clients(monkeypatch, complete_fn=complete)
+
+ names = ["ok0.png", "raise0.png", "empty0.png", "ok1.png"]
+ paths = _make_images(tmp_path, names)
+ docs = await loader_module.LlamaIndexDocumentLoader().load([str(p) for p in paths])
+
+ # Only the two "ok" images survive; order preserved.
+ assert [d.metadata["file_name"] for d in docs] == ["ok0.png", "ok1.png"]
diff --git a/web/components/knowledge/EngineDetail.tsx b/web/components/knowledge/EngineDetail.tsx
index ce276f215..0f223e313 100644
--- a/web/components/knowledge/EngineDetail.tsx
+++ b/web/components/knowledge/EngineDetail.tsx
@@ -391,6 +391,9 @@ function LlamaIndexForm({
bm25_top_k_multiplier: form.bm25_top_k_multiplier,
chunk_size: form.chunk_size,
chunk_overlap: form.chunk_overlap,
+ image_description_concurrency: form.image_description_concurrency,
+ image_description_timeout_seconds:
+ form.image_description_timeout_seconds,
});
setLoaded(next);
setForm(next);
@@ -512,6 +515,34 @@ function LlamaIndexForm({
</div>
</div>
+ {/* Image descriptions */}
+ <div>
+ <div className="mb-2 flex items-baseline justify-between gap-2">
+ <span className="text-[12px] font-medium text-[var(--foreground)]">
+ {t("Image descriptions")}
+ </span>
+ <span className="text-[11px] text-[var(--muted-foreground)]">
+ {t("Applies on the next image indexing run")}
+ </span>
+ </div>
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
+ <NumberField
+ label={t("Concurrent image descriptions")}
+ value={form.image_description_concurrency}
+ min={1}
+ max={16}
+ onChange={(v) => set({ image_description_concurrency: v })}
+ />
+ <NumberField
+ label={t("Per-image timeout (seconds)")}
+ value={form.image_description_timeout_seconds}
+ min={5}
+ max={600}
+ onChange={(v) => set({ image_description_timeout_seconds: v })}
+ />
+ </div>
+ </div>
+
<div className="flex justify-end">
<button
type="button"
diff --git a/web/hooks/useKnowledgeProgress.ts b/web/hooks/useKnowledgeProgress.ts
index 0979758dd..34fb1b91a 100644
--- a/web/hooks/useKnowledgeProgress.ts
+++ b/web/hooks/useKnowledgeProgress.ts
@@ -243,6 +243,26 @@ export function useKnowledgeProgress(options?: UseKnowledgeProgressOptions) {
(event as MessageEvent).data,
) as ProgressInfo;
setProgress(kbName, payload);
+ // The progress bar reads `percent`; the log box reads `task.logs`.
+ // Also surface the message so "Describing images: m/n" and
+ // "Embedding batches: N/M" stream into the log box live (not only at
+ // completion). Dedupe against the last line: process_log may already
+ // have emitted the same message via _task_log.
+ if (payload.message) {
+ setTasksByKb((prev) => {
+ const current = prev[kbName];
+ if (!current || current.taskId !== taskId) return prev;
+ const logs = appendTaskLog(current.logs, payload.message);
+ if (logs === current.logs) return prev;
+ return {
+ ...prev,
+ [kbName]: {
+ ...current,
+ logs,
+ },
+ };
+ });
+ }
} catch {
// ignore malformed progress
}
diff --git a/web/lib/knowledge-api.ts b/web/lib/knowledge-api.ts
index 6468eb83e..3d3b16881 100644
--- a/web/lib/knowledge-api.ts
+++ b/web/lib/knowledge-api.ts
@@ -61,6 +61,9 @@ export interface LlamaIndexConfig {
/** Chunk geometry — applies to documents indexed after the change. */
chunk_size: number;
chunk_overlap: number;
+ /** Bounded multimodal LLM work during image-heavy indexing. */
+ image_description_concurrency: number;
+ image_description_timeout_seconds: number;
}
export interface GraphRagConfig {
diff --git a/web/locales/en/app.json b/web/locales/en/app.json
index 33d0d9e30..039293018 100644
--- a/web/locales/en/app.json
+++ b/web/locales/en/app.json
@@ -2578,6 +2578,10 @@
"Keyword candidate ×": "Keyword candidate ×",
"Used by hybrid only": "Used by hybrid only",
"Applies on the next re-index": "Applies on the next re-index",
+ "Image descriptions": "Image descriptions",
+ "Applies on the next image indexing run": "Applies on the next image indexing run",
+ "Concurrent image descriptions": "Concurrent image descriptions",
+ "Per-image timeout (seconds)": "Per-image timeout (seconds)",
"Retrieval & chunking": "Retrieval & chunking",
"No knowledge bases use this engine yet.": "No knowledge bases use this engine yet.",
"This engine uses your active chat and embedding models. Manage them in the model catalog.": "This engine uses your active chat and embedding models. Manage them in the model catalog.",
diff --git a/web/locales/zh/app.json b/web/locales/zh/app.json
index 6e3d56510..50aeb2d83 100644
--- a/web/locales/zh/app.json
+++ b/web/locales/zh/app.json
@@ -2578,6 +2578,10 @@
"Keyword candidate ×": "关键词候选倍率",
"Used by hybrid only": "仅 hybrid 模式使用",
"Applies on the next re-index": "下次重新索引时生效",
+ "Image descriptions": "图片描述",
+ "Applies on the next image indexing run": "下次图片索引时生效",
+ "Concurrent image descriptions": "图片描述并发数",
+ "Per-image timeout (seconds)": "单图超时(秒)",
"Retrieval & chunking": "检索与分块",
"No knowledge bases use this engine yet.": "暂无知识库使用此引擎。",
"This engine uses your active chat and embedding models. Manage them in the model catalog.": "此引擎使用你当前启用的对话与嵌入模型,可在模型目录中管理。",