imp part 5
This commit is contained in:
@@ -26,17 +26,7 @@ class ContentValidationService:
|
||||
"""
|
||||
errors = []
|
||||
|
||||
# Stage 3: Enforce "no cluster, no task" rule when feature flag enabled
|
||||
from django.conf import settings
|
||||
if getattr(settings, 'USE_SITE_BUILDER_REFACTOR', False):
|
||||
if not task.cluster:
|
||||
errors.append({
|
||||
'field': 'cluster',
|
||||
'code': 'missing_cluster',
|
||||
'message': 'Task must be associated with a cluster before content generation',
|
||||
})
|
||||
|
||||
# Stage 3: Validate entity_type is set
|
||||
# Validate entity_type is set
|
||||
if not task.content_type:
|
||||
errors.append({
|
||||
'field': 'content_type',
|
||||
|
||||
@@ -52,26 +52,12 @@ class ClusteringService:
|
||||
|
||||
# Delegate to AI task
|
||||
from igny8_core.ai.tasks import run_ai_task
|
||||
from django.conf import settings
|
||||
|
||||
payload = {
|
||||
'ids': keyword_ids,
|
||||
'sector_id': sector_id
|
||||
}
|
||||
|
||||
# Stage 1: When USE_SITE_BUILDER_REFACTOR is enabled, payload can include
|
||||
# taxonomy hints and dimension metadata for enhanced clustering.
|
||||
# TODO (Stage 2/3): Enhance clustering to collect and use:
|
||||
# - Taxonomy hints from SiteBlueprintTaxonomy
|
||||
# - Dimension metadata (context_type, dimension_meta) for clusters
|
||||
# - Attribute values from Keywords.attribute_values
|
||||
if getattr(settings, 'USE_SITE_BUILDER_REFACTOR', False):
|
||||
logger.info(
|
||||
f"Clustering with refactor enabled: {len(keyword_ids)} keywords, "
|
||||
f"sector_id={sector_id}, account_id={account.id}"
|
||||
)
|
||||
# Future: Add taxonomy hints and dimension metadata to payload
|
||||
|
||||
try:
|
||||
if hasattr(run_ai_task, 'delay'):
|
||||
# Celery available - queue async
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from rest_framework import serializers
|
||||
from django.conf import settings
|
||||
|
||||
from .models import Keywords, Clusters, ContentIdeas
|
||||
from igny8_core.auth.models import SeedKeyword
|
||||
@@ -69,12 +68,6 @@ class KeywordSerializer(serializers.ModelSerializer):
|
||||
]
|
||||
read_only_fields = ['id', 'created_at', 'updated_at', 'account_id', 'keyword', 'volume', 'difficulty', 'country']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Only include Stage 1 fields when feature flag is enabled
|
||||
if getattr(settings, 'USE_SITE_BUILDER_REFACTOR', False):
|
||||
self.fields['attribute_values'] = serializers.JSONField(read_only=True)
|
||||
|
||||
def validate(self, attrs):
|
||||
"""Validate that either seed_keyword_id OR custom keyword fields are provided"""
|
||||
# For create operations, need either seed_keyword_id OR custom keyword
|
||||
|
||||
@@ -22,7 +22,6 @@ DEBUG = os.getenv('DEBUG', 'False').lower() == 'true'
|
||||
# Set IGNY8_USE_UNIFIED_EXCEPTION_HANDLER=True to enable unified exception handler
|
||||
# Set IGNY8_DEBUG_THROTTLE=True to bypass rate limiting in development
|
||||
IGNY8_DEBUG_THROTTLE = os.getenv('IGNY8_DEBUG_THROTTLE', str(DEBUG)).lower() == 'true'
|
||||
USE_SITE_BUILDER_REFACTOR = os.getenv('USE_SITE_BUILDER_REFACTOR', 'false').lower() == 'true'
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'*', # Allow all hosts for flexibility
|
||||
|
||||
Reference in New Issue
Block a user