feat: Add Global Module Settings and Caption to Images

- Introduced GlobalModuleSettings model for platform-wide module enable/disable settings.
- Added 'caption' field to Images model to store image captions.
- Updated GenerateImagePromptsFunction to handle new caption structure in prompts.
- Enhanced AIPromptViewSet to return global prompt types and validate active prompts.
- Modified serializers and views to accommodate new caption field and global settings.
- Updated frontend components to display captions and filter prompts based on active types.
- Created migrations for GlobalModuleSettings and added caption field to Images.
This commit is contained in:
IGNY8 VPS (Salman)
2025-12-20 21:34:59 +00:00
parent 9e8ff4fbb1
commit 7a1e952a57
16 changed files with 370 additions and 383 deletions

View File

@@ -10,6 +10,7 @@ from .global_settings_models import (
GlobalAIPrompt,
GlobalAuthorProfile,
GlobalStrategy,
GlobalModuleSettings,
)
from django.contrib import messages
@@ -445,3 +446,55 @@ class GlobalStrategyAdmin(ImportExportMixin, Igny8ModelAdmin):
}),
)
@admin.register(GlobalModuleSettings)
class GlobalModuleSettingsAdmin(Igny8ModelAdmin):
"""
Admin for global module enable/disable settings.
Singleton model - only one record exists.
Controls which modules are available platform-wide.
"""
def has_add_permission(self, request):
"""Only allow one instance"""
return not GlobalModuleSettings.objects.exists()
def has_delete_permission(self, request, obj=None):
"""Prevent deletion of singleton"""
return False
fieldsets = (
('Module Availability (Platform-Wide)', {
'fields': (
'planner_enabled',
'writer_enabled',
'thinker_enabled',
'automation_enabled',
'site_builder_enabled',
'linker_enabled',
'optimizer_enabled',
'publisher_enabled',
),
'description': 'Control which modules are available across the entire platform. Disabled modules will not load for ANY user.'
}),
('Metadata', {
'fields': ('created_at', 'updated_at'),
'classes': ('collapse',)
}),
)
readonly_fields = ['created_at', 'updated_at']
list_display = [
'id',
'planner_enabled',
'writer_enabled',
'thinker_enabled',
'automation_enabled',
'site_builder_enabled',
'linker_enabled',
'optimizer_enabled',
'publisher_enabled',
'updated_at',
]