mirror of
https://github.com/thecyberlearn/quantum-ai-v3.git
synced 2026-08-18 22:32:57 +00:00
## Major Features Added: ### 🕒 Session Time Limits (2hr → 30min) - Updated ChatSession model: expires_at, extend_session methods - Changed session creation and extension logic - Updated JavaScript timing calculations - Fixed timing indicator functionality with real-time server data ### 💬 Message Limits (50 → 20) - Added message_limit field to Agent model with migration - Implemented auto-completion when message limit reached - Only count user messages (not agent responses) toward limit - Enhanced error messaging for limit exceeded ### 📥 Chat Download System - Added PDF and TXT export functionality using ReportLab - Download buttons in chat header for active sessions - Comprehensive export with session metadata and formatting - New API endpoints: /agents/api/chat/export/{session_id}/ ### 📋 Previous Sessions Management - Created Previous Sessions widget showing last 5 non-active sessions - Download access for all completed sessions with messages - Session status indicators (✅ Completed, ⏰ Expired, ❌ Abandoned) - Clean sidebar organization with session history ### 🎨 UI/UX Improvements - Moved session info from main chat to sidebar for cleaner interface - Increased chat height: 600px → 800px (mobile: 500px → 650px) - Added Current Session widget with status, ID, and start time - Enhanced sidebar layout with proper component stacking - Responsive design with mobile optimizations ### 🔧 Session Indicators System - Real-time session status API with server-side data - Progress bars for time remaining and message usage - Warning notifications for approaching limits - Automatic updates every 30 seconds ### 💰 Payment Flow Fixes - Fixed charging system to actually deduct wallet balance - Each new session charges 15 AED for 20 messages + 30 minutes - Proper error handling for insufficient balance - Session cleanup on payment failures ## Technical Implementation: **Backend Changes:** - Enhanced ChatSession model with 30-minute duration - Message counting logic (user messages only) - Auto-completion on limit reached - Session status API endpoint - PDF/TXT export with ReportLab **Frontend Changes:** - Comprehensive sidebar widget system - Real-time indicator updates with server sync - Download functionality with loading states - Session history display with status icons - Responsive layout improvements **Database:** - Added message_limit field to Agent model - Updated ChatSession expiration logic - Efficient queries for session history ## User Experience: ✅ Clear session limits (20 messages, 30 minutes) ✅ Automatic session completion with preserved history ✅ Easy download access for all previous sessions ✅ Transparent pricing (15 AED per session) ✅ Clean, organized interface with more chat space ✅ Real-time feedback on session progress 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
from django.urls import path
|
|
from . import views
|
|
|
|
app_name = 'agents'
|
|
|
|
urlpatterns = [
|
|
# Web interface
|
|
path('', views.agents_marketplace, name='marketplace'),
|
|
|
|
# Direct access routes
|
|
path('career-navigator/', views.career_navigator_view, name='career_navigator'),
|
|
path('career-navigator/access/', views.career_navigator_access, name='career_navigator_access'),
|
|
|
|
# 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/session/<str:session_id>/status/', views.get_session_status, name='get_session_status'),
|
|
path('api/chat/end/', views.end_chat_session, name='end_chat_session'),
|
|
path('api/chat/export/<str:session_id>/', views.export_chat, name='export_chat'),
|
|
|
|
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'),
|
|
] |