mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-05 01:10:16 +08:00
Persian can now be chosen as the language the model replies in, reusing the same response-language seam that ar/ru/es/ms/hi already use: the shared SUPPORTED_RESPONSE_LANGUAGES set, the settings router Literal, the prompt language directive, the normalize aliases, and the web response-language options/union. This is reply-only: the UI locale stays English, and no Persian translation pack or RTL dashboard is introduced. That broader localization is a separate, design-level follow-up. Regenerated the contracts (openapi.json + api.ts) to reflect the router enum change so contracts:check stays green.
34 lines
648 B
Python
34 lines
648 B
Python
"""Supported reply languages used by core turn-request validation."""
|
|
|
|
SUPPORTED_RESPONSE_LANGUAGES: tuple[str, ...] = (
|
|
"en",
|
|
"zh",
|
|
"zh-tw",
|
|
"ja",
|
|
"ko",
|
|
"es",
|
|
"fr",
|
|
"de",
|
|
"ru",
|
|
"pt",
|
|
"it",
|
|
"ar",
|
|
"pl",
|
|
"uk",
|
|
"ms",
|
|
"vi",
|
|
"tr",
|
|
"hi",
|
|
"hu",
|
|
"fa",
|
|
)
|
|
|
|
|
|
def validate_reply_language_override(value: str | None) -> str | None:
|
|
"""Validate an explicit session choice; ``None`` follows the account default."""
|
|
if value is None:
|
|
return None
|
|
if value not in SUPPORTED_RESPONSE_LANGUAGES:
|
|
raise ValueError("Unsupported reply language")
|
|
return value
|