quantum-ai-v2/five_whys_analyzer/migrations/0001_initial.py
Claude 7da309e018 Add 5 Whys Analysis Agent with enhanced UX features
- Create complete 5 Whys Analysis Agent with chat-based interaction
- Implement dual-mode processor (free chat vs paid report generation)
- Add typing indicators with animated dots for better user feedback
- Enable report generation only after 2+ questions for smart activation
- Simplify report form to button-only interface using chat history
- Add basic formatting for professional report presentation
- Configure conditional wallet deduction (charge only for final reports)
- Set up N8N webhook integration for analysis processing

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 23:08:45 +05:30

75 lines
4.3 KiB
Python

# Generated by Django 5.2.4 on 2025-07-12 16: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 = [
('agent_base', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='FiveWhysAnalyzerRequest',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('status', models.CharField(choices=[('pending', 'Pending'), ('processing', 'Processing'), ('completed', 'Completed'), ('failed', 'Failed')], default='pending', max_length=20)),
('cost', models.DecimalField(decimal_places=2, max_digits=10)),
('created_at', models.DateTimeField(auto_now_add=True)),
('processed_at', models.DateTimeField(blank=True, null=True)),
('session_id', models.CharField(db_index=True, default=uuid.uuid4, max_length=100)),
('chat_messages', models.JSONField(default=list, help_text='Store chat history as list of messages')),
('problem_statement', models.TextField(blank=True, help_text='Main problem to analyze')),
('context_info', models.TextField(blank=True, help_text='Additional context information')),
('analysis_depth', models.CharField(blank=True, choices=[('standard', 'Standard 5 Whys'), ('detailed', 'Extended Analysis'), ('comprehensive', 'Comprehensive Report')], default='standard', max_length=20)),
('report_generated', models.BooleanField(default=False, help_text='Has final report been generated and paid for')),
('chat_active', models.BooleanField(default=True, help_text='Is chat session still active')),
('input_text', models.TextField(blank=True)),
('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='agent_base.baseagent')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': '5 Whys Analysis Agent Request',
'verbose_name_plural': '5 Whys Analysis Agent Requests',
'db_table': 'five_whys_analyzer_requests',
},
),
migrations.CreateModel(
name='FiveWhysAnalyzerResponse',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('success', models.BooleanField(default=False)),
('error_message', models.TextField(blank=True)),
('processing_time', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('chat_response', models.TextField(blank=True, help_text='Latest chat response')),
('chat_history', models.JSONField(default=list, help_text='Full chat response history')),
('final_report', models.TextField(blank=True, help_text='Generated 5 Whys analysis report')),
('report_metadata', models.JSONField(default=dict, help_text='Report generation metadata')),
('output_text', models.TextField(blank=True)),
('raw_response', models.JSONField(blank=True, default=dict)),
('request', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='response', to='five_whys_analyzer.fivewhysanalyzerrequest')),
],
options={
'verbose_name': '5 Whys Analysis Agent Response',
'verbose_name_plural': '5 Whys Analysis Agent Responses',
'db_table': 'five_whys_analyzer_responses',
},
),
migrations.AddIndex(
model_name='fivewhysanalyzerrequest',
index=models.Index(fields=['session_id'], name='five_whys_a_session_0dd791_idx'),
),
migrations.AddIndex(
model_name='fivewhysanalyzerrequest',
index=models.Index(fields=['user', 'chat_active'], name='five_whys_a_user_id_810315_idx'),
),
]