Fix backfill: handle list-type persona fields
This commit is contained in:
parent
539c5eaaee
commit
66c8e1762e
1 changed files with 8 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue