mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 16:23:17 +08:00
fix(chat): honor ui_lang on WebSocket turns; ops NE display by host_name
Resolve runtime language from ui_lang and chat.send lang instead of hardcoding zh. Align generalist/ops prompts with user language and require host_name (not ne_id) in ops outputs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3a467704d6
commit
f1626195f7
12 changed files with 86 additions and 27 deletions
21
runtime/lang.py
Normal file
21
runtime/lang.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
def resolve_runtime_lang(*, store: Any | None = None, hint: str | None = None) -> str:
|
||||
"""Resolve zh/en for agent runtime (WS, worker, HTTP share this helper)."""
|
||||
raw = str(hint or "").strip().lower()
|
||||
if raw in ("zh", "en"):
|
||||
return raw
|
||||
if store is not None:
|
||||
try:
|
||||
v = str(store.get_setting("ui_lang") or "zh").strip().lower()
|
||||
except Exception:
|
||||
v = "zh"
|
||||
if v in ("zh", "en"):
|
||||
return v
|
||||
return "zh"
|
||||
|
||||
|
||||
__all__ = ["resolve_runtime_lang"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue