mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-27 05:30:39 +00:00
* feat(runtime): honor the web UI language in replies and DeerMem updates Carry Settings > Appearance > Language as request-only run data: the Gateway validates context.locale against a finite allowlist, the lead agent prefers it for replies, and bundled DeerMem writes new facts and summary prose in it. Explicit user language requests still take precedence; checkpoint configurable, static prompts, and memory backend APIs are unchanged. Refs #7287 Co-Authored-By: Claude <noreply@anthropic.com> * fix(runtime): guard language context and pin locale maps * test(runtime): pin UI locales across frontend and Gateway Add the shared locale fixture and document the intentional language fallback for internal runs. Clarify live-locale precedence in the run context contract. --------- Co-authored-by: Claude <noreply@anthropic.com>
11 lines
387 B
Python
11 lines
387 B
Python
"""Finite UI-language preferences; arbitrary client text is never rendered."""
|
|
|
|
from collections.abc import Mapping
|
|
|
|
UI_LANGUAGES = {"en-US": "English", "zh-CN": "Simplified Chinese"}
|
|
|
|
|
|
def ui_locale(context: object) -> str | None:
|
|
value = context.get("locale") if isinstance(context, Mapping) else None
|
|
return value if isinstance(value, str) and value in UI_LANGUAGES else None
|