Files
DeepTutor/web/components
wayblink be14c3ef23 feat: separate UI and model response languages (#758)
* feat: separate UI and model response languages

* refactor(settings): keep one owner for the interface.json language rules

The legacy migration — a file written before the UI/response split
inherits its single language into both fields — had been duplicated into
both readers of interface.json, as had the theme/language defaults. Two
copies of a migration rule drift.

Move the rule into resolve_languages() in the module that owns the file,
have the router compose its superset of defaults on top of the service's,
and cover the agreement with a test that reads one legacy file through
both paths. The helper also drops the separate key-presence check:
_normalize_language already falls back to its default for missing, null
and unrecognized values alike.

* fix: keep the language bootstrap single and local-choice-first

Merging dev surfaced three collisions this branch had not seen:

- The new bootstrap fetched /settings/ui unconditionally and overwrote
  writeStoredLanguage on every mount, undoing #730's rule that a choice
  made in this browser is the more specific signal and must win. Folded it
  into the existing guarded effect so one fetch serves both language
  fields and neither can clobber a local selection.
- apiFetch/apiUrl ended up imported twice in AppShellContext, which git
  merged without a conflict and tsc rejects outright.
- Three tests still stubbed get_ui_language at call sites that now ask for
  get_response_language: the question router's stand-in module and two
  mastery_path patches (renamed the zh case to say response language).

* fix(api): include response_language in the pre-session UI read

The bootstrap adopts both languages from this one endpoint, so leaving
response_language out of the projection meant a fresh browser always
inherited the interface locale and never saw the saved output-language
preference. It belongs with the other two: all three are the visitor's
own presentation choices, none describe the deployment.

---------

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-08-07 03:13:04 +08:00
..
2026-08-02 13:23:45 +08:00
2026-08-02 13:23:45 +08:00
2026-08-02 13:23:45 +08:00
2026-07-31 00:25:48 +08:00
2026-08-02 13:23:45 +08:00
2026-06-17 10:50:44 +08:00
2026-06-17 00:56:27 +08:00
2026-06-17 10:50:44 +08:00
2026-07-31 00:25:48 +08:00
2026-07-31 00:25:48 +08:00
2026-06-11 20:03:34 +08:00
2026-06-21 14:43:41 +08:00