refactor-migration again

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-26 15:12:14 +00:00
parent 2ef98b5113
commit f88aae78b1
23 changed files with 942 additions and 211 deletions

View File

@@ -208,29 +208,16 @@ 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
# Direct mapping - no conversion needed
content_type = idea_data.get('content_type', 'post')
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, # Stored as JSON string
site_entity_type=site_entity_type,
cluster_role=cluster_role,
content_type=content_type,
content_structure=content_structure,
target_keywords=target_keywords,
keyword_cluster=cluster,
estimated_word_count=idea_data.get('estimated_word_count', 1500),

View File

@@ -145,7 +145,15 @@ Output JSON Example:
"covered_keywords": "organic duvet covers, eco-friendly bedding, sustainable sheets"
}
]
}""",
}
Valid content_type values: post, page, product, taxonomy
Valid content_structure by type:
- post: article, guide, comparison, review, listicle
- page: landing_page, business_page, service_page, general, cluster_hub
- product: product_page
- taxonomy: category_archive, tag_archive, attribute_archive""",
'content_generation': """You are an editorial content strategist. Your task is to generate a complete JSON response object based on the provided content idea, keyword cluster, keyword list, and metadata context.
@@ -196,11 +204,11 @@ STYLE & QUALITY RULES
STAGE 3: METADATA CONTEXT (NEW)
===========================
**Cluster Role:**
[IGNY8_CLUSTER_ROLE]
- If role is "hub": Create comprehensive, authoritative content that serves as the main resource for this topic cluster. Include overview sections, key concepts, and links to related topics.
- If role is "supporting": Create detailed, focused content that supports the hub page. Dive deep into specific aspects, use cases, or subtopics.
- If role is "attribute": Create content focused on specific attributes, features, or specifications. Include detailed comparisons, specifications, or attribute-focused information.
**Content Structure:**
[IGNY8_CONTENT_STRUCTURE]
- If structure is "cluster_hub": Create comprehensive, authoritative content that serves as the main resource for this topic cluster. Include overview sections, key concepts, and links to related topics.
- If structure is "article" or "guide": Create detailed, focused content that dives deep into the topic with actionable insights.
- Other structures: Follow the appropriate format (listicle, comparison, review, landing_page, service_page, product_page, category_archive, tag_archive, attribute_archive).
**Taxonomy Context:**
[IGNY8_TAXONOMY]