8 Phases refactor
This commit is contained in:
@@ -36,8 +36,6 @@ class AIEngine:
|
||||
return f"{count} task{'s' if count != 1 else ''}"
|
||||
elif function_name == 'generate_site_structure':
|
||||
return "1 site blueprint"
|
||||
elif function_name == 'generate_page_content':
|
||||
return f"{count} page{'s' if count != 1 else ''}"
|
||||
return f"{count} item{'s' if count != 1 else ''}"
|
||||
|
||||
def _build_validation_message(self, function_name: str, payload: dict, count: int, input_description: str) -> str:
|
||||
@@ -91,8 +89,6 @@ class AIEngine:
|
||||
if blueprint and getattr(blueprint, 'name', None):
|
||||
blueprint_name = f'"{blueprint.name}"'
|
||||
return f"Preparing site blueprint {blueprint_name}".strip()
|
||||
elif function_name == 'generate_page_content':
|
||||
return f"Preparing {count} page{'s' if count != 1 else ''} for content generation"
|
||||
return f"Preparing {count} item{'s' if count != 1 else ''}"
|
||||
|
||||
def _get_ai_call_message(self, function_name: str, count: int) -> str:
|
||||
@@ -107,8 +103,6 @@ class AIEngine:
|
||||
return f"Creating image{'s' if count != 1 else ''} with AI"
|
||||
elif function_name == 'generate_site_structure':
|
||||
return "Designing complete site architecture"
|
||||
elif function_name == 'generate_page_content':
|
||||
return f"Generating structured page content"
|
||||
return f"Processing with AI"
|
||||
|
||||
def _get_parse_message(self, function_name: str) -> str:
|
||||
@@ -123,8 +117,6 @@ class AIEngine:
|
||||
return "Processing images"
|
||||
elif function_name == 'generate_site_structure':
|
||||
return "Compiling site map"
|
||||
elif function_name == 'generate_page_content':
|
||||
return "Structuring content blocks"
|
||||
return "Processing results"
|
||||
|
||||
def _get_parse_message_with_count(self, function_name: str, count: int) -> str:
|
||||
@@ -145,8 +137,6 @@ class AIEngine:
|
||||
return "Writing In‑article Image Prompts"
|
||||
elif function_name == 'generate_site_structure':
|
||||
return f"{count} page blueprint{'s' if count != 1 else ''} mapped"
|
||||
elif function_name == 'generate_page_content':
|
||||
return f"{count} page{'s' if count != 1 else ''} with structured blocks"
|
||||
return f"{count} item{'s' if count != 1 else ''} processed"
|
||||
|
||||
def _get_save_message(self, function_name: str, count: int) -> str:
|
||||
@@ -164,8 +154,6 @@ class AIEngine:
|
||||
return f"Assigning {count} Prompts to Dedicated Slots"
|
||||
elif function_name == 'generate_site_structure':
|
||||
return f"Publishing {count} page blueprint{'s' if count != 1 else ''}"
|
||||
elif function_name == 'generate_page_content':
|
||||
return f"Saving {count} page{'s' if count != 1 else ''} with content blocks"
|
||||
return f"Saving {count} item{'s' if count != 1 else ''}"
|
||||
|
||||
def execute(self, fn: BaseAIFunction, payload: dict) -> dict:
|
||||
@@ -524,16 +512,14 @@ class AIEngine:
|
||||
'generate_image_prompts': 'image_prompt_extraction',
|
||||
'generate_images': 'image_generation',
|
||||
'generate_site_structure': 'site_structure_generation',
|
||||
'generate_page_content': 'content_generation', # Site Builder page content
|
||||
}
|
||||
return mapping.get(function_name, function_name)
|
||||
|
||||
def _get_estimated_amount(self, function_name, data, payload):
|
||||
"""Get estimated amount for credit calculation (before operation)"""
|
||||
if function_name == 'generate_content' or function_name == 'generate_page_content':
|
||||
if function_name == 'generate_content':
|
||||
# Estimate word count - tasks don't have word_count field, use default
|
||||
# For generate_content, data is a list of Task objects
|
||||
# For generate_page_content, data is a PageBlueprint object
|
||||
# data is a list of Task objects
|
||||
if isinstance(data, list) and len(data) > 0:
|
||||
# Multiple tasks - estimate 1000 words per task
|
||||
return len(data) * 1000
|
||||
@@ -554,7 +540,7 @@ class AIEngine:
|
||||
|
||||
def _get_actual_amount(self, function_name, save_result, parsed, data):
|
||||
"""Get actual amount for credit calculation (after operation)"""
|
||||
if function_name == 'generate_content' or function_name == 'generate_page_content':
|
||||
if function_name == 'generate_content':
|
||||
# Get actual word count from saved content
|
||||
if isinstance(save_result, dict):
|
||||
word_count = save_result.get('word_count')
|
||||
|
||||
Reference in New Issue
Block a user