This commit is contained in:
IGNY8 VPS (Salman)
2025-11-26 12:53:10 +00:00
parent d7533934b8
commit 403432770b
2 changed files with 25 additions and 8 deletions

View File

@@ -208,12 +208,29 @@ class GenerateIdeasFunction(BaseAIFunction):
# Handle target_keywords
target_keywords = idea_data.get('covered_keywords', '') or idea_data.get('target_keywords', '')
# Map content_type and content_structure to ContentIdeas fields
# AI returns: content_type (post/page/product/service) → site_entity_type
# AI returns: content_structure (article/guide/review/comparison) → cluster_role (hub/supporting/attribute)
site_entity_type = idea_data.get('content_type', 'post') # post, page, product, service
# Map content_structure to cluster_role
content_structure = idea_data.get('content_structure', 'article')
structure_to_role = {
'article': 'hub',
'guide': 'supporting',
'review': 'supporting',
'comparison': 'attribute',
'listicle': 'supporting',
'product_page': 'attribute',
}
cluster_role = structure_to_role.get(content_structure, 'hub')
# Create ContentIdeas record
ContentIdeas.objects.create(
idea_title=idea_data.get('title', 'Untitled Idea'),
description=description,
content_type=idea_data.get('content_type', 'post'), # Updated: blog_post → post
content_structure=idea_data.get('content_structure', 'article'), # Updated: supporting_page → article
description=description, # Stored as JSON string
site_entity_type=site_entity_type,
cluster_role=cluster_role,
target_keywords=target_keywords,
keyword_cluster=cluster,
estimated_word_count=idea_data.get('estimated_word_count', 1500),

View File

@@ -123,17 +123,17 @@ Output JSON Example:
"introduction": {
"hook": "Transform your sleep with organic cotton that blends comfort and sustainability.",
"paragraphs": [
{"content_type": "paragraph", "details": "Overview of organic cotton's rise in bedding industry."},
{"content_type": "paragraph", "details": "Why consumers prefer organic bedding over synthetic alternatives."}
{"format": "paragraph", "details": "Overview of organic cotton's rise in bedding industry."},
{"format": "paragraph", "details": "Why consumers prefer organic bedding over synthetic alternatives."}
]
},
"H2": [
{
"heading": "Why Choose Organic Cotton for Bedding?",
"subsections": [
{"subheading": "Health and Skin Benefits", "content_type": "paragraph", "details": "Discuss hypoallergenic and chemical-free aspects."},
{"subheading": "Environmental Sustainability", "content_type": "list", "details": "Eco benefits like low water use, no pesticides."},
{"subheading": "Long-Term Cost Savings", "content_type": "table", "details": "Compare durability and pricing over time."}
{"subheading": "Health and Skin Benefits", "format": "paragraph", "details": "Discuss hypoallergenic and chemical-free aspects."},
{"subheading": "Environmental Sustainability", "format": "list", "details": "Eco benefits like low water use, no pesticides."},
{"subheading": "Long-Term Cost Savings", "format": "table", "details": "Compare durability and pricing over time."}
]
}
]