mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 03:30:48 +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
|
|
@ -148,8 +148,9 @@ def _safe_rel_avatar_name(name: str) -> str:
|
|||
|
||||
|
||||
def _api_lang(store: SqliteStore) -> str:
|
||||
v = str(store.get_setting("ui_lang") or "zh").strip().lower()
|
||||
return v if v in ("zh", "en") else "zh"
|
||||
from runtime.lang import resolve_runtime_lang
|
||||
|
||||
return resolve_runtime_lang(store=store)
|
||||
|
||||
|
||||
def _init_gateway_executor(
|
||||
|
|
|
|||
|
|
@ -4134,6 +4134,7 @@ async function renderChatUi() {
|
|||
memory_mode: String(memoryMode || "default"),
|
||||
execution_mode: String(executionMode || "agent"),
|
||||
plan_agent_version: outboundPlanAgentVersion(),
|
||||
lang: currentLang === "en" ? "en" : "zh",
|
||||
},
|
||||
};
|
||||
this.ws.send(JSON.stringify(req));
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ def build_gateway_context(
|
|||
"acp_parent_run_id": str(p.get("acp_parent_run_id") or ""),
|
||||
"acp_child_run_id": str(p.get("acp_child_run_id") or ""),
|
||||
"runId": rid,
|
||||
"lang": str(p.get("lang") or "").strip().lower() or None,
|
||||
}
|
||||
async def _delayed() -> None:
|
||||
await asyncio.sleep(0.05)
|
||||
|
|
@ -113,6 +114,7 @@ def build_gateway_context(
|
|||
"acp_parent_run_id": str(p.get("acp_parent_run_id") or ""),
|
||||
"acp_child_run_id": str(p.get("acp_child_run_id") or ""),
|
||||
"runId": run_id,
|
||||
"lang": str(p.get("lang") or "").strip().lower() or None,
|
||||
}
|
||||
with abort_lock:
|
||||
active_run_session[str(run_id)] = str(session_id)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from typing import Any, Callable
|
|||
from runtime.agents.factory import build_gateway_executor
|
||||
from runtime.chat.persist_terminal_fallback import persist_assistant_text_if_turn_missing
|
||||
from runtime.gateway import OclawGateway
|
||||
from runtime.lang import resolve_runtime_lang
|
||||
from runtime.types import StandardMessage
|
||||
from svc.config.paths import db_path
|
||||
from svc.persistence.sqlite_store import SqliteStore
|
||||
|
|
@ -164,7 +165,7 @@ async def run_agent_turn_via_bridge(
|
|||
ctx = conn.auth_ctx or {}
|
||||
tenant_id = str(ctx.get("tenant_id") or "")
|
||||
user_id = str(ctx.get("user_id") or "")
|
||||
lang = "zh"
|
||||
lang = resolve_runtime_lang(store=store, hint=str(p.get("lang") or ""))
|
||||
|
||||
manager_agent = build_gateway_executor(
|
||||
store,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue