From 69b5e06f027b8fd0dd5af2edc2075a6d59524a6d Mon Sep 17 00:00:00 2001 From: mARTin-B78 Date: Sun, 20 Sep 2026 22:11:02 +0200 Subject: [PATCH] fix(characters): reword stored Renaissance book profiles to high-fantasy medieval in image prompts Co-Authored-By: Claude Sonnet 5 --- routes/conversation.py | 3 +++ tests/test_character_identity.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/routes/conversation.py b/routes/conversation.py index 8bedc48..208751d 100644 --- a/routes/conversation.py +++ b/routes/conversation.py @@ -1844,6 +1844,9 @@ def _book_visual_context(book: str, book_profile: dict) -> str: _visual_prompt_value(book_profile.get("visual_context")), ] context = "; ".join(value for value in values if value) + # Stored book profiles still say "early Renaissance 1420-1500", which pulls musketeer/wartime dress. + context = re.sub(r"(?:early[- ]?)?renaissance|fr[üu]h(?:-)?renaissance", "high-fantasy medieval", context, flags=re.IGNORECASE) + context = re.sub(r"\b1420\s*[–-]\s*1500\b", "roughly 900-1300 AD", context) return context or ( f"the established world and period of {book}" if book else "the story's established world and historical period" diff --git a/tests/test_character_identity.py b/tests/test_character_identity.py index 67197c8..fdd5acc 100644 --- a/tests/test_character_identity.py +++ b/tests/test_character_identity.py @@ -189,6 +189,13 @@ class PromptHygieneTests(unittest.TestCase): self.assertNotIn("blut", text.lower()) self.assertNotIn("verbunden", text.lower()) + def test_a_stored_renaissance_book_profile_is_reworded(self): + from routes.conversation import _book_visual_context + text = _book_visual_context("B", {"era": "Frühren aissance".replace(" ", ""), "setting": "early-Renaissance fantasy world, approximately 1420–1500"}) + self.assertNotIn("enaissance", text) + self.assertNotIn("1420", text) + self.assertIn("medieval", text) + def test_a_tricorn_hat_becomes_a_helm(self): self.assertNotIn("dreispitz", self.facts(clothing="Rüstung mit Dreispitz").lower())