new RPG system

This commit is contained in:
2026-06-05 14:57:15 +03:00
parent 6189a5fb74
commit 01b16dbeaa
29 changed files with 2395 additions and 311 deletions
+13 -3
View File
@@ -29,7 +29,7 @@ def test_messages_for_llm_includes_narrator_ruling_not_original_only():
},
{"role": "narrator", "content": narrator_json},
]
llm = messages_for_llm(history, "system+runtime")
llm = messages_for_llm(history, "system+runtime", rp_lang="en")
user_msgs = [m for m in llm if m["role"] == "user"]
assert len(user_msgs) == 2
assert "canonical outcome" in user_msgs[0]["content"].lower()
@@ -39,14 +39,24 @@ def test_messages_for_llm_includes_narrator_ruling_not_original_only():
assert "Do NOT write a success version" in user_msgs[1]["content"]
def test_format_narrator_failure_wording():
def test_format_narrator_failure_wording_en():
text = format_narrator_outcome_for_llm(
{"roll": 5, "outcome": "failure", "text": "It failed."}
{"roll": 5, "outcome": "failure", "text": "It failed."},
lang="en",
)
assert "FAILED" in text
assert "Do NOT write a success version" in text
def test_format_narrator_failure_wording_ru():
text = format_narrator_outcome_for_llm(
{"roll": 5, "outcome": "failure", "text": "Не вышло."},
lang="ru",
)
assert "ОБЯЗАТЕЛЬНО" in text
assert "Не удалось" in text or "НЕ удалось" in text
def test_parse_narrator_message_roundtrip():
raw = narrator_message_content({"roll": 12, "outcome": "success", "text": "OK"})
data = parse_narrator_message(raw)