fix(ops): English replies from English prompts and ROLE_SYSTEM.en

Detect language from user message before UI hint, load ops ROLE_SYSTEM.en.md when en, and wire user_text through WS/HTTP/worker paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-19 22:41:46 +08:00
parent f1626195f7
commit 0de5f7bc98
9 changed files with 151 additions and 19 deletions

View file

@ -147,10 +147,10 @@ def _safe_rel_avatar_name(name: str) -> str:
return raw or "avatar.png"
def _api_lang(store: SqliteStore) -> str:
def _api_lang(store: SqliteStore, *, user_text: str | None = None) -> str:
from runtime.lang import resolve_runtime_lang
return resolve_runtime_lang(store=store)
return resolve_runtime_lang(store=store, user_text=user_text)
def _init_gateway_executor(
@ -1971,7 +1971,7 @@ def include_chat_routes(router: APIRouter, *, resolve_auth: Callable[[SqliteStor
attachment_id=aid,
source="user_upload",
)
lang = _api_lang(store)
lang = _api_lang(store, user_text=text)
apply_gateway_mcp_env_to_os()
manager_agent = _init_gateway_executor(
store,
@ -2114,7 +2114,7 @@ def include_chat_routes(router: APIRouter, *, resolve_auth: Callable[[SqliteStor
attachment_id=aid,
source="user_upload",
)
lang = _api_lang(store)
lang = _api_lang(store, user_text=text)
apply_gateway_mcp_env_to_os()
manager_agent = _init_gateway_executor(
store,