* fix(i18n): accept Korean as a backend interface language
The web picker offers Korean (added in #2359), but the backend UiLanguage
contract, its normalizers and the settings spec never learned "ko". Choosing
Korean and applying settings therefore fails with HTTP 422 on
PUT /api/settings/ui, and the saved language falls back to English on the
next load.
Register "ko" in the same seams Japanese used in #2213: UiLanguage and
_normalize_language() in interface_settings.py, the launch-settings
normalizer, and _LANGUAGE_CHOICES in settings_spec.py, then regenerate the
frontend API contracts. Add Korean to the existing router and launch-settings
tests, and add a registry test that fails whenever a web APP_LANGUAGES code
is missing from the backend contract.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style: apply ruff format
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix(imagegen): prefill image models the providers still serve
The OpenAI image provider prefilled gpt-image-1, which OpenAI retired on 2026-10-23, and OpenRouter prefilled google/gemini-2.5-flash-image-preview, which OpenRouter no longer lists, so a user who kept the prefill got a failing first request. They now prefill gpt-image-2 and google/gemini-3.1-flash-image.
* fix(imagegen): prefill gpt-image-2.6-flare instead of gpt-image-2
OpenAI shuts gpt-image-2 down on 2027-02-10 and names gpt-image-2.6-flare or -sunburst as the replacement; its image guide recommends the 2.6 models for new integrations. Flare is the general, fast-iteration model and uses the same Images API, so the OpenAI prefill moves to it now instead of to another retiring model.
* feat(rag): support local rerankers for LightRAG queries
Allow administrators to select a cross-encoder alongside the native LightRAG role models. Run scoring in a reusable worker and partition cached answers by reranker so model changes take effect on existing indexes.
Refs #2701
* fix(api): refresh the router index for LightRAG settings
* fix(rag): run LightRAG reranking in the shared reranker worker
anyio's process pool re-runs the server's __main__ file by path. When the
backend runs as `python -m deeptutor_cli.main serve` (the desktop app),
that file's relative imports fail, so every rerank call failed with
'Error during worker process initialization' and LightRAG silently kept
the original chunk order. Reuse the python -m reranker worker that the
LlamaIndex pipeline already uses.
---------
Co-authored-by: lipeih <lipeihan@eazytec.com>
Co-authored-by: zszz3 <zszz3@users.noreply.github.com>
* fix(settings): answer 404 for unknown connection-test run ids
* chore(api): refresh router index for the settings route change
tests/api/test_router_loader.py::test_repository_index_matches_router_sources
checks the fingerprint of router sources; regenerated with
scripts/build_router_index.py.
---------
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
* fix(config): keep a settings document that cannot be parsed instead of resetting it
* fix(config): re-warn about an unparseable settings document once a minute
The startup load runs before logging is configured, so its only record can
reach just the process output, and the permanent per-path set meant it never
appeared in the application log afterwards. Throttle per path instead, and
state in the containerization guide where the warning is written and that
the loader only preserves documents it cannot parse.
* fix(book): retry an interactive page with thinking off when it runs out of room
deepseek-flash thinks by default and can spend the whole 16000-token
visualize budget on reasoning, so a book interactive block came back with
no code. When the page is empty or cut off before </html>, ask once more
with thinking turned off (thinking_off_effort_for) before failing. If that
still runs out of room, the error names the budget sent to the model and
the settings that change it.
The shipped default stays at 16000: the budget is shared by every visualize
caller, and 32768 breaks models with a lower output cap (#3018).
Refs #3011
* fix(llm): raise the visualize budget to 32k and cap each request to the model
A thinking model can spend 16k tokens before it writes any code, so the
visualize default is now 32768. Sent unchanged that would be rejected by
models whose output stops lower (gpt-4o and gpt-4o-mini at 16384) and could
overflow a small local context window, so every request now carries
min(budget, the model's known output limit, half the configured context
window). The cap lives in get_token_limit_kwargs, so it applies to every
caller; BaseAgent and the agentic loop pass the configured window.
deepseek-flash thinks by default and spent the whole 16000-token visualize
budget on reasoning, so book interactive blocks came back with no code.
Raise the default to 32768 and make the book's interactive errors name the
two settings that fix it: Max tokens under Settings -> Capabilities ->
Visualize, or turning off thinking for the model.
* fix(math_animator): make the code-repair deadline configurable
The render-fix loop's overall repair timeout was fixed at 180s: run_render
built CodeRetryManager without passing repair_timeout_seconds, so the knob
existed on the manager but was unreachable from settings. A long reasoning
model repairing a book animation was cancelled mid-edit at that ceiling with
no way to raise it (#2767).
Lift the deadline into a runtime setting capabilities.math_animator.repair_timeout
in main.yaml, read once in run_render through a get_math_animator_params getter
that shares the UI's coerce/clamp path. The single read site covers all three
callers (math_animator capability, visualize Manim route, book AnimationGenerator),
and an in-flight render keeps the value it started with. The apply branch only
persists when the key is present, so saving unrelated animation settings does not
shadow the loop's default (#1316 shape). Clarify both repair-timeout errors to name
the stage, the effective seconds, and that this is a local deadline rather than a
provider connection failure.
Backend only; the Settings-form field is left to a follow-up and failure-stage
diagnostics/artifact retention to #2768.
* fix(config): keep repair timeout default out of settings saves
The Settings page PUTs the full GET DTO, so exposing the runtime default caused unrelated saves to persist repair_timeout=180. Omit it until explicitly configured, cover the full round trip, and soften the timeout diagnostic.
---------
Co-authored-by: ZQR1101 <278034003+ZQR1101@users.noreply.github.com>
Combine Hungarian with Italian UI and Hindi reply-language registries; translate 49 newly integrated keys and add the Hungarian endonym to Italian. Regenerate router and frontend contracts. 33 Python locale tests, full Node suite and locale parity pass.
Make Italian quality tests compatible with CommonJS Node test compiler; accept Italiano as reply-language alias; translate 48 keys added by other integrated PRs; regenerate router index and format i18n. 26 Python locale tests and full Node suite pass.
The Zhipu web-search provider hardcoded search_std, leaving search_pro
( higher recall, 3x price ) unreachable from any configuration surface.
- providers/zhipu.py resolves the engine from the call-time value, then
the provider config's search_engine/engine field, then search_std;
only search_std/search_pro are allowed and unknown values warn and
fall back to the default instead of raising.
- The engine rides the resolved search config the same way max_results
and proxy do: active search profile field first, then
tools.web_search.search_engine in main.yaml, then None (provider
default), injected into the provider kwargs by web_search().
- get_current_config() surfaces the resolved engine.
Tests cover the default payload, config-driven search_pro, the engine
alias, invalid values warning and falling back, and the end-to-end
settings -> resolved config -> real ZhipuProvider -> payload flow.
Add SearchApi (searchapi.io) as a web-search provider, following the Serply
shape: one key, three modes (search -> google, news -> google_news,
scholar -> google_scholar) behind a single GET endpoint selected by the
`engine` parameter. Rows are plain SERP results, so consolidation still
writes the answer and Scholar rows render through the shared academic
template via the `searchapi_scholar` -> `serper_scholar` mapping.
- Key travels only as `Authorization: Bearer`, never in the URL; requests
carry `Accept: application/json` and `User-Agent: DeepTutor`.
- Google retired `num` for web and news results, so those are cut
client-side with `max_results`; Scholar still honors `num` (capped at 20).
- News sends `link=resolved` so links point at the publisher instead of a
Google redirect, and prefers `iso_date` over the relative `date`.
- Scholar maps `publication`, `inline_links.cited_by.total`, `resource.link`
and `data_cid` onto the Serper attribute keys; a dead `javascript:` PDF
badge is dropped.
- Non-200 raises with the API's `error` message; a non-JSON body raises too.
- Spec table entry (`requires_api_key=True, soft_fallback=False`), registry
import, consolidation mapping and `deeptutor init` wizard entry reading
`SEARCHAPI_API_KEY` / `SEARCH_API_KEY`.
- Nine tests mirroring the Serply block, with fixtures shaped after live
responses from each engine.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Addresses Air R1/R2 review blockers on top of the opened PR head:
Settings GET/PUT /api/settings/web-fetch with UI control; DeepSeek fetch
uses identity encoding, raw bytes, and capacity checks before buffer extend;
provider-branding treats `local` as generic.
Air Codex R3 on MacBook Air: READY.
Add a FETCH_PROVIDERS spec table next to SEARCH_PROVIDERS and a
deeptutor/services/fetch/providers registry, mirroring the search-provider
shape: local (the unchanged in-process extractor, default) and deepseek
(POST /v1/tools/fetch, Bearer auth; key from kwargs > env > DeepSeek chat
profile).
fetch_url_as_markdown gains backend=None -> DEEPTUTOR_FETCH_BACKEND ->
local. The scheme/SSRF gate runs before any remote backend so a private
URL is never handed to a third party. Retryable backend failures
(401/402/403/408/429/5xx, network, missing key) fall back to the local
extractor; 400/404/413 and an empty body are hard failures. Remote
outcomes keep the requested URL for citations; the crawler/KB site sync
stay local. All tests mock HTTP offline.
Engine-level search provider backed by DeepSeek's /v1/tools/search endpoint,
distinct from the model-side web_search tool mapping: works with any
configured LLM. Rows carry no model-written answer, so consolidation still
supplies it.
- providers/deepseek.py: Bearer auth, count capped 1-50, need_content
default False (page Markdown kept in SearchResult.content only when
requested), summary preferred over snippet as the model-facing blurb,
authority/rerank_score in attributes, proxy honored, base_url used
verbatim with the documented endpoint as fallback. No new dependency.
- SEARCH_PROVIDERS: label DeepSeek, requires_api_key=True,
soft_fallback=False (billed per request; a missing key raises instead
of landing on DuckDuckGo).
- Init wizard entry with DEEPSEEK_API_KEY/SEARCH_API_KEY env keys, keeping
the wizard set equal to the backend table.
- TracePresentation PROVIDER_LABELS: deepseek -> DeepSeek (titleCase would
render "Deepseek").
- Tests: row mapping, 401/402/429 paths, missing key fails before network,
and the base_url/proxy/max_results contract via _NEW_PROVIDERS.
GET /v1/web-search with Bearer auth, answer-first: the confirmed answer
maps onto WebSearchResponse.answer (supports_answer), ranked sources onto
citations/search_results, and list rows ride along in metadata. No count
parameter exists on the endpoint, so max_results caps client-side like
Aliyun IQS. Registered in the SEARCH_PROVIDERS spec table as a paid
provider (soft_fallback=False); tests mock requests offline.
Closes#2516
Add Hindi (hi, हिन्दी) to the reply-language contract, following step 4
of docs-for-dev/I18N.md and the earlier Malay change (550268e1):
- SUPPORTED_RESPONSE_LANGUAGES, the settings router's ResponseLanguage,
the prompt-language label and the settings-spec reply choices;
- "hindi", "हिन्दी" and "हिंदी" aliases in the backend and web
normalizers (hi-IN and hi_IN resolve through the base code);
- the web ResponseLanguage type, isResponseLanguage() and
RESPONSE_LANGUAGE_OPTIONS, which the partner picker shares;
- regenerated frontend contracts, and tests mirroring the Malay change.
The interface language is unchanged: no web catalog or picker entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds a complete Hungarian (hu) locale alongside the existing catalogs, wired
through every seam a language has to pass so none of them silently serves
English to a Hungarian reader.
Frontend: the hu catalog covers all 6,584 English keys with matching
interpolation placeholders, registered in the locale registry, the lazy bundle
loader, Intl date/number formatting (hu-HU) and the reply-language picker.
`language.hungarian` ("Magyar") is added to every existing catalog so the
endonym is shown whatever the current interface language is.
Backend: "hu" is accepted by the launch, interface and reply-language
normalizers and offered in both settings choice lists, named in the prompt
language labels, and carries the Hungarian copy of the CLI-app, MCP and
sandbox messages, the quiz-judge prompt, the book export labels, the book
overview front page and the voice language list.
Scope: the CLI installer banner (`deeptutor/runtime/banner.py`) keeps its
English text for hu and falls back through `_pick_language`; it is terminal
setup copy unused in server deployments and is left for a follow-up.
Evidence:
- `python -m pytest tests/i18n/test_hungarian_locale.py` — 33 passed
- `npm run test:node` — 1353 passed (adds hungarian-locale-quality.test.ts)
- `npm run typecheck` — clean
- `node scripts/i18n_parity.mjs` — OK
- `node scripts/i18n_audit.mjs` — hu: 4529/4529 used keys (100.0%), strict
- `node scripts/generate-contracts.mjs --check` — no drift
- `ruff format --check` / `ruff check` on the touched Python files — clean
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- add the 760 English keys missing from the French catalog and translate 229 values still copied from English\n- make a partner's empty reply language (Auto) follow the account model output language instead of hardcoding English\n- label Auto with the configured language and offer every supported response language in the picker\n- localize the Feishu thinking notice for every supported response language\n- add French catalog, picker and partner runtime regression tests
Add a complete Japanese web catalog (web/locales/ja/app.json, every key
of the English catalog) and register "ja" wherever the other interface
languages are listed: the web language registry and loader, date
formatting, the backend UI-language setting and launch settings, and the
generated API contracts. Each existing catalog gains language.japanese.
Japanese was already a reply language; this makes it an interface
language too, following the Polish integration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The container backend runs as the unprivileged deeptutor user while
supervisor leaves HOME pointing at root's home. mineru_models_ready()
probed <HOME>/.cache/modelscope/hub/models outside its try/except, so
the PermissionError propagated into build_settings_readiness(), which
maps any exception to parser_probe_failed and shows no cause in the UI.
- mineru_models_ready(): treat an unreadable/absent cache root as
"cannot confirm" and return False (models_missing) instead of raising.
- build_settings_readiness(): log the parser probe exception with a
traceback before recording parser_probe_failed.
- Dockerfile: create /home/deeptutor and set HOME for the backend and
frontend supervisor programs, so profile data resolves under the
service user.
- Add a regression test for the unreadable-cache-root case.
Registers tr in every list that decides which languages exist: the reply-language whitelist and labels, the interface and launcher normalizers, the Settings choices, the web registry and lazy loader, the date locale, the response-language store and the API contract.