Phase 0: Foundation & Credit System - Initial implementation

- Updated CREDIT_COSTS constants to Phase 0 format with new operations
- Enhanced CreditService with get_credit_cost() method and operation_type support
- Created AccountModuleSettings model for module enable/disable functionality
- Added AccountModuleSettingsSerializer and ViewSet
- Registered module settings API endpoint: /api/v1/system/settings/account-modules/
- Maintained backward compatibility with existing credit system
This commit is contained in:
Desktop
2025-11-16 23:24:44 +05:00
parent f84be4194f
commit 72a31b2edb
7 changed files with 220 additions and 45 deletions

View File

@@ -1,22 +1,25 @@
"""
Credit Cost Constants
Credit Cost Constants - Phase 0: Credit-Only System
All features are unlimited. Only credits restrict usage.
"""
CREDIT_COSTS = {
'clustering': {
'base': 1, # 1 credit per 30 keywords
'per_keyword': 1 / 30,
},
'ideas': {
'base': 1, # 1 credit per idea
},
'content': {
'base': 3, # 3 credits per full blog post
},
'images': {
'base': 1, # 1 credit per image
},
'reparse': {
'base': 1, # 1 credit per reparse
},
# Existing operations
'clustering': 10, # Per clustering request
'idea_generation': 15, # Per cluster → ideas request
'content_generation': 1, # Per 100 words
'image_prompt_extraction': 2, # Per content piece
'image_generation': 5, # Per image
# Legacy operation names (for backward compatibility)
'ideas': 15, # Alias for idea_generation
'content': 1, # Alias for content_generation (per 100 words)
'images': 5, # Alias for image_generation
'reparse': 2, # Alias for image_prompt_extraction
# NEW: Phase 2+ operations
'linking': 8, # Per content piece (NEW)
'optimization': 1, # Per 200 words (NEW)
'site_structure_generation': 50, # Per site blueprint (NEW)
'site_page_generation': 20, # Per page (NEW)
}