mirror of
https://github.com/thecyberlearn/quantum-ai-v3.git
synced 2026-08-18 09:52:58 +00:00
MAJOR ARCHITECTURAL CHANGES: - Remove Agent/AgentCategory database models entirely - Update AgentExecution/ChatSession to use agent_slug instead of foreign keys - Eliminate hybrid complexity and AgentCompat workaround classes - Enhanced AgentFileService with production-ready caching CORE IMPROVEMENTS: - Pure file-based architecture eliminates database sync complexity - Enhanced caching: 5min in dev, 1hr in production, graceful fallback - Fixed validation logic for 0.0 price fields - Added database indexes for optimal query performance - Updated admin interface to work with new slug-based fields TECHNICAL BENEFITS: - Simplified agent execution without database record creation - Eliminated get_or_create_agent_db_record() complexity - Streamlined imports across core and agents apps - Better error handling and cache availability detection FILE CHANGES: - agents/models.py: Removed Agent/AgentCategory models, updated execution models - agents/services.py: Enhanced caching, improved validation, removed DB sync - agents/views.py: Updated execute_agent to use direct agent_data - agents/admin.py: Updated for slug-based fields - core/views.py: Updated to use AgentFileService instead of Agent model All 8 agents remain fully operational with significantly reduced codebase complexity. Migration applied successfully with proper defaults for existing data. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
28 lines
1.3 KiB
Python
28 lines
1.3 KiB
Python
from django.contrib import admin
|
|
from .models import AgentExecution, ChatSession, ChatMessage
|
|
|
|
@admin.register(AgentExecution)
|
|
class AgentExecutionAdmin(admin.ModelAdmin):
|
|
list_display = ['agent_name', 'agent_slug', 'user', 'status', 'fee_charged', 'created_at']
|
|
list_filter = ['status', 'agent_slug', 'created_at']
|
|
search_fields = ['agent_name', 'agent_slug', 'user__email']
|
|
readonly_fields = ['created_at', 'completed_at']
|
|
|
|
@admin.register(ChatSession)
|
|
class ChatSessionAdmin(admin.ModelAdmin):
|
|
list_display = ['session_id', 'agent_name', 'agent_slug', 'user', 'status', 'fee_charged', 'created_at']
|
|
list_filter = ['status', 'agent_slug', 'created_at']
|
|
search_fields = ['session_id', 'agent_name', 'agent_slug', 'user__email']
|
|
readonly_fields = ['session_id', 'created_at', 'updated_at', 'completed_at']
|
|
|
|
@admin.register(ChatMessage)
|
|
class ChatMessageAdmin(admin.ModelAdmin):
|
|
list_display = ['session', 'message_type', 'content_preview', 'timestamp']
|
|
list_filter = ['message_type', 'timestamp']
|
|
search_fields = ['session__session_id', 'content']
|
|
readonly_fields = ['timestamp']
|
|
|
|
def content_preview(self, obj):
|
|
return obj.content[:50] + "..." if len(obj.content) > 50 else obj.content
|
|
content_preview.short_description = 'Content Preview'
|