ai fix
This commit is contained in:
@@ -208,12 +208,29 @@ class GenerateIdeasFunction(BaseAIFunction):
|
|||||||
# Handle target_keywords
|
# Handle target_keywords
|
||||||
target_keywords = idea_data.get('covered_keywords', '') or idea_data.get('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
|
# Create ContentIdeas record
|
||||||
ContentIdeas.objects.create(
|
ContentIdeas.objects.create(
|
||||||
idea_title=idea_data.get('title', 'Untitled Idea'),
|
idea_title=idea_data.get('title', 'Untitled Idea'),
|
||||||
description=description,
|
description=description, # Stored as JSON string
|
||||||
content_type=idea_data.get('content_type', 'post'), # Updated: blog_post → post
|
site_entity_type=site_entity_type,
|
||||||
content_structure=idea_data.get('content_structure', 'article'), # Updated: supporting_page → article
|
cluster_role=cluster_role,
|
||||||
target_keywords=target_keywords,
|
target_keywords=target_keywords,
|
||||||
keyword_cluster=cluster,
|
keyword_cluster=cluster,
|
||||||
estimated_word_count=idea_data.get('estimated_word_count', 1500),
|
estimated_word_count=idea_data.get('estimated_word_count', 1500),
|
||||||
|
|||||||
@@ -123,17 +123,17 @@ Output JSON Example:
|
|||||||
"introduction": {
|
"introduction": {
|
||||||
"hook": "Transform your sleep with organic cotton that blends comfort and sustainability.",
|
"hook": "Transform your sleep with organic cotton that blends comfort and sustainability.",
|
||||||
"paragraphs": [
|
"paragraphs": [
|
||||||
{"content_type": "paragraph", "details": "Overview of organic cotton's rise in bedding industry."},
|
{"format": "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": "Why consumers prefer organic bedding over synthetic alternatives."}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"H2": [
|
"H2": [
|
||||||
{
|
{
|
||||||
"heading": "Why Choose Organic Cotton for Bedding?",
|
"heading": "Why Choose Organic Cotton for Bedding?",
|
||||||
"subsections": [
|
"subsections": [
|
||||||
{"subheading": "Health and Skin Benefits", "content_type": "paragraph", "details": "Discuss hypoallergenic and chemical-free aspects."},
|
{"subheading": "Health and Skin Benefits", "format": "paragraph", "details": "Discuss hypoallergenic and chemical-free aspects."},
|
||||||
{"subheading": "Environmental Sustainability", "content_type": "list", "details": "Eco benefits like low water use, no pesticides."},
|
{"subheading": "Environmental Sustainability", "format": "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": "Long-Term Cost Savings", "format": "table", "details": "Compare durability and pricing over time."}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user