2.7 KiB
2.7 KiB
AI System Audit Report
Current State
Active AI System (New Architecture)
Location: backend/igny8_core/ai/
Core Components:
ai_core.py- Central AI request handler (run_ai_request method)engine.py- Orchestrator for all AI functionssettings.py- Model configuration loaderprompts.py- Prompt templatesbase.py- Base class for AI functionstasks.py- Celery tasksmodels.py- AITaskLog for loggingtracker.py- Progress/step trackingregistry.py- Function registryconstants.py- Shared constants (MODEL_RATES, etc.)
AI Functions:
functions/auto_cluster.py- Keyword clusteringfunctions/generate_ideas.py- Content idea generationfunctions/generate_content.py- Article content generationfunctions/generate_images.py- Image generationfunctions/generate_image_prompts.py- Image prompt generationfunctions/optimize_content.py- Content optimization
Usage: All new code uses AIEngine + function classes
Legacy AI System (Old Architecture)
Location: backend/igny8_core/utils/ai_processor.py
Purpose: Original AI interface from reference plugin migration Size: 1390 lines Status: PARTIALLY USED - Only for:
- MODEL_RATES constant (imported by settings.py and integration_views.py)
- Integration test views
NOT USED FOR: Actual AI function execution (replaced by AIEngine)
max_tokens Fallback Analysis
Current Fallbacks Found:
-
settings.py:103 -
config.get('max_tokens', 16384)- Falls back to 16384 if not in IntegrationSettings
-
ai_core.py:116 -
max_tokens: int = 8192- Default parameter in run_ai_request()
-
ai_core.py:856 -
max_tokens: int = 4000[LEGACY]- Legacy call_openai() method
-
ai_processor.py:111 -
max_tokens: int = 4000[LEGACY]- Legacy _call_openai() method
-
ai_processor.py:437 -
max_tokens: int = 4000[LEGACY]- Legacy generate_content() method
-
ai_processor.py:531 - Hardcoded
max_tokens=1000 -
ai_processor.py:1133 - Hardcoded
max_tokens=3000 -
ai_processor.py:1340 - Hardcoded
max_tokens=4000
Recommended Actions
1. Standardize max_tokens to 8192
- Remove fallback in settings.py (line 103): Change to just
config['max_tokens']and require it - Keep ai_core.py:116 default at 8192 (main entry point)
- Update IntegrationSettings to have 8192 as required value
2. Mark Legacy Code
- Add deprecation warnings to ai_processor.py
- Document that it's only kept for MODEL_RATES constant
- Consider extracting MODEL_RATES to constants.py and removing ai_processor.py entirely
3. Remove Dead Code
- call_openai() legacy method in ai_core.py (if not used)