Commit Graph

4 Commits

Author SHA1 Message Date
9008c5d945 feat: Auto-adapt content to platform limits when creating posts
- Add adapt_with_ai() method to PlatformAdapter that uses DeepSeek
  to condense content when it exceeds platform character limits
- Add adapt_for_all_platforms_smart() for batch adaptation
- Modify create_post endpoint to auto-generate content_x, content_threads,
  content_instagram, content_facebook with adapted versions
- Modify update_post to re-adapt content when main content changes
- If content fits within limit, use as-is (no AI call)
- If content exceeds limit, AI condenses while preserving message
- Fallback to rule-based truncation if DeepSeek API unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 21:20:04 +00:00
9e857961f9 feat: Add proper thread handling in content generation
- Detect threads by template name and skip platform truncation
- Parse thread content into individual posts with numbering
- Add thread_posts array to API response with post details
- Evaluate quality on first post (hook) for threads
- Add is_thread and thread_posts fields to GenerateV2Response

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:23:18 +00:00
e32885afc5 fix: Fix YAML syntax errors and validator prompt formatting
- Fix YAML files with unquoted strings containing quotes
- Export singleton instances in ai/__init__.py
- Fix validator scoring prompt to use replace() instead of format()
  to avoid conflicts with JSON curly braces

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 21:13:58 +00:00
11b0ba46fa feat: Add Content Generation Engine v2 with quality scoring
Major improvements to AI content generation:

## New Components (app/services/ai/)
- PromptLibrary: YAML-based prompt templates with inheritance
- ContextEngine: Anti-repetition and best performers tracking
- ContentGeneratorV2: Enhanced generation with dynamic parameters
- PlatformAdapter: Platform-specific content adaptation
- ContentValidator: AI-powered quality scoring (0-100)

## Prompt Library (app/prompts/)
- 3 personalities: default, educational, promotional
- 5 templates: tip_tech, product_post, service_post, thread, response
- 4 platform configs: x, threads, instagram, facebook
- Few-shot examples by category: ia, productividad, seguridad

## Database Changes
- New table: content_memory (tracks generated content)
- New columns in posts: quality_score, score_breakdown, generation_attempts

## New API Endpoints (/api/v2/generate/)
- POST /generate - Generation with quality check
- POST /generate/batch - Batch generation
- POST /quality/evaluate - Evaluate content quality
- GET /templates, /personalities, /platforms - List configs

## Celery Tasks
- update_engagement_scores (every 6h)
- cleanup_old_memory (monthly)
- refresh_best_posts_yaml (weekly)

## Tests
- Comprehensive tests for all AI engine components

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:55:28 +00:00