feat(ops): enforce English-only replies and localize netx protocol labels

Append english_output_guard when lang=en, strengthen ops/generalist EN role prompts,
pass NETX_TOOL_LANG into netx tools, and map Chinese protocol buckets to English.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-19 23:35:46 +08:00
parent 0de5f7bc98
commit 1366459ee0
10 changed files with 146 additions and 4 deletions

View file

@ -643,6 +643,14 @@ def _build_model_context(
final_system = f"{final_system}\n\n{ext.strip()}".strip()
except Exception:
pass
try:
from runtime.english_output_guard import english_output_guard_for_lang
guard = english_output_guard_for_lang(lang or "zh")
if guard:
final_system = f"{final_system}\n\n{guard}".strip()
except Exception:
pass
trunc_raw = str(store.get_setting("AIA_TOOL_CONTEXT_TRUNCATE_ENABLED") or "").strip().lower()
tool_context_truncate_enabled = trunc_raw not in ("0", "false", "no", "off")
llm_messages = build_llm_messages(