Commit Graph

21 Commits

Author SHA1 Message Date
Claude
bf2807f9e0 💰 Fix wallet balance updates and agent result formatting
- Fix wallet balance display targeting correct #walletBalance element
- Add proper result formatting for PDF analyzer (structured sections)
- Add clean formatting for job posting generator (simple bold text)
- Fix "Explore Other Agents" button functionality with slide panel
- Add missing workflows-core.js base class for frontend functionality
- Ensure wallet updates after successful AI execution (not before)
- Add debugging and error handling for better user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 19:06:51 +05:30
Claude
33dcdc23ba 🏗️ Phase 1: Complete architecture simplification - pure file-based agent system
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>
2025-08-14 09:55:45 +05:30
Claude
e4f3e7993a 🧹 Clean up obsolete code after file-based agent system migration
Cleanup Tasks Completed:
• Remove populate_agents management command (obsolete with file-based agents)
• Clean up unused Agent serializers and API endpoints
• Remove redundant database model imports and queries
• Update documentation to reflect file-based architecture

Technical Changes:
• Deleted agents/management/commands/populate_agents.py
• Removed AgentSerializer and AgentCategorySerializer (unused)
• Removed agent_list and agent_detail API endpoints (replaced by file service)
• Cleaned up unused imports (models.db)
• Updated CLAUDE.md documentation for file-based system

Benefits:
• Cleaner codebase with 100+ lines removed
• No obsolete database commands
• Streamlined API surface (only execution-related endpoints remain)
• Updated documentation reflects current architecture
• All functionality verified working

All 8 agents and marketplace functionality confirmed operational after cleanup.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 09:36:10 +05:30
Claude
56749b77f0 🚀 Implement file-based agent system for instant deployment
BREAKING CHANGE: Transform from database-driven to file-based agent management

Major Features:
• File-based agent definitions - agents load from JSON configs instantly
• Hybrid architecture - files for agent data, database for relationships
• Zero-command deployment - just add JSON file and git push
• Automatic database sync - maintains foreign key compatibility
• Template compatibility - enriched agent data works with existing UI

Technical Implementation:
• AgentFileService - comprehensive file-based agent management
• JSON config loading with LRU caching for performance
• Category enrichment for template compatibility
• Slug-based queries for AgentExecution relationships
• get_or_create_agent_db_record() for foreign key maintenance

Benefits:
• Ultra-simple agent creation (just add JSON file)
• Instant Railway deployment (no commands needed)
• Version control integration (agent changes in git)
• Perfect scalability (ready for 100+ agents)
• Zero maintenance overhead

All 8 agents verified working:
- 4 Webhook agents: Social Ads, Job Posting, PDF Summarizer, 5 Whys
- 4 Direct access agents: Career Navigator, Brand Strategist, Lean Six Sigma, SWOT

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 09:28:34 +05:30
Claude
cf33065315 Add SWOT Analysis Expert + streamline agent creation process
- Add SWOT Analysis Expert direct access agent (free, JotForm integration)
- Use existing 'analysis' category instead of creating new category
- Remove 10+ redundant create_* management commands for cleaner codebase
- Update CLAUDE.md with simplified JSON + populate_agents workflow
- Emphasize using existing categories to avoid proliferation
- Clean up agent creation architecture for Railway scalability
- All agents now follow unified JSON config approach

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 08:49:53 +05:30
Claude
2aea35f2d9 Add Lean Six Sigma Expert agent with Railway integration
- Add Business Consulting category to Railway config
- Create System 2 direct access agent with JotForm integration
- Add dedicated template with full-screen iframe layout
- Implement view functions for payment processing and form display
- Update marketplace template with special Try Now routing
- Add URL routes for agent access and display pages
- Create JSON config for Railway deployment compatibility
- Ensure identical database state between local and production

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 08:56:56 +05:30
Claude
54d64f5927 Streamline user experience with cleaner UI and improved authentication flow
- Remove special styling for career navigator button, unify all Try Now buttons
- Clean up authentication messaging system to prevent message confusion
- Replace immediate success messages with direct redirections for smoother UX
- Add session-based post-login messaging for better redirect handling
- Improve login page with verification resend button and cleaner message display
- Remove redundant payment success messages for free agents

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 09:22:13 +05:30
Claude
d8b8420319 🧠 Add AI Brand Strategist embedded interface with Quantum Tasks header
- Create dedicated template with header + JotForm iframe
- Add ai_brand_strategist_view() and ai_brand_strategist_access() functions
- Add dedicated URL routes /ai-brand-strategist/ and /ai-brand-strategist/access/
- Update marketplace buttons to use dedicated routes for consistent UX
- Both CyberSec Career Navigator and AI Brand Strategist now show embedded forms
- Follows established direct access agent architecture pattern

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 23:36:35 +05:30
Claude
6fae2686c5 🚀 Implement scalable direct access architecture for 100+ agents
## Complete Scalable Architecture Implementation

**Problem Solved**: CyberSec Career Navigator was broken (empty form → JotForm URL webhook)
**Solution**: Built generic direct access architecture for unlimited external form agents

## New Architecture Features

**🎯 Direct Access Agents (External Forms):**
- Generic view functions work for ANY direct access agent
- Database-driven routing via access_url_name/display_url_name fields
- Template automatically detects and redirects to external forms
- Zero code changes needed for new direct access agents

**🔧 Webhook Agents (Dynamic Processing):**
- Existing webhook agents work exactly as before (unchanged)
- Dynamic form generation and N8N processing preserved
- Zero impact on current functionality

## Files Added/Modified

**Views** ():
- `direct_access_handler()` - Generic payment & access processing
- `direct_access_display()` - Generic external form display

**URLs** ():
- Generic routing: `<slug>/access/` and `<slug>/display/`
- Works for any agent with access_url_name configured

**Template** ():
- Conditional logic: `{% if agent.access_url_name %}`
- Direct access → "Start Consultation" button → External form
- Webhook → Dynamic form (unchanged)

**Migration** ():
- Adds access_url_name and display_url_name fields to Agent model

**Agent Config** ():
- Updated to use generic direct access URLs

## Scalability Achievement

**Ready for 100+ Agents:**
-  New webhook agent: Database record with empty access_url_name
-  New direct access agent: Database record with generic access_url_name
-  Zero code changes needed for new agents
-  Template automatically handles both types
-  Database-driven routing eliminates hardcoded URLs

## Expected Results

**After Railway Deployment:**
- CyberSec Career Navigator: "Start Consultation (FREE)" → Direct JotForm
- All webhook agents: Continue working exactly as before
- System ready for unlimited agents of both types

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-04 22:46:00 +05:30
Claude
ae303c2621 🔧 Fix payment message persistence and add expired session popup
- Fix wallet payment messages showing on login page by clearing messages before redirects
- Remove misleading "Payment processed\!" message for free agents
- Implement minimalist expired session popup for 5 Whys agent
- Add auto-detection of expired sessions on page load with payment confirmation
- Streamline authentication flow messages for better UX
- Remove logout confirmation message to prevent persistence

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 20:57:27 +05:30
Claude
942bbcdd40 🎨 Enhance 5 Whys agent response formatting for professional appearance
Improved agent responses to match the formatting quality of other agents
with structured, engaging content using markdown and professional styling.

## Changes:

### 📝 Enhanced Welcome Message:
- Added markdown headers and emojis for engagement
- Structured sections: 'How It Works' and 'Getting Started'
- Clear bullet points and bold emphasis for key concepts
- Professional yet friendly tone

### 🔧 Improved N8N Webhook Instructions:
- Detailed formatting requirements (headers, bold, lists, emojis)
- Clear content guidelines for systematic 5 Whys guidance
- Instructions for structured but conversational responses
- Focus on interactive guidance vs final reports

### 💻 JavaScript Markdown Processing:
- Added formatMarkdownContent() function for consistent formatting
- Processes headers (##, ###), bold text (**text**), bullet points
- Handles both new real-time messages and existing messages on load
- Shared formatting logic for consistency

### 🎨 Enhanced CSS & Template:
- Better message bubble styling for structured content
- Improved typography and spacing for readability
- Support for formatted headers, lists, and emphasis
- Added data attributes for content processing

## Expected User Experience:
- **Before**: Plain text responses lacking visual hierarchy
- **After**: Professional, structured responses with clear sections,
  bullet points, bold emphasis, and engaging emojis

The 5 Whys agent now provides responses that match the quality and
formatting standards of other premium agents in the platform.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 13:54:23 +05:30
Claude
641d676f2f 🎉 Complete 5 Whys agent enhancements with session management and UI improvements
## 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>
2025-08-03 13:28:39 +05:30
Claude
3fac20fe28 🎯 Complete dual integration architecture with JotForm and digital branding
- Add CyberSec Career Navigator with JotForm white-label integration
- Implement direct access agent system alongside webhook agents
- Add digital branding services page with SOSTAC+RACE methodology
- Create dual integration patterns: webhook vs direct access flows
- Clean up unused form API endpoints for streamlined architecture
- Add career navigator management command and templates
- Update marketplace with conditional logic for different agent types
- Fix UI consistency issues (remove category labels, fix animations)
- Update documentation to reflect new dual architecture

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-02 10:47:16 +05:30
Claude
d750857e4e Implement chat session timeout system
- Add expires_at field to ChatSession model with 2-hour default
- Sessions automatically expire after 2 hours of inactivity
- Active conversations extend session by 2 hours per message
- Add session expiration checks in chat views
- Create cleanup management command for expired sessions
- Add session status indicators in chat UI
- Fix null safety for existing sessions without expiration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 15:45:16 +05:30
Claude
ab2360a91d 💬 Implement complete chat-based agent system with 5 Whys Analysis
🏗️ **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>
2025-08-01 09:39:43 +05:30
Claude
c8ad34f0f9 🔒 Implement critical security fixes for production readiness
Critical Security Fixes:
- Add SSRF prevention with webhook URL validation
- Implement atomic wallet transactions to prevent race conditions
- Verify authentication system already secure against bypass

Technical Details:
- agents/views.py: Add validate_webhook_url() function with IP filtering
- authentication/models.py: Add @transaction.atomic and select_for_update()
- Block private/internal IPs while allowing localhost development
- Prevent double-spending and negative balance scenarios

Security Testing:
- All webhook URLs validated successfully
- Wallet transaction atomicity confirmed
- All 3 agents remain fully functional
- System ready for production deployment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 01:37:08 +05:30
Claude
c368bb55de Enhance marketplace with modern design and authentication
- Redesign agent cards with sleek modern styling (white cards, gradient shadows)
- Implement authentication-aware UI: blue "Try Now" vs black "Login to Try"
- Add login_required decorator to agent detail views for security
- Fix quick agents panel to show only 3 working agents
- Update PDF Summarizer reset functionality to properly clear file uploads
- Remove category badges for unauthenticated users to prevent layout issues

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 23:12:15 +05:30
Claude
cf8583d0b2 💼 Add Job Posting Generator agent with comprehensive form schema
- Create Human Resources category for HR-related agents
- Implement Job Posting Generator with 7-field dynamic form
- Add specialized N8N webhook message formatting for job postings
- Support multiple seniority levels, contract types, and locations
- Complete form validation and error handling
- Full integration with existing wallet and execution system

Form fields:
- Job title and company name
- Detailed job description (textarea)
- Seniority level (entry to executive)
- Contract type (full-time, part-time, contract, etc.)
- Location with remote work support
- Multi-language support

Webhook format matches N8N payload structure exactly.
Tested and working with real-time wallet deduction.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 19:10:15 +05:30
Claude
5eba8fee84 🚀 Complete agents app implementation with social ads frontend
- Create complete REST API-based agents system for scalability
- Implement Social Ads Generator with dynamic form rendering
- Add agents marketplace with search and category filtering
- Build real-time wallet balance updates after execution
- Fix URL routing conflicts and API endpoint issues
- Add comprehensive N8N webhook integration with proper payload format
- Create dynamic template system for 100+ agent scalability

Features:
- Database-driven agent management via Django admin
- JSON schema-based dynamic form generation
- Real-time wallet balance deduction and display updates
- Comprehensive error handling and validation
- Mobile-responsive marketplace UI
- Complete API endpoints for frontend integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 19:05:09 +05:30
Claude
1aac14f44b Implement individual agent architecture with simplified template structure
- Replace legacy agents system with modular individual agent apps
- Add agent_base framework for BaseAgent, processors, and management commands
- Create weather_reporter as example individual agent with API integration
- Implement simplified template structure: agent_name/templates/detail.html
- Fix marketplace to display actual agents instead of placeholder
- Add proper authentication flow with login redirect for agent access
- Organize project structure: move tests to tests/, docs to docs/
- Update all documentation to reflect new simplified architecture
- Fix URL namespace issues throughout templates and views

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 09:01:11 +05:30
Claude
67ba2de335 first working 2025-07-09 02:15:35 +05:30