Add SEO fields to Tasks model, improve content generation response handling, and enhance progress bar animation
- Added primary_keyword, secondary_keywords, tags, and categories fields to Tasks model - Updated generate_content function to handle full JSON response with all SEO fields - Improved progress bar animation: smooth 1% increments every 300ms - Enhanced step detection for content generation vs clustering vs ideas - Fixed progress modal to show correct messages for each function type - Added comprehensive logging to Keywords and Tasks pages for AI functions - Fixed error handling to show meaningful error messages instead of generic failures
This commit is contained in:
41
backend/igny8_core/ai/constants.py
Normal file
41
backend/igny8_core/ai/constants.py
Normal file
@@ -0,0 +1,41 @@
|
||||
"""
|
||||
AI Constants - Model pricing, valid models, and configuration constants
|
||||
"""
|
||||
# Model pricing (per 1M tokens) - EXACT from reference plugin model-rates-config.php
|
||||
MODEL_RATES = {
|
||||
'gpt-4.1': {'input': 2.00, 'output': 8.00},
|
||||
'gpt-4o-mini': {'input': 0.15, 'output': 0.60},
|
||||
'gpt-4o': {'input': 2.50, 'output': 10.00},
|
||||
}
|
||||
|
||||
# Image model pricing (per image) - EXACT from reference plugin
|
||||
IMAGE_MODEL_RATES = {
|
||||
'dall-e-3': 0.040,
|
||||
'dall-e-2': 0.020,
|
||||
'gpt-image-1': 0.042,
|
||||
'gpt-image-1-mini': 0.011,
|
||||
}
|
||||
|
||||
# Valid OpenAI image generation models (only these work with /v1/images/generations endpoint)
|
||||
VALID_OPENAI_IMAGE_MODELS = {
|
||||
'dall-e-3',
|
||||
'dall-e-2',
|
||||
# Note: gpt-image-1 and gpt-image-1-mini are NOT valid for OpenAI's /v1/images/generations endpoint
|
||||
}
|
||||
|
||||
# Valid image sizes per model (from OpenAI official documentation)
|
||||
VALID_SIZES_BY_MODEL = {
|
||||
'dall-e-3': ['1024x1024', '1024x1792', '1792x1024'],
|
||||
'dall-e-2': ['256x256', '512x512', '1024x1024'],
|
||||
}
|
||||
|
||||
# Default model
|
||||
DEFAULT_AI_MODEL = 'gpt-4.1'
|
||||
|
||||
# JSON mode supported models
|
||||
JSON_MODE_MODELS = ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo-preview']
|
||||
|
||||
# Debug mode - controls console logging
|
||||
# Set to False in production to disable verbose logging
|
||||
DEBUG_MODE = True
|
||||
|
||||
Reference in New Issue
Block a user