Allow empty text for non-target AI rewrites
This commit is contained in:
@@ -152,8 +152,6 @@ def validate_rewrites(
|
||||
if post_id not in expected_ids:
|
||||
raise ValueError(f"AI returned unexpected id={post_id}")
|
||||
text = strip_leading_emoji_markers(str(item.get("text") or "").strip())
|
||||
if len(text) < 40:
|
||||
raise ValueError(f"AI returned too short rewrite for id={post_id}")
|
||||
by_id = {int(c["id"]): c for c in categories if c.get("id") is not None}
|
||||
by_name = {str(c["name"]).lower(): c for c in categories if c.get("name")}
|
||||
if item.get("category_id") is not None:
|
||||
@@ -170,6 +168,8 @@ def validate_rewrites(
|
||||
seen.add(post_id)
|
||||
category_tag = normalize_hash_tag(category_row.get("tag") or category_row.get("name") or "", "category")
|
||||
reject_by_category = int(category_row["id"]) == NON_TARGET_CATEGORY_ID or category_tag.lower() in NON_TARGET_CATEGORY_TAGS
|
||||
if not reject_by_category and len(text) < 40:
|
||||
raise ValueError(f"AI returned too short rewrite for id={post_id}")
|
||||
out.append(
|
||||
{
|
||||
"id": post_id,
|
||||
|
||||
Reference in New Issue
Block a user