diff --git a/CLAUDE.md b/CLAUDE.md index f3d04c8..af2b7bd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -225,4 +225,4 @@ gunicorn netcop_hub.wsgi:application 4. Check WorkflowRequest/WorkflowResponse creation --- -Last updated: Last updated: Last updated: Last updated: Last updated: 2025-07-31 19:05:10 +Last updated: Last updated: Last updated: Last updated: Last updated: Last updated: 2025-07-31 19:10:15 diff --git a/agents/management/commands/create_pdf_summarizer_agent.py b/agents/management/commands/create_pdf_summarizer_agent.py new file mode 100644 index 0000000..583cd51 --- /dev/null +++ b/agents/management/commands/create_pdf_summarizer_agent.py @@ -0,0 +1,104 @@ +from django.core.management.base import BaseCommand +from agents.models import AgentCategory, Agent + +class Command(BaseCommand): + help = 'Create PDF summarizer agent' + + def handle(self, *args, **options): + # Get or create Document Processing category + doc_category, created = AgentCategory.objects.get_or_create( + slug='document-processing', + defaults={ + 'name': 'Document Processing', + 'description': 'AI-powered document analysis and processing tools', + 'icon': '📄' + } + ) + + if created: + self.stdout.write(self.style.SUCCESS(f'Created category: {doc_category.name}')) + else: + self.stdout.write(f'Category already exists: {doc_category.name}') + + # Create PDF Summarizer agent + pdf_summarizer_agent, created = Agent.objects.get_or_create( + slug='pdf-summarizer', + defaults={ + 'name': 'PDF Summarizer', + 'short_description': 'Extract and summarize content from PDF documents with AI analysis', + 'description': 'Upload PDF documents and get comprehensive AI-powered summaries, key insights, and analysis. Perfect for processing reports, research papers, contracts, and other documents. Supports multiple analysis types including summary, key points extraction, and sentiment analysis.', + 'category': doc_category, + 'price': 8.0, + 'form_schema': { + 'fields': [ + { + 'name': 'pdf_file', + 'type': 'file', + 'label': 'Upload PDF Document', + 'required': True, + 'accept': '.pdf', + 'max_size': '10MB', + 'help_text': 'Select a PDF file to analyze (max 10MB)' + }, + { + 'name': 'analysis_type', + 'type': 'select', + 'label': 'Analysis Type', + 'required': True, + 'default': 'summary', + 'options': [ + {'value': '', 'label': 'Select analysis type...'}, + {'value': 'summary', 'label': 'Document Summary'}, + {'value': 'key_points', 'label': 'Key Points Extraction'}, + {'value': 'detailed_analysis', 'label': 'Detailed Analysis'}, + {'value': 'sentiment', 'label': 'Sentiment Analysis'}, + {'value': 'questions', 'label': 'Generate Questions'}, + {'value': 'action_items', 'label': 'Extract Action Items'} + ], + 'help_text': 'Choose the type of analysis to perform on the document' + }, + { + 'name': 'language', + 'type': 'select', + 'label': 'Document Language', + 'required': False, + 'default': 'auto', + 'options': [ + {'value': 'auto', 'label': 'Auto-detect'}, + {'value': 'English', 'label': 'English'}, + {'value': 'Arabic', 'label': 'Arabic (العربية)'}, + {'value': 'Spanish', 'label': 'Spanish (Español)'}, + {'value': 'French', 'label': 'French (Français)'}, + {'value': 'German', 'label': 'German (Deutsch)'}, + {'value': 'Chinese', 'label': 'Chinese (䏿–‡)'} + ], + 'help_text': 'Specify document language for better analysis accuracy' + }, + { + 'name': 'output_length', + 'type': 'select', + 'label': 'Summary Length', + 'required': False, + 'default': 'medium', + 'options': [ + {'value': 'short', 'label': 'Short (1-2 paragraphs)'}, + {'value': 'medium', 'label': 'Medium (3-5 paragraphs)'}, + {'value': 'long', 'label': 'Long (detailed summary)'} + ], + 'help_text': 'Choose the desired length of the analysis output' + } + ] + }, + 'webhook_url': 'http://localhost:5678/webhook/simple-pdf-processor' + } + ) + + if created: + self.stdout.write(self.style.SUCCESS(f'Created agent: {pdf_summarizer_agent.name}')) + else: + self.stdout.write(f'Agent already exists: {pdf_summarizer_agent.name}') + + self.stdout.write(self.style.SUCCESS('PDF Summarizer setup completed successfully')) + self.stdout.write(f'Agent ID: {pdf_summarizer_agent.id}') + self.stdout.write(f'Agent Slug: {pdf_summarizer_agent.slug}') + self.stdout.write(f'Price: {pdf_summarizer_agent.price} AED') \ No newline at end of file diff --git a/agents/templates/agents/agent_detail.html b/agents/templates/agents/agent_detail.html index 09d8dd9..f920a43 100644 --- a/agents/templates/agents/agent_detail.html +++ b/agents/templates/agents/agent_detail.html @@ -174,6 +174,91 @@ color: #0369a1; } +/* File Upload Styles */ +.file-upload-container { + position: relative; +} + +.form-file-input { + display: none; +} + +.file-upload-label { + display: block; + padding: var(--spacing-lg); + border: 2px dashed var(--outline-variant); + border-radius: var(--radius-md); + text-align: center; + cursor: pointer; + transition: all 0.2s ease; + background: var(--surface-variant); + color: var(--on-surface-variant); +} + +.file-upload-label:hover { + border-color: var(--primary); + background: rgba(0, 0, 0, 0.02); +} + +.file-upload-label.dragover { + border-color: var(--primary); + background: rgba(0, 0, 0, 0.05); + transform: scale(1.02); +} + +.file-upload-icon { + font-size: 2rem; + display: block; + margin-bottom: var(--spacing-sm); +} + +.file-upload-text { + display: block; + font-weight: 500; + margin-bottom: var(--spacing-xs); + color: var(--on-surface); +} + +.file-upload-info { + font-size: 12px; + color: var(--on-surface-variant); +} + +.file-selected { + display: flex; + align-items: center; + justify-content: space-between; + padding: var(--spacing-md); + background: var(--surface); + border: 1px solid var(--success); + border-radius: var(--spacing-sm); + margin-top: var(--spacing-sm); +} + +.file-name { + font-size: 14px; + color: var(--on-surface); + font-weight: 500; +} + +.file-remove { + background: var(--error); + color: white; + border: none; + border-radius: 50%; + width: 24px; + height: 24px; + cursor: pointer; + font-size: 16px; + display: flex; + align-items: center; + justify-content: center; +} + +.file-remove:hover { + background: #dc2626; +} + /* Responsive Design */ @media (max-width: 768px) { .toast { @@ -243,7 +328,7 @@ document.body.setAttribute('data-user-balance', '{{ user.wallet_balance }}');