mirror of
https://github.com/thecyberlearn/quantum-ai-v2.git
synced 2026-08-18 15:52:59 +00:00
🏗️ **Database Extensions:** - Add agent_type field to Agent model (form/chat distinction) - Create ChatSession model for conversation management - Create ChatMessage model for message storage with metadata - Add database indexes for performance optimization 🎨 **Frontend Implementation:** - Create agent_chat.html template with modern chat interface - Implement real-time messaging UI with message bubbles - Add typing indicators and loading states - Responsive design for mobile and desktop - Empty states and error handling 🔧 **Backend Logic:** - Extend agent_detail_view to route chat vs form agents - Implement chat_agent_view for chat interface rendering - Add start_chat_session API endpoint with session management - Add send_chat_message API endpoint with webhook integration - Add get_chat_history and end_chat_session endpoints - Session-based fee charging system 🤖 **5 Whys Agent:** - Create "Analysis & Problem Solving" category - Implement 5 Whys Analysis chat-based agent (15 AED) - Interactive problem-solving methodology guidance - N8N webhook integration for AI responses ⚡ **Interactive Features:** - JavaScript ChatInterface class for real-time communication - Auto-session creation and management - Message validation and error handling - Automatic scrolling and UI state management - CSRF protection and security measures 🔗 **API Integration:** - Chat-specific API endpoints with RESTful design - Webhook payload formatting for N8N integration - Session ID tracking and conversation continuity - Metadata storage for webhook responses 🛡️ **Security & UX:** - Login required for chat agents - Wallet balance validation before session creation - Session isolation per user and agent - Comprehensive error handling and user feedback **New URLs:** - /agents/api/chat/start/ - Start new chat session - /agents/api/chat/send/ - Send chat message - /agents/api/chat/history/<session_id>/ - Get chat history - /agents/api/chat/end/ - End chat session - /agents/five-whys-analysis/ - 5 Whys chat interface **Backward Compatibility:** - Existing form-based agents (Social Ads, Job Posting, PDF) unchanged - Admin interface updated to show agent types - Marketplace displays both agent types seamlessly 🚀 Ready for interactive 5 Whys problem-solving conversations\! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from django.urls import path
|
|
from . import views
|
|
|
|
app_name = 'agents'
|
|
|
|
urlpatterns = [
|
|
# Web interface
|
|
path('', views.agents_marketplace, name='marketplace'),
|
|
|
|
# API endpoints - specific URLs first to avoid slug conflicts
|
|
path('api/execute/', views.execute_agent, name='execute_agent'),
|
|
path('api/executions/', views.execution_list, name='execution_list'),
|
|
path('api/executions/<uuid:execution_id>/', views.execution_detail, name='execution_detail'),
|
|
|
|
# Chat API endpoints
|
|
path('api/chat/start/', views.start_chat_session, name='start_chat_session'),
|
|
path('api/chat/send/', views.send_chat_message, name='send_chat_message'),
|
|
path('api/chat/history/<str:session_id>/', views.get_chat_history, name='get_chat_history'),
|
|
path('api/chat/end/', views.end_chat_session, name='end_chat_session'),
|
|
|
|
path('api/', views.agent_list, name='agent_list'),
|
|
path('api/<slug:slug>/', views.agent_detail, name='agent_detail_api'),
|
|
|
|
# Agent detail page (must be last to avoid conflicts)
|
|
path('<slug:slug>/', views.agent_detail_view, name='detail'),
|
|
] |