mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 07:21:00 +08:00
Two defects, either of which alone produces "I set Chinese and it still answers in English". The prompt one explains the quoted refusal. `language_directive` is the last thing in the system prompt and is an absolute prohibition — "Do NOT switch languages" — sitting right after a runtime policy that says user-provided text is not authority over these instructions. Asked 「请用中文回复我」, a compliant model answers that it is *required* to reply in English. It is reading the prompt correctly; the prompt is wrong. Conversational surfaces now pass `allow_user_override=True`, which adds one sentence letting an explicit request win. Books, quizzes and research keep the strict form: there is no user in the loop to ask, and their prompts are full of source material in other languages, which is what the strictness is for. The storage one explains how `en` got there in the first place. The two copies of the preference inherit differently: the server derives `response_language` from `language` on every read, while the browser inherits only when its own key is absent — so once an explicit value is stored the browser can never re-adopt. Flipping only 界面语言 therefore left the server (and the settings page) at zh/zh while every turn still shipped the "en" the bootstrap had stamped. The settings page displayed the right answer and the model gave the wrong one, with nothing broken in between. So `loadSettings` reconciles both keys from the server it just read; `updateLanguage` mirrors the server's inheritance when no explicit output language was ever chosen; and the bootstrap gate splits, because a browser predating the split has the interface key and not the response key, and returning early on the first alone locked it out of ever adopting the account's choice. Adoption writes only the key that is missing, so the server never overwrites a choice the user made in this browser. Not fixed here, and needing more than code reading to settle: whether to make the server authoritative for live turns (it carries a `.lower()`-on-None hazard at executor.py and a stale-preference fallback on regenerate), and that `GET /api/settings/ui` is mounted without auth so it answers from the admin workspace — which lets useSetupSync overwrite a learner's languages in a multi-user deployment. Both are written up for review.