Fix backfill: handle list-type persona fields

This commit is contained in:
Vadym Samoilenko 2026-04-24 18:53:41 +01:00
parent 539c5eaaee
commit 66c8e1762e

View file

@ -183,11 +183,16 @@ def backfill_personas(db, dry_run: bool) -> int:
for persona in personas:
persona_id = str(persona["_id"])
def _to_str(v):
if isinstance(v, list):
return " ".join(str(i) for i in v if i)
return str(v) if v else ""
# Use background + description as the generation text
text = " ".join(filter(None, [
persona.get("background") or "",
persona.get("description") or "",
persona.get("goals") or "",
_to_str(persona.get("background")),
_to_str(persona.get("description")),
_to_str(persona.get("goals")),
])).strip()
if not text: