fix(characters): reword stored Renaissance book profiles to high-fantasy medieval in image prompts

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-09-20 22:11:02 +02:00
parent 46967ade68
commit 69b5e06f02
2 changed files with 10 additions and 0 deletions

View File

@ -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"

View File

@ -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())