Add Linker and Optimizer modules with API integration and frontend components

- Added Linker and Optimizer apps to `INSTALLED_APPS` in `settings.py`.
- Configured API endpoints for Linker and Optimizer in `urls.py`.
- Implemented `OptimizeContentFunction` for content optimization in the AI module.
- Created prompts for content optimization and site structure generation.
- Updated `OptimizerService` to utilize the new AI function for content optimization.
- Developed frontend components including dashboards and content lists for Linker and Optimizer.
- Integrated new routes and sidebar navigation for Linker and Optimizer in the frontend.
- Enhanced content management with source and sync status filters in the Writer module.
- Comprehensive test coverage added for new features and components.
This commit is contained in:
alorig
2025-11-18 00:41:00 +05:00
parent 4b9e1a49a9
commit f7115190dc
60 changed files with 4932 additions and 80 deletions

View File

@@ -176,8 +176,7 @@ class OptimizerService:
def _optimize_content(self, content: Content, scores_before: dict) -> Content:
"""
Internal method to optimize content.
This is a placeholder - in production, this would call the AI function.
Internal method to optimize content using AI function.
Args:
content: Content to optimize
@@ -186,14 +185,30 @@ class OptimizerService:
Returns:
Optimized Content instance
"""
# For now, return content as-is
# In production, this would:
# 1. Call OptimizeContentFunction AI function
# 2. Get optimized HTML
# 3. Update content
from igny8_core.ai.engine import AIEngine
from igny8_core.ai.registry import get_function_instance
# Prepare payload for AI function
payload = {
'ids': [content.id],
}
# Get function from registry
fn = get_function_instance('optimize_content')
if not fn:
raise ValueError("OptimizeContentFunction not found in registry")
# Execute AI function
ai_engine = AIEngine(account=content.account)
result = ai_engine.execute(fn, payload)
if not result.get('success'):
raise ValueError(f"Optimization failed: {result.get('error', 'Unknown error')}")
# The AI function's save_output method already updates the content
# We just need to refresh from database to get the updated content
content.refresh_from_db()
# Placeholder: We'll implement AI function call later
# For now, just return the content
return content
def analyze_only(self, content_id: int) -> dict: