Skip to content

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

prepare v1.3.7 release

Bingxi Zhao (Frank)93891789fae4
diff --git a/README.md b/README.md
index a7df151f1..b629e1153 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,8 @@
### 📦 Releases
+> **[2026.5.4]** [v1.3.7](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.7) — Thinking-model/provider fixes, visible Knowledge index history, and safer Co-Writer clear/template editing.
+
> **[2026.5.3]** [v1.3.6](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.6) — Catalog-based model selection for chat and TutorBot, safer RAG re-indexing, OpenAI Responses token-limit fixes, and Skills editor validation.
> **[2026.5.2]** [v1.3.5](https://github.com/HKUDS/DeepTutor/releases/tag/v1.3.5) — Smoother local launch settings, safer RAG queries, cleaner local embedding auth, and Settings dark-mode polish.
diff --git a/assets/releases/ver1-3-7.md b/assets/releases/ver1-3-7.md
new file mode 100644
index 000000000..2287bd360
--- /dev/null
+++ b/assets/releases/ver1-3-7.md
@@ -0,0 +1,64 @@
+# DeepTutor v1.3.7 Release Notes
+
+**Release Date:** 2026.05.04
+
+v1.3.7 focuses on thinking-model compatibility, clearer knowledge-base index
+history, and safer Co-Writer editing. It keeps provider-specific reasoning
+output under control while making index activity easier to understand in the UI.
+
+## Highlights
+
+### Thinking-Model and Gateway Compatibility
+
+- **Reasoning output stays separate** - OpenAI-compatible and TutorBot providers
+ keep `reasoning_content` out of visible answer text, and streaming avoids
+ replaying internal scratchpad as final content.
+- **DeepSeek thinking can be configured from `.env`** - `LLM_REASONING_EFFORT`
+ is documented and applied through the resolver path. Use `minimal` to disable
+ DeepSeek thinking, or `high` / `max` to enable it.
+- **Custom gateway headers are preserved** - chat and explicit LLM calls inherit
+ profile `extra_headers`, fixing gateways that require custom headers such as
+ a `User-Agent` override.
+- **Structured generation is more tolerant** - book blocks and question ideation
+ now handle fenced, repaired, list-shaped, or otherwise imperfect JSON outputs
+ more reliably.
+
+### Knowledge Index Visibility
+
+- **Index activity is recorded** - create, upload, and re-index flows now store
+ `last_indexed_at`, indexed document count, and the index action in knowledge
+ metadata.
+- **Progress payloads describe real index changes** - backend status updates can
+ distinguish metadata-only completion from an actual vector-index update.
+- **The Knowledge UI shows index history** - detail, settings, and index-version
+ panels display the latest index time and document count when available.
+
+### Co-Writer Editing Safety
+
+- **Clear and template actions ask first** - replacing a non-empty draft now
+ opens a confirmation dialog before the editor is cleared or overwritten.
+- **Undo is more dependable** - pending typing snapshots are committed before
+ toolbar edits, and editor shortcuts support Ctrl/Cmd+Z, Shift+Cmd+Z, and
+ Ctrl/Cmd+Y.
+- **Toolbar controls are clearer** - destructive and template actions now have
+ distinct tones, focus states, labels, and accessible tooltips.
+
+## Tests
+
+- Added OpenAI-compatible provider tests to keep `reasoning_content` separate
+ from visible response content in both service and TutorBot paths.
+- Expanded LLM factory tests for inherited `extra_headers`, inherited
+ `reasoning_effort`, and reasoning-only streaming behavior.
+- Added knowledge manager coverage for recording `last_indexed_*` metadata only
+ when the index actually changes.
+
+## Upgrade Notes
+
+- Set `LLM_REASONING_EFFORT` in `.env` if you need global thinking control.
+ Leave it empty to let DeepTutor auto-detect behavior from the active model.
+- Knowledge-base metadata may now include `last_indexed_at`,
+ `last_indexed_count`, and `last_indexed_action`.
+- Co-Writer clear/template actions are recoverable through undo until the user
+ leaves the current draft.
+
+**Full Changelog**: https://github.com/HKUDS/DeepTutor/compare/v1.3.6...v1.3.7
diff --git a/deeptutor/api/routers/knowledge.py b/deeptutor/api/routers/knowledge.py
index bdff13d40..58f71e964 100644
--- a/deeptutor/api/routers/knowledge.py
+++ b/deeptutor/api/routers/knowledge.py
@@ -7,6 +7,7 @@ Handles knowledge base CRUD operations, file uploads, and initialization.
import asyncio
from datetime import datetime
+import json
import logging
import mimetypes
import os
@@ -335,12 +336,16 @@ async def run_initialization_task(initializer: KnowledgeBaseInitializer, task_id
_task_log(task_id, "Document processing complete")
initializer.extract_numbered_items()
_task_log(task_id, "Finalizing initialization")
+ indexed_count = len(FileTypeRouter.collect_supported_files(initializer.raw_dir))
initializer.progress_tracker.update(
ProgressStage.COMPLETED,
"Knowledge base initialization complete!",
current=1,
total=1,
+ indexed_count=indexed_count,
+ index_changed=True,
+ index_action="create",
)
manager = get_kb_manager()
@@ -355,6 +360,9 @@ async def run_initialization_task(initializer: KnowledgeBaseInitializer, task_id
"total": 1,
"task_id": task_id,
"timestamp": datetime.now().isoformat(),
+ "indexed_count": indexed_count,
+ "index_changed": True,
+ "index_action": "create",
},
)
@@ -487,6 +495,9 @@ async def run_upload_processing_task(
f"Successfully processed {num_processed} files!",
current=num_processed,
total=num_processed,
+ indexed_count=num_processed,
+ index_changed=num_processed > 0,
+ index_action="upload",
)
_task_log(
@@ -1051,6 +1062,28 @@ async def run_reindex_task(kb_name: str, base_dir: str, task_id: str, signature_
if not success:
raise RuntimeError(f"Re-index found no valid documents to index in '{kb_name}'.")
+ completed_at = datetime.now().isoformat()
+ metadata_file = kb_dir / "metadata.json"
+ try:
+ metadata = {}
+ if metadata_file.exists():
+ with open(metadata_file, encoding="utf-8") as handle:
+ loaded_metadata = json.load(handle)
+ if isinstance(loaded_metadata, dict):
+ metadata = loaded_metadata
+ metadata["last_updated"] = completed_at
+ metadata["last_indexed_at"] = completed_at
+ metadata["last_indexed_count"] = len(file_paths)
+ metadata["last_indexed_action"] = "reindex"
+ with open(metadata_file, "w", encoding="utf-8") as handle:
+ json.dump(metadata, handle, indent=2, ensure_ascii=False)
+ except Exception as meta_err:
+ logger.warning(
+ "Failed to update re-index metadata for '%s': %s",
+ kb_name,
+ meta_err,
+ )
+
manager = get_kb_manager()
manager.update_kb_status(
name=kb_name,
@@ -1062,7 +1095,10 @@ async def run_reindex_task(kb_name: str, base_dir: str, task_id: str, signature_
"current": len(file_paths),
"total": len(file_paths),
"task_id": task_id,
- "timestamp": datetime.now().isoformat(),
+ "timestamp": completed_at,
+ "indexed_count": len(file_paths),
+ "index_changed": True,
+ "index_action": "reindex",
},
)
# Clear the legacy mismatch / needs_reindex flags now that an
diff --git a/deeptutor/knowledge/add_documents.py b/deeptutor/knowledge/add_documents.py
index bd6c9e295..7aff60a28 100644
--- a/deeptutor/knowledge/add_documents.py
+++ b/deeptutor/knowledge/add_documents.py
@@ -193,7 +193,12 @@ class DocumentAdder:
metadata["rag_provider"] = DEFAULT_PROVIDER
metadata["needs_reindex"] = False
- metadata["last_updated"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ metadata["last_updated"] = timestamp
+ if added_count > 0:
+ metadata["last_indexed_at"] = timestamp
+ metadata["last_indexed_count"] = added_count
+ metadata["last_indexed_action"] = "upload"
history = metadata.get("update_history", [])
history.append(
@@ -278,6 +283,9 @@ async def add_documents(
"file_name": "",
"error": None,
"timestamp": datetime.now().isoformat(),
+ "indexed_count": len(processed),
+ "index_changed": len(processed) > 0,
+ "index_action": "upload",
},
)
return len(processed)
diff --git a/deeptutor/knowledge/initializer.py b/deeptutor/knowledge/initializer.py
index b65f8ac55..793f99aa2 100644
--- a/deeptutor/knowledge/initializer.py
+++ b/deeptutor/knowledge/initializer.py
@@ -86,7 +86,11 @@ class KnowledgeBaseInitializer:
metadata = {}
metadata["rag_provider"] = DEFAULT_PROVIDER
- metadata["last_updated"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ metadata["last_updated"] = timestamp
+ metadata["last_indexed_at"] = timestamp
+ metadata["last_indexed_count"] = len(FileTypeRouter.collect_supported_files(self.raw_dir))
+ metadata["last_indexed_action"] = "create"
with open(metadata_file, "w", encoding="utf-8") as f:
json.dump(metadata, f, indent=2, ensure_ascii=False)
@@ -261,7 +265,7 @@ async def initialize_knowledge_base(
)
try:
initializer.create_directory_structure()
- initializer.copy_documents(source_files)
+ copied_files = initializer.copy_documents(source_files)
await initializer.process_documents()
if not skip_extract:
initializer.extract_numbered_items()
@@ -277,6 +281,9 @@ async def initialize_knowledge_base(
"file_name": "",
"error": None,
"timestamp": datetime.now().isoformat(),
+ "indexed_count": len(copied_files),
+ "index_changed": True,
+ "index_action": "create",
},
)
return True
diff --git a/deeptutor/knowledge/manager.py b/deeptutor/knowledge/manager.py
index 43bfb3cb1..740b4e4ea 100644
--- a/deeptutor/knowledge/manager.py
+++ b/deeptutor/knowledge/manager.py
@@ -302,6 +302,27 @@ class KnowledgeBaseManager:
kb_config = self.config["knowledge_bases"][name]
kb_config["status"] = status
kb_config["updated_at"] = datetime.now().isoformat()
+ index_changed = False
+ indexed_count: int | None = None
+ index_action: str | None = None
+ if isinstance(progress, dict):
+ raw_indexed_count = progress.get("indexed_count")
+ if isinstance(raw_indexed_count, bool):
+ indexed_count = int(raw_indexed_count)
+ elif isinstance(raw_indexed_count, (int, float)):
+ indexed_count = int(raw_indexed_count)
+ elif isinstance(raw_indexed_count, str):
+ try:
+ indexed_count = int(raw_indexed_count)
+ except ValueError:
+ indexed_count = None
+
+ index_changed = bool(progress.get("index_changed")) or (
+ indexed_count is not None and indexed_count > 0
+ )
+ raw_index_action = progress.get("index_action")
+ if isinstance(raw_index_action, str) and raw_index_action.strip():
+ index_action = raw_index_action.strip()
if status == "ready":
# Ready KBs should look like stable resources in the UI instead of
@@ -311,6 +332,12 @@ class KnowledgeBaseManager:
kb_config["last_completed_at"] = (
progress.get("timestamp") or datetime.now().isoformat()
)
+ if index_changed:
+ kb_config["last_indexed_at"] = kb_config["last_completed_at"]
+ if indexed_count is not None:
+ kb_config["last_indexed_count"] = max(indexed_count, 0)
+ if index_action:
+ kb_config["last_indexed_action"] = index_action
elif progress is not None:
kb_config["progress"] = progress
@@ -431,6 +458,14 @@ class KnowledgeBaseManager:
kb_entry["created_at"] = metadata["created_at"]
if metadata.get("last_updated"):
kb_entry["updated_at"] = metadata["last_updated"]
+ if metadata.get("last_indexed_at"):
+ kb_entry["last_indexed_at"] = metadata["last_indexed_at"]
+ elif metadata.get("last_updated"):
+ kb_entry["last_indexed_at"] = metadata["last_updated"]
+ if metadata.get("last_indexed_count") is not None:
+ kb_entry["last_indexed_count"] = metadata["last_indexed_count"]
+ if metadata.get("last_indexed_action"):
+ kb_entry["last_indexed_action"] = metadata["last_indexed_action"]
except Exception as e:
logger.warning(f"Failed to read metadata.json for '{name}': {e}")
@@ -590,6 +625,9 @@ class KnowledgeBaseManager:
"needs_reindex": bool(kb_config.get("needs_reindex", False)),
"created_at": kb_config.get("created_at"),
"last_updated": kb_config.get("updated_at"),
+ "last_indexed_at": kb_config.get("last_indexed_at"),
+ "last_indexed_count": kb_config.get("last_indexed_count"),
+ "last_indexed_action": kb_config.get("last_indexed_action"),
}
metadata.update(self._embedding_fields(kb_config))
# Remove None values
@@ -684,6 +722,12 @@ class KnowledgeBaseManager:
metadata["created_at"] = created_at
if updated_at:
metadata["last_updated"] = updated_at
+ if kb_config.get("last_indexed_at"):
+ metadata["last_indexed_at"] = kb_config.get("last_indexed_at")
+ if kb_config.get("last_indexed_count") is not None:
+ metadata["last_indexed_count"] = kb_config.get("last_indexed_count")
+ if kb_config.get("last_indexed_action"):
+ metadata["last_indexed_action"] = kb_config.get("last_indexed_action")
metadata.update(self._embedding_fields(kb_config))
diff --git a/deeptutor/knowledge/progress_tracker.py b/deeptutor/knowledge/progress_tracker.py
index fda339260..9ee9446c9 100644
--- a/deeptutor/knowledge/progress_tracker.py
+++ b/deeptutor/knowledge/progress_tracker.py
@@ -118,6 +118,9 @@ class ProgressTracker:
"error": progress.get("error"),
"timestamp": progress.get("timestamp"),
"task_id": progress.get("task_id"),
+ "indexed_count": progress.get("indexed_count"),
+ "index_changed": progress.get("index_changed"),
+ "index_action": progress.get("index_action"),
},
)
except Exception as e:
@@ -145,6 +148,9 @@ class ProgressTracker:
total: int = 0,
file_name: str = "",
error: str | None = None,
+ indexed_count: int | None = None,
+ index_changed: bool | None = None,
+ index_action: str | None = None,
):
"""Update progress"""
progress = {
@@ -158,6 +164,12 @@ class ProgressTracker:
"progress_percent": int(current / total * 100) if total > 0 else 0,
"timestamp": datetime.now().isoformat(),
}
+ if indexed_count is not None:
+ progress["indexed_count"] = indexed_count
+ if index_changed is not None:
+ progress["index_changed"] = index_changed
+ if index_action:
+ progress["index_action"] = index_action
if error:
progress["error"] = error
diff --git a/deeptutor/services/llm/factory.py b/deeptutor/services/llm/factory.py
index 1639a5414..25c9ec9b5 100644
--- a/deeptutor/services/llm/factory.py
+++ b/deeptutor/services/llm/factory.py
@@ -104,6 +104,49 @@ def _resolve_provider_spec(
return find_by_name(fallback) or find_by_name("openai")
+def _url_matches_current(explicit_url: str | None, current: LLMConfig) -> bool:
+ if explicit_url is None:
+ return True
+ return explicit_url in {
+ url for url in (current.base_url, current.effective_url) if url is not None
+ }
+
+
+def _binding_matches_current(binding: str | None, current: LLMConfig) -> bool:
+ if not binding:
+ return True
+ canonical = canonical_provider_name(binding) or binding
+ return canonical in {current.binding, current.provider_name}
+
+
+def _matching_current_config(
+ *,
+ model: str,
+ api_key: str,
+ base_url: str | None,
+ api_version: str | None,
+ binding: str | None,
+) -> LLMConfig | None:
+ """Return the active config when explicit call fields came from it.
+
+ Several agent call sites pass model/api_key/base_url/binding explicitly
+ after reading ``get_llm_config()``. Treat those fields as a partial
+ override, not as a request to drop profile-only settings such as
+ extra_headers or reasoning_effort.
+ """
+ with contextlib.suppress(Exception):
+ current = get_llm_config()
+ if (
+ model == current.model
+ and api_key == current.api_key
+ and _url_matches_current(base_url, current)
+ and (api_version is None or api_version == current.api_version)
+ and _binding_matches_current(binding, current)
+ ):
+ return current
+ return None
+
+
def _resolve_call_config(
*,
model: str | None,
@@ -115,6 +158,23 @@ def _resolve_call_config(
reasoning_effort: str | None,
) -> tuple[LLMConfig, Any]:
if model and api_key is not None and (base_url is not None or binding is not None):
+ current = _matching_current_config(
+ model=model,
+ api_key=api_key,
+ base_url=base_url,
+ api_version=api_version,
+ binding=binding,
+ )
+ merged_headers = dict(current.extra_headers or {}) if current is not None else {}
+ if extra_headers:
+ merged_headers.update(extra_headers)
+ resolved_reasoning_effort = (
+ reasoning_effort
+ if reasoning_effort is not None
+ else current.reasoning_effort
+ if current is not None
+ else None
+ )
provider_spec = _resolve_provider_spec(
binding=binding,
model=model,
@@ -137,8 +197,8 @@ def _resolve_call_config(
provider_name=provider_name,
provider_mode=provider_mode,
api_version=api_version,
- extra_headers=extra_headers or {},
- reasoning_effort=reasoning_effort,
+ extra_headers=merged_headers,
+ reasoning_effort=resolved_reasoning_effort,
)
return config, provider_spec
@@ -293,7 +353,7 @@ async def complete(
exponential_backoff: bool = DEFAULT_EXPONENTIAL_BACKOFF,
**kwargs: Any,
) -> str:
- caller_extra_headers = kwargs.pop("extra_headers", None) or {}
+ caller_extra_headers = kwargs.pop("extra_headers", None)
reasoning_effort = kwargs.pop("reasoning_effort", None)
image_data = kwargs.pop("image_data", None)
@@ -352,7 +412,7 @@ async def stream(
exponential_backoff: bool = DEFAULT_EXPONENTIAL_BACKOFF,
**kwargs: Any,
) -> AsyncGenerator[str, None]:
- caller_extra_headers = kwargs.pop("extra_headers", None) or {}
+ caller_extra_headers = kwargs.pop("extra_headers", None)
reasoning_effort = kwargs.pop("reasoning_effort", None)
image_data = kwargs.pop("image_data", None)
@@ -420,10 +480,13 @@ async def stream(
if in_think_block:
in_think_block = False
await queue.put("</think>")
- # When the model returns reasoning but no direct content (e.g.
- # DeepSeek v4 with thinking enabled), emit the fallback content
- # so downstream consumers do not receive an empty response.
- if not saw_content and response.content:
+ # Some providers synthesize a final response only after the stream.
+ # Do not replay reasoning_content as user-visible answer text.
+ if (
+ not saw_content
+ and response.content
+ and response.content != response.reasoning_content
+ ):
saw_output = True
await queue.put(response.content)
if response.finish_reason == "error" and not saw_output:
diff --git a/deeptutor/services/llm/provider_core/openai_compat_provider.py b/deeptutor/services/llm/provider_core/openai_compat_provider.py
index 006cc843d..7740f5df5 100644
--- a/deeptutor/services/llm/provider_core/openai_compat_provider.py
+++ b/deeptutor/services/llm/provider_core/openai_compat_provider.py
@@ -532,8 +532,6 @@ class OpenAICompatProvider(LLMProvider):
finish_reason = ch.finish_reason
if not content and m.content:
content = m.content
- if not content and getattr(m, "reasoning_content", None):
- content = m.reasoning_content
if not content and getattr(m, "reasoning", None):
content = m.reasoning
@@ -623,8 +621,6 @@ class OpenAICompatProvider(LLMProvider):
content = "".join(content_parts) or None
reasoning_content = "".join(reasoning_parts) or None
- if not content and reasoning_content:
- content = reasoning_content
return LLMResponse(
content=content,
diff --git a/deeptutor/tutorbot/providers/openai_compat_provider.py b/deeptutor/tutorbot/providers/openai_compat_provider.py
index da3f70b78..fe9db45af 100644
--- a/deeptutor/tutorbot/providers/openai_compat_provider.py
+++ b/deeptutor/tutorbot/providers/openai_compat_provider.py
@@ -365,8 +365,6 @@ class OpenAICompatProvider(LLMProvider):
finish_reason = ch.finish_reason
if not content and m.content:
content = m.content
- if not content and getattr(m, "reasoning_content", None):
- content = m.reasoning_content
if not content and getattr(m, "reasoning", None):
content = m.reasoning
@@ -456,8 +454,6 @@ class OpenAICompatProvider(LLMProvider):
content = "".join(content_parts) or None
reasoning_content = "".join(reasoning_parts) or None
- if not content and reasoning_content:
- content = reasoning_content
return LLMResponse(
content=content,
diff --git a/tests/knowledge/test_manager_embedding_flags.py b/tests/knowledge/test_manager_embedding_flags.py
index 33b79be7e..ed589a36b 100644
--- a/tests/knowledge/test_manager_embedding_flags.py
+++ b/tests/knowledge/test_manager_embedding_flags.py
@@ -88,3 +88,44 @@ def test_ready_version_without_active_signature_marks_reindex(
entry = reloaded.config["knowledge_bases"]["old-kb"]
assert entry["needs_reindex"] is True
assert entry["embedding_mismatch"] is True
+
+
+def test_ready_status_records_last_indexed_only_when_index_changes(
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ _patch_active_embedding(monkeypatch)
+ manager = KnowledgeBaseManager(base_dir=str(tmp_path))
+
+ manager.update_kb_status(
+ name="kb",
+ status="ready",
+ progress={
+ "stage": "completed",
+ "timestamp": "2026-05-04T10:00:00",
+ "indexed_count": 2,
+ "index_changed": True,
+ "index_action": "upload",
+ },
+ )
+
+ entry = KnowledgeBaseManager(base_dir=str(tmp_path)).config["knowledge_bases"]["kb"]
+ assert entry["last_indexed_at"] == "2026-05-04T10:00:00"
+ assert entry["last_indexed_count"] == 2
+ assert entry["last_indexed_action"] == "upload"
+
+ manager.update_kb_status(
+ name="kb",
+ status="ready",
+ progress={
+ "stage": "completed",
+ "timestamp": "2026-05-04T11:00:00",
+ "indexed_count": 0,
+ "index_changed": False,
+ "index_action": "upload",
+ },
+ )
+
+ info = KnowledgeBaseManager(base_dir=str(tmp_path)).get_info("kb")
+ assert info["metadata"]["last_indexed_at"] == "2026-05-04T10:00:00"
+ assert info["metadata"]["last_indexed_count"] == 2
diff --git a/tests/services/llm/test_factory_provider_exec.py b/tests/services/llm/test_factory_provider_exec.py
index 426eb5a83..f8f66dd7e 100644
--- a/tests/services/llm/test_factory_provider_exec.py
+++ b/tests/services/llm/test_factory_provider_exec.py
@@ -18,12 +18,14 @@ class _FakeProvider:
complete_response: LLMResponse | None = None,
stream_response: LLMResponse | None = None,
stream_chunk: str = "chunk",
+ reasoning_chunk: str = "",
) -> None:
self.complete_kwargs: dict[str, Any] = {}
self.stream_kwargs: dict[str, Any] = {}
self.complete_response = complete_response or LLMResponse(content="ok")
self.stream_response = stream_response or LLMResponse(content=stream_chunk)
self.stream_chunk = stream_chunk
+ self.reasoning_chunk = reasoning_chunk
async def chat_with_retry(self, **kwargs: Any) -> LLMResponse:
self.complete_kwargs = kwargs
@@ -31,6 +33,9 @@ class _FakeProvider:
async def chat_stream_with_retry(self, **kwargs: Any) -> LLMResponse:
self.stream_kwargs = kwargs
+ on_reasoning_delta = kwargs.get("on_reasoning_delta")
+ if on_reasoning_delta is not None and self.reasoning_chunk:
+ await on_reasoning_delta(self.reasoning_chunk)
on_content_delta = kwargs.get("on_content_delta")
if on_content_delta is not None:
await on_content_delta(self.stream_chunk)
@@ -100,6 +105,66 @@ async def test_stream_merges_config_and_caller_extra_headers(monkeypatch) -> Non
assert merged == {"X-Config": "cfg", "X-Caller": "clr"}
+async def test_explicit_call_inherits_matching_profile_headers_and_reasoning(
+ monkeypatch,
+) -> None:
+ cfg = _make_cfg(
+ extra_headers={"User-Agent": "DeepTutor-Test"},
+ reasoning_effort="minimal",
+ )
+ provider = _FakeProvider()
+ captured_config: dict[str, LLMConfig] = {}
+
+ monkeypatch.setattr("deeptutor.services.llm.factory.get_llm_config", lambda: cfg)
+
+ def _fake_get_runtime_provider(config: LLMConfig):
+ captured_config["config"] = config
+ return provider
+
+ monkeypatch.setattr(
+ "deeptutor.services.llm.factory.get_runtime_provider", _fake_get_runtime_provider
+ )
+
+ result = await complete(
+ "hello",
+ model=cfg.model,
+ api_key=cfg.api_key,
+ base_url=cfg.base_url,
+ binding=cfg.binding,
+ )
+
+ assert result == "ok"
+ assert captured_config["config"].extra_headers == {"User-Agent": "DeepTutor-Test"}
+ assert captured_config["config"].reasoning_effort == "minimal"
+ assert provider.complete_kwargs["reasoning_effort"] == "minimal"
+
+
+async def test_stream_does_not_replay_reasoning_as_final_content(monkeypatch) -> None:
+ cfg = _make_cfg()
+ provider = _FakeProvider(
+ stream_chunk="",
+ reasoning_chunk="scratchpad",
+ stream_response=LLMResponse(
+ content="scratchpad",
+ reasoning_content="scratchpad",
+ ),
+ )
+
+ monkeypatch.setattr("deeptutor.services.llm.factory.get_llm_config", lambda: cfg)
+ monkeypatch.setattr(
+ "deeptutor.services.llm.factory.get_runtime_provider",
+ lambda _config: provider,
+ )
+
+ chunks = []
+ async for chunk in stream("hello"):
+ chunks.append(chunk)
+
+ assert chunks == ["<think>", "scratchpad", "</think>"]
+
+
@pytest.mark.asyncio
async def test_complete_injects_openai_image_parts(monkeypatch) -> None:
cfg = _make_cfg(model="gpt-4o-mini", binding="openai", provider_name="openai")
diff --git a/tests/services/llm/test_openai_compat_reasoning_content.py b/tests/services/llm/test_openai_compat_reasoning_content.py
new file mode 100644
index 000000000..ead717dd6
--- /dev/null
+++ b/tests/services/llm/test_openai_compat_reasoning_content.py
@@ -0,0 +1,62 @@
+"""Reasoning-content handling for OpenAI-compatible providers."""
+
+from __future__ import annotations
+
+from types import SimpleNamespace
+
+import pytest
+
+from deeptutor.services.llm.provider_core.openai_compat_provider import (
+ OpenAICompatProvider as ServicesOpenAICompatProvider,
+)
+from deeptutor.tutorbot.providers.openai_compat_provider import (
+ OpenAICompatProvider as TutorBotOpenAICompatProvider,
+)
+
+
+def _response_with_reasoning_only():
+ message = SimpleNamespace(
+ content=None,
+ reasoning_content="internal reasoning",
+ reasoning=None,
+ tool_calls=None,
+ )
+ return SimpleNamespace(
+ choices=[SimpleNamespace(message=message, finish_reason="stop")],
+ )
+
+
+def _reasoning_only_chunk():
+ delta = SimpleNamespace(
+ content=None,
+ reasoning_content="internal reasoning",
+ reasoning=None,
+ tool_calls=[],
+ )
+ return SimpleNamespace(
+ choices=[SimpleNamespace(delta=delta, finish_reason="stop")],
+ )
+
+
+ "provider_cls",
+ [ServicesOpenAICompatProvider, TutorBotOpenAICompatProvider],
+)
+def test_parse_keeps_reasoning_content_out_of_visible_content(provider_cls) -> None:
+ provider = provider_cls.__new__(provider_cls)
+
+ response = provider._parse(_response_with_reasoning_only())
+
+ assert response.content is None
+ assert response.reasoning_content == "internal reasoning"
+
+
+ "provider_cls",
+ [ServicesOpenAICompatProvider, TutorBotOpenAICompatProvider],
+)
+def test_parse_chunks_keeps_reasoning_content_out_of_visible_content(provider_cls) -> None:
+ response = provider_cls._parse_chunks([_reasoning_only_chunk()])
+
+ assert response.content is None
+ assert response.reasoning_content == "internal reasoning"
diff --git a/web/app/(workspace)/co-writer/[docId]/page.tsx b/web/app/(workspace)/co-writer/[docId]/page.tsx
index f7f0f7cee..06e4cc612 100644
--- a/web/app/(workspace)/co-writer/[docId]/page.tsx
+++ b/web/app/(workspace)/co-writer/[docId]/page.tsx
@@ -63,6 +63,7 @@ const MarkdownRenderer = dynamic(
type EditAction = "rewrite" | "shorten" | "expand";
type SelectionMode = EditAction | "none";
type SourceOption = "none" | "rag" | "web";
+type ConfirmAction = "clear" | "template";
type ToolName =
| "brainstorm"
| "rag"
@@ -203,6 +204,8 @@ export default function CoWriterPage() {
const [error, setError] = useState("");
const [status, setStatus] = useState("");
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
+ const [pendingConfirmAction, setPendingConfirmAction] =
+ useState<ConfirmAction | null>(null);
const [notebookSavePayload, setNotebookSavePayload] =
useState<NotebookSavePayload | null>(null);
const [selectedRange, setSelectedRange] = useState<SelectedRange | null>(
@@ -237,6 +240,7 @@ export default function CoWriterPage() {
const [undoStack, setUndoStack] = useState<string[]>([]);
const [redoStack, setRedoStack] = useState<string[]>([]);
const undoTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const pendingUndoSnapshotRef = useRef<string | null>(null);
const [hasLoadedDraft, setHasLoadedDraft] = useState(false);
useEffect(() => {
@@ -413,17 +417,50 @@ export default function CoWriterPage() {
setRedoStack([]);
}, []);
+ const commitPendingTypingUndo = useCallback(() => {
+ if (undoTimerRef.current) {
+ clearTimeout(undoTimerRef.current);
+ undoTimerRef.current = null;
+ }
+ const snapshot = pendingUndoSnapshotRef.current;
+ pendingUndoSnapshotRef.current = null;
+ if (snapshot !== null && snapshot !== markdown) {
+ pushUndo(snapshot);
+ }
+ }, [markdown, pushUndo]);
+
const handleMarkdownChange = useCallback(
(value: string) => {
if (undoTimerRef.current) clearTimeout(undoTimerRef.current);
- const prev = markdown;
- undoTimerRef.current = setTimeout(() => pushUndo(prev), 400);
+ if (pendingUndoSnapshotRef.current === null) {
+ pendingUndoSnapshotRef.current = markdown;
+ }
+ const snapshot = pendingUndoSnapshotRef.current;
+ undoTimerRef.current = setTimeout(() => {
+ pendingUndoSnapshotRef.current = null;
+ undoTimerRef.current = null;
+ if (snapshot !== null && snapshot !== value) {
+ pushUndo(snapshot);
+ }
+ }, 400);
setMarkdown(value);
},
[markdown, pushUndo],
);
const handleUndo = useCallback(() => {
+ if (undoTimerRef.current) {
+ clearTimeout(undoTimerRef.current);
+ undoTimerRef.current = null;
+ }
+ const pendingSnapshot = pendingUndoSnapshotRef.current;
+ pendingUndoSnapshotRef.current = null;
+ if (pendingSnapshot !== null && pendingSnapshot !== markdown) {
+ setRedoStack((s) => [...s, markdown]);
+ setMarkdown(pendingSnapshot);
+ return;
+ }
+
if (undoStack.length === 0) return;
const prev = undoStack[undoStack.length - 1];
setRedoStack((s) => [...s, markdown]);
@@ -439,6 +476,32 @@ export default function CoWriterPage() {
setMarkdown(next);
}, [redoStack, markdown]);
+ const handleEditorKeyDown = useCallback(
+ (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
+ const key = event.key.toLowerCase();
+ const hasUndoModifier = event.metaKey || event.ctrlKey;
+ if (!hasUndoModifier || event.altKey) return;
+
+ if (key === "z" && event.shiftKey) {
+ event.preventDefault();
+ handleRedo();
+ return;
+ }
+
+ if (key === "z") {
+ event.preventDefault();
+ handleUndo();
+ return;
+ }
+
+ if (key === "y") {
+ event.preventDefault();
+ handleRedo();
+ }
+ },
+ [handleRedo, handleUndo],
+ );
+
const startEditingTitle = useCallback(() => {
if (isLoadingDoc) return;
setTitleDraft(docTitle);
@@ -631,6 +694,7 @@ export default function CoWriterPage() {
const insertSnippet = useCallback(
(snippet: string) => {
+ commitPendingTypingUndo();
pushUndo(markdown);
const textarea = textareaRef.current;
if (!textarea) {
@@ -647,15 +711,21 @@ export default function CoWriterPage() {
textarea.setSelectionRange(cursor, cursor);
});
},
- [markdown, pushUndo],
+ [commitPendingTypingUndo, markdown, pushUndo],
);
- const clearDocument = () => {
+ const clearDocument = useCallback(() => {
+ if (!markdown) {
+ setStatus(t("Draft is already empty."));
+ setError("");
+ return;
+ }
+ commitPendingTypingUndo();
pushUndo(markdown);
setMarkdown("");
- setStatus("");
+ setStatus(t("Draft cleared. Press Ctrl/Cmd+Z or use Undo to restore it."));
setError("");
- };
+ }, [commitPendingTypingUndo, markdown, pushUndo, t]);
const loadExampleTemplate = useCallback(() => {
if (markdown === CO_WRITER_SAMPLE_TEMPLATE) {
@@ -664,11 +734,58 @@ export default function CoWriterPage() {
return;
}
+ commitPendingTypingUndo();
pushUndo(markdown);
setMarkdown(CO_WRITER_SAMPLE_TEMPLATE);
- setStatus(t("Loaded example template."));
+ setStatus(
+ t("Loaded example template. Press Ctrl/Cmd+Z or use Undo to restore it."),
+ );
setError("");
- }, [markdown, pushUndo]);
+ }, [commitPendingTypingUndo, markdown, pushUndo, t]);
+
+ const requestClearDocument = useCallback(() => {
+ if (!markdown) {
+ clearDocument();
+ return;
+ }
+ setPendingConfirmAction("clear");
+ }, [clearDocument, markdown]);
+
+ const requestLoadExampleTemplate = useCallback(() => {
+ if (markdown === CO_WRITER_SAMPLE_TEMPLATE) {
+ loadExampleTemplate();
+ return;
+ }
+ setPendingConfirmAction("template");
+ }, [loadExampleTemplate, markdown]);
+
+ const confirmActionCopy = useMemo(() => {
+ if (pendingConfirmAction === "clear") {
+ return {
+ title: t("Clear this draft?"),
+ description: t(
+ "This will empty the editor. The previous content is kept in Undo until you leave this draft.",
+ ),
+ confirmLabel: t("Clear draft"),
+ tone: "danger" as const,
+ onConfirm: clearDocument,
+ };
+ }
+
+ if (pendingConfirmAction === "template") {
+ return {
+ title: t("Replace with the example template?"),
+ description: t(
+ "This will replace the current editor content. The previous content is kept in Undo until you leave this draft.",
+ ),
+ confirmLabel: t("Load template"),
+ tone: "warning" as const,
+ onConfirm: loadExampleTemplate,
+ };
+ }
+
+ return null;
+ }, [clearDocument, loadExampleTemplate, pendingConfirmAction, t]);
const handleDownload = () => {
const blob = new Blob([markdown], { type: "text/markdown;charset=utf-8" });
@@ -943,6 +1060,7 @@ export default function CoWriterPage() {
selectionInstruction,
selectionMode,
selectionTools,
+ t,
updateSelectionTraceFromEvent,
]);
@@ -1627,7 +1745,11 @@ export default function CoWriterPage() {
) : null}
</div>
<div className="flex items-center gap-2">
- <ToolbarIconBtn title={t("Clear")} onClick={clearDocument}>
+ <ToolbarIconBtn
+ title={t("Clear")}
+ onClick={requestClearDocument}
+ tone="danger"
+ >
<Eraser size={17} strokeWidth={1.7} />
</ToolbarIconBtn>
<ToolbarIconBtn title={t("Export Markdown")} onClick={handleDownload}>
@@ -1641,7 +1763,8 @@ export default function CoWriterPage() {
</ToolbarIconBtn>
<ToolbarIconBtn
title={t("Load Example Template")}
- onClick={loadExampleTemplate}
+ onClick={requestLoadExampleTemplate}
+ tone="warning"
>
<FileText size={17} strokeWidth={1.7} />
</ToolbarIconBtn>
@@ -1761,6 +1884,7 @@ export default function CoWriterPage() {
value={markdown}
onChange={(e) => handleMarkdownChange(e.target.value)}
onSelect={updateSelectionPopover}
+ onKeyDown={handleEditorKeyDown}
onKeyUp={updateSelectionPopover}
onMouseUp={updateSelectionPopover}
onScroll={handleEditorScrollSync}
@@ -2218,6 +2342,69 @@ export default function CoWriterPage() {
</div>
)}
+ {confirmActionCopy && (
+ <div
+ className="fixed inset-0 z-50 flex items-center justify-center bg-black/30 px-4 backdrop-blur-sm"
+ onClick={(e) => {
+ if (e.target === e.currentTarget) setPendingConfirmAction(null);
+ }}
+ >
+ <div
+ role="alertdialog"
+ aria-modal="true"
+ aria-labelledby="co-writer-confirm-title"
+ aria-describedby="co-writer-confirm-description"
+ className="w-full max-w-sm rounded-xl border border-[var(--border)] bg-[var(--card)] shadow-xl"
+ >
+ <div className="border-b border-[var(--border)] px-4 py-3">
+ <h2
+ id="co-writer-confirm-title"
+ className="text-sm font-semibold text-[var(--foreground)]"
+ >
+ {confirmActionCopy.title}
+ </h2>
+ <p
+ id="co-writer-confirm-description"
+ className="mt-1 text-xs leading-relaxed text-[var(--muted-foreground)]"
+ >
+ {confirmActionCopy.description}
+ </p>
+ </div>
+
+ <div className="px-4 py-3">
+ <div className="rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[11px] leading-relaxed text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-200">
+ {t("Undo is available with Ctrl/Cmd+Z or the toolbar Undo button.")}
+ </div>
+ </div>
+
+ <div className="flex justify-end gap-2 border-t border-[var(--border)] px-4 py-3">
+ <button
+ type="button"
+ onClick={() => setPendingConfirmAction(null)}
+ className="rounded-md border border-[var(--border)] px-3 py-1.5 text-xs font-medium text-[var(--foreground)] transition-colors hover:bg-[var(--muted)]"
+ >
+ {t("Cancel")}
+ </button>
+ <button
+ type="button"
+ onClick={() => {
+ const onConfirm = confirmActionCopy.onConfirm;
+ setPendingConfirmAction(null);
+ onConfirm();
+ }}
+ className={`rounded-md px-3 py-1.5 text-xs font-medium text-white transition-opacity hover:opacity-90 ${
+ confirmActionCopy.tone === "danger"
+ ? "bg-red-600"
+ : "bg-amber-600"
+ }`}
+ >
+ {confirmActionCopy.confirmLabel}
+ </button>
+ </div>
+ </div>
+ </div>
+ )}
+
<SaveToNotebookModal
open={notebookSavePayload !== null}
payload={notebookSavePayload}
@@ -2235,18 +2422,34 @@ function ToolbarIconBtn({
title,
onClick,
children,
+ tone = "default",
}: {
title: string;
onClick: () => void;
children: React.ReactNode;
+ tone?: "default" | "danger" | "warning";
}) {
+ const toneClass =
+ tone === "danger"
+ ? "hover:bg-red-500/10 hover:text-red-600 dark:hover:text-red-400"
+ : tone === "warning"
+ ? "hover:bg-amber-500/10 hover:text-amber-700 dark:hover:text-amber-300"
+ : "hover:bg-[var(--muted)] hover:text-[var(--foreground)]";
+
return (
<button
- title={title}
+ type="button"
+ aria-label={title}
onClick={onClick}
- className="inline-flex h-8 w-8 items-center justify-center rounded-md text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
+ className={`group relative inline-flex h-8 w-8 items-center justify-center rounded-md text-[var(--muted-foreground)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--primary)]/35 ${toneClass}`}
>
{children}
+ <span
+ role="tooltip"
+ className="pointer-events-none absolute left-1/2 top-full z-30 mt-1.5 -translate-x-1/2 whitespace-nowrap rounded-md border border-[var(--border)] bg-[var(--card)] px-2 py-1 text-[10px] font-medium text-[var(--foreground)] opacity-0 shadow-lg transition-opacity delay-[120ms] duration-100 group-hover:opacity-100 group-focus-visible:opacity-100 group-focus-visible:delay-0"
+ >
+ {title}
+ </span>
</button>
);
}
diff --git a/web/components/knowledge/KbIndexVersionsSection.tsx b/web/components/knowledge/KbIndexVersionsSection.tsx
index e14b023a5..70085ecfa 100644
--- a/web/components/knowledge/KbIndexVersionsSection.tsx
+++ b/web/components/knowledge/KbIndexVersionsSection.tsx
@@ -45,6 +45,8 @@ export default function KbIndexVersionsSection({
const mismatch = Boolean(kb.metadata?.embedding_mismatch);
const isReindexingHere = task?.kind === "reindex" && task.executing;
const percent = resolveProgressPercent(kb.progress);
+ const lastIndexed = formatKnowledgeTimestamp(kb.metadata?.last_indexed_at);
+ const lastIndexedCount = kb.metadata?.last_indexed_count;
const handleReindex = async () => {
setSubmitting(true);
@@ -108,6 +110,27 @@ export default function KbIndexVersionsSection({
</div>
)}
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1 rounded-lg border border-[var(--border)] bg-[var(--muted)]/30 px-3 py-2 text-[11.5px] text-[var(--muted-foreground)]">
+ <Clock className="h-3.5 w-3.5 shrink-0" />
+ <span>
+ {t("Last indexed")}:{" "}
+ <span className="font-medium text-[var(--foreground)]">
+ {lastIndexed || t("Not recorded yet")}
+ </span>
+ </span>
+ {typeof lastIndexedCount === "number" && (
+ <span>
+ ·{" "}
+ {t(
+ lastIndexedCount === 1
+ ? "{{count}} indexed doc"
+ : "{{count}} indexed docs",
+ { count: lastIndexedCount },
+ )}
+ </span>
+ )}
+ </div>
+
{versions.length > 0 ? (
<ul className="divide-y divide-[var(--border)] rounded-lg border border-[var(--border)] bg-[var(--background)]">
{versions.map((version) => (
diff --git a/web/components/knowledge/KbSettingsSection.tsx b/web/components/knowledge/KbSettingsSection.tsx
index baa839463..5bfa5b746 100644
--- a/web/components/knowledge/KbSettingsSection.tsx
+++ b/web/components/knowledge/KbSettingsSection.tsx
@@ -28,6 +28,7 @@ export default function KbSettingsSection({
: t("Default embedding");
const created = formatKnowledgeTimestamp(meta.created_at);
const updated = formatKnowledgeTimestamp(meta.last_updated);
+ const lastIndexed = formatKnowledgeTimestamp(meta.last_indexed_at);
return (
<div className="space-y-6">
@@ -46,6 +47,7 @@ export default function KbSettingsSection({
<Field label={t("Embedding")}>{embeddingLabel}</Field>
<Field label={t("Created")}>{created || "—"}</Field>
<Field label={t("Updated")}>{updated || "—"}</Field>
+ <Field label={t("Last indexed")}>{lastIndexed || "—"}</Field>
{kb.path && (
<Field label={t("On-disk path")} className="sm:col-span-2">
<span className="font-mono text-[10.5px] text-[var(--muted-foreground)]">
diff --git a/web/components/knowledge/KnowledgeBaseDetail.tsx b/web/components/knowledge/KnowledgeBaseDetail.tsx
index 6b67ec191..aecf62fdf 100644
--- a/web/components/knowledge/KnowledgeBaseDetail.tsx
+++ b/web/components/knowledge/KnowledgeBaseDetail.tsx
@@ -103,6 +103,7 @@ export default function KnowledgeBaseDetail({
: t("Default embedding");
const updatedLabel =
formatKnowledgeTimestamp(meta.last_updated) || t("Unknown time");
+ const lastIndexedLabel = formatKnowledgeTimestamp(meta.last_indexed_at);
const isReindexingLocally =
task?.kind === "reindex" && task.executing === true;
@@ -132,6 +133,9 @@ export default function KnowledgeBaseDetail({
</div>
<p className="mt-1 text-[12px] text-[var(--muted-foreground)]">
{provider} · {embeddingLabel} · {t("Updated")} {updatedLabel}
+ {lastIndexedLabel
+ ? ` · ${t("Last indexed")} ${lastIndexedLabel}`
+ : ""}
</p>
</div>
</div>
diff --git a/web/lib/knowledge-helpers.ts b/web/lib/knowledge-helpers.ts
index 295102759..585735c5f 100644
--- a/web/lib/knowledge-helpers.ts
+++ b/web/lib/knowledge-helpers.ts
@@ -22,6 +22,9 @@ export interface ProgressInfo {
total?: number;
percent?: number;
progress_percent?: number;
+ indexed_count?: number;
+ index_changed?: boolean;
+ index_action?: string;
}
export interface IndexVersion {
@@ -42,6 +45,9 @@ export interface KnowledgeBase {
metadata?: {
created_at?: string;
last_updated?: string;
+ last_indexed_at?: string;
+ last_indexed_count?: number;
+ last_indexed_action?: string;
rag_provider?: string;
needs_reindex?: boolean;
embedding_model?: string;
diff --git a/web/locales/en/app.json b/web/locales/en/app.json
index 58579d53e..43793a083 100644
--- a/web/locales/en/app.json
+++ b/web/locales/en/app.json
@@ -748,6 +748,16 @@
"Auto Mark": "Auto Mark",
"Example template is already loaded.": "Example template is already loaded.",
"Loaded example template.": "Loaded example template.",
+ "Draft is already empty.": "Draft is already empty.",
+ "Draft cleared. Press Ctrl/Cmd+Z or use Undo to restore it.": "Draft cleared. Press Ctrl/Cmd+Z or use Undo to restore it.",
+ "Loaded example template. Press Ctrl/Cmd+Z or use Undo to restore it.": "Loaded example template. Press Ctrl/Cmd+Z or use Undo to restore it.",
+ "Clear this draft?": "Clear this draft?",
+ "This will empty the editor. The previous content is kept in Undo until you leave this draft.": "This will empty the editor. The previous content is kept in Undo until you leave this draft.",
+ "Clear draft": "Clear draft",
+ "Replace with the example template?": "Replace with the example template?",
+ "This will replace the current editor content. The previous content is kept in Undo until you leave this draft.": "This will replace the current editor content. The previous content is kept in Undo until you leave this draft.",
+ "Load template": "Load template",
+ "Undo is available with Ctrl/Cmd+Z or the toolbar Undo button.": "Undo is available with Ctrl/Cmd+Z or the toolbar Undo button.",
"Applied AI edit to the selection.": "Applied AI edit to the selection.",
"Applied {{action}} to the full draft.": "Applied {{action}} to the full draft.",
"Applied auto-mark annotations.": "Applied auto-mark annotations.",
@@ -1112,6 +1122,10 @@
"Release to attach the files": "Release to attach the files",
"{{count}} files detected": "{{count}} files detected",
"Updated": "Updated",
+ "Last indexed": "Last indexed",
+ "Not recorded yet": "Not recorded yet",
+ "{{count}} indexed doc": "{{count}} indexed doc",
+ "{{count}} indexed docs": "{{count}} indexed docs",
"Created": "Created",
"Index": "Index",
"Vector index ready": "Vector index ready",
diff --git a/web/locales/zh/app.json b/web/locales/zh/app.json
index 4dd09574d..48b240784 100644
--- a/web/locales/zh/app.json
+++ b/web/locales/zh/app.json
@@ -797,6 +797,16 @@
"Auto Mark": "自动批注",
"Example template is already loaded.": "示例模板已加载。",
"Loaded example template.": "已加载示例模板。",
+ "Draft is already empty.": "草稿已经是空的。",
+ "Draft cleared. Press Ctrl/Cmd+Z or use Undo to restore it.": "草稿已清空。按 Ctrl/Cmd+Z 或使用撤销按钮可恢复。",
+ "Loaded example template. Press Ctrl/Cmd+Z or use Undo to restore it.": "已加载示例模板。按 Ctrl/Cmd+Z 或使用撤销按钮可恢复。",
+ "Clear this draft?": "清空这个草稿?",
+ "This will empty the editor. The previous content is kept in Undo until you leave this draft.": "这会清空编辑器。离开此草稿前,原内容会保留在撤销记录中。",
+ "Clear draft": "清空草稿",
+ "Replace with the example template?": "替换为示例模板?",
+ "This will replace the current editor content. The previous content is kept in Undo until you leave this draft.": "这会替换当前编辑器内容。离开此草稿前,原内容会保留在撤销记录中。",
+ "Load template": "加载模板",
+ "Undo is available with Ctrl/Cmd+Z or the toolbar Undo button.": "可按 Ctrl/Cmd+Z,或使用工具栏撤销按钮恢复。",
"Applied AI edit to the selection.": "已将 AI 编辑应用到所选内容。",
"Applied {{action}} to the full draft.": "已对全文草稿执行{{action}}。",
"Applied auto-mark annotations.": "已应用自动批注。",
@@ -1112,6 +1122,10 @@
"Release to attach the files": "松开以上传这些文件",
"{{count}} files detected": "检测到 {{count}} 个文件",
"Updated": "最近更新",
+ "Last indexed": "最近索引",
+ "Not recorded yet": "暂无记录",
+ "{{count}} indexed doc": "索引了 {{count}} 个文档",
+ "{{count}} indexed docs": "索引了 {{count}} 个文档",
"Created": "创建时间",
"Index": "索引状态",
"Vector index ready": "向量索引已就绪",
diff --git a/web/next-env.d.ts b/web/next-env.d.ts
index c4b7818fb..9edff1c7c 100644
--- a/web/next-env.d.ts
+++ b/web/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/dev/types/routes.d.ts";
+import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.