quantum-ai-v2/workflows/migrations/0001_initial.py
Claude 9e6ec903fc 🚀 Implement simplified workflows system with shared components
## Major System Simplification
- **90% reduction** in agent configuration complexity (369 → 83 lines)
- Removed unused dynamic field system (174 lines eliminated)
- Deleted generic template fallback (dead code removal)
- Enhanced JavaScript utilities with 15+ shared functions

## New Workflows App Architecture
- Unified agent processing with hybrid N8N/Django approach
- Shared component system (6 reusable components)
- Individual templates with consistent UI patterns
- Configuration-driven agent definitions (metadata only)

## Enhanced Developer Experience
- 4-step agent creation process (vs complex multi-step before)
- Agent template starter file for easy copying
- Comprehensive documentation with before/after examples
- Enhanced WorkflowsCore utilities for common operations

## Files Added
- `workflows/` - Complete new Django app with simplified architecture
- `agent-template-starter.html` - Template for easy agent creation
- `workflows-core.js` - Enhanced JavaScript utilities (15+ functions)
- Shared components: header, quick-agents, processing, results, wallet
- Simplified agent configs (5 lines vs 50+ lines each)

## Benefits Achieved
 90% less configuration code per agent
 Shared component reusability with dynamic data
 Enhanced JavaScript utilities automatically available
 Consistent UI/UX across all agents
 Dramatically simplified maintenance

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-28 20:06:46 +05:30

146 lines
5.0 KiB
Python

# Generated by Django 5.2.4 on 2025-07-28 10:08
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="WorkflowRequest",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("agent_slug", models.CharField(db_index=True, max_length=100)),
("input_data", models.JSONField(default=dict)),
(
"status",
models.CharField(
choices=[
("processing", "Processing"),
("completed", "Completed"),
("failed", "Failed"),
],
default="processing",
max_length=20,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="workflow_requests",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ["-created_at"],
},
),
migrations.CreateModel(
name="WorkflowResponse",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("output_data", models.JSONField(default=dict)),
(
"processing_time",
models.DecimalField(
blank=True, decimal_places=2, max_digits=5, null=True
),
),
("success", models.BooleanField(default=True)),
("error_message", models.TextField(blank=True)),
("n8n_session_id", models.CharField(blank=True, max_length=100)),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"request",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="response",
to="workflows.workflowrequest",
),
),
],
),
migrations.CreateModel(
name="WorkflowAnalytics",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("agent_slug", models.CharField(db_index=True, max_length=100)),
(
"processing_time",
models.DecimalField(decimal_places=2, max_digits=5),
),
("success", models.BooleanField()),
("date", models.DateField(auto_now_add=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"indexes": [
models.Index(
fields=["agent_slug", "date"],
name="workflows_w_agent_s_feee49_idx",
),
models.Index(
fields=["user", "date"], name="workflows_w_user_id_94f7cd_idx"
),
],
},
),
migrations.AddIndex(
model_name="workflowrequest",
index=models.Index(
fields=["user", "-created_at"], name="workflows_w_user_id_29fa9d_idx"
),
),
migrations.AddIndex(
model_name="workflowrequest",
index=models.Index(
fields=["agent_slug", "-created_at"],
name="workflows_w_agent_s_c56767_idx",
),
),
]