chore(agent): use Chinese labels in user message context
This commit is contained in:
@@ -55,14 +55,16 @@ def test_user_message_carries_turn_context():
|
||||
form = {"vehicle_count": 0, "has_injury": False, "is_on_scene": False}
|
||||
message = _build_user_message({"input_text": "两辆", "accident_fields": form}, now=now)
|
||||
assert "<turn_context>" in message
|
||||
form_line = next(line for line in message.splitlines() if line.startswith("form:"))
|
||||
assert json.loads(form_line.removeprefix("form:")) == form
|
||||
unfilled_line = next(line for line in message.splitlines() if line.startswith("form_unfilled_fields:"))
|
||||
assert json.loads(unfilled_line.removeprefix("form_unfilled_fields:")) == [
|
||||
form_line = next(line for line in message.splitlines() if line.startswith("当前表单:"))
|
||||
assert json.loads(form_line.removeprefix("当前表单:")) == form
|
||||
unfilled_line = next(line for line in message.splitlines() if line.startswith("表单未填写字段:"))
|
||||
assert json.loads(unfilled_line.removeprefix("表单未填写字段:")) == [
|
||||
"accident_cause", "has_non_motor_vehicle_hit", "accident_time",
|
||||
]
|
||||
empty_message = _build_user_message({"input_text": "两辆"}, now=now)
|
||||
assert "form_unfilled_fields" not in empty_message
|
||||
assert "表单未填写字段" not in empty_message
|
||||
assert "form:" not in message
|
||||
assert "form_unfilled_fields:" not in message
|
||||
assert "本轮参考时间:2026-10-22 08:00:00 +0000" in message
|
||||
assert "<user_input>" in message
|
||||
assert "两辆" in message
|
||||
@@ -73,7 +75,7 @@ def test_workflow_collection_receives_form_in_user_context():
|
||||
node = next(n for n in workflow["nodes"] if n["name"] == "事故信息收集")
|
||||
message = next(i["value"] for i in node["inputs"] if i["key"] == "userChatInput")
|
||||
context = message.split("</turn_context>", 1)[0]
|
||||
assert "form:{{$VARIABLE_NODE_ID.bNJkeXot$}}" in context
|
||||
assert "当前表单:{{$VARIABLE_NODE_ID.bNJkeXot$}}" in context
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user