generate seo text when draft created

This commit is contained in:
2025-04-15 20:09:22 +03:00
parent 710f522c8f
commit b9f6033e66
5 changed files with 18 additions and 3 deletions

View File

@@ -114,6 +114,10 @@ async def create_draft(_, info, draft_input):
# Remove id from input if present since it's auto-generated
if "id" in draft_input:
del draft_input["id"]
if "seo" not in draft_input and not draft_input["seo"]:
body_teaser = draft_input.get("body", "")[:300].split('\n')[:-1].join("\n")
draft_input["seo"] = draft_input.get("lead", body_teaser)
# Добавляем текущее время создания
draft_input["created_at"] = int(time.time())