autmation final reaftocrs and setitgns dafautls

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-18 15:03:01 +00:00
parent 879ef6ff06
commit ebc4088ccb
14 changed files with 1367 additions and 90 deletions

View File

@@ -0,0 +1,27 @@
# Generated manually for test mode fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('automation', '0009_add_stage_use_testing_and_budget_pct'),
]
operations = [
migrations.AddField(
model_name='automationconfig',
name='test_mode_enabled',
field=models.BooleanField(default=False, help_text='Enable test mode - allows test triggers'),
),
migrations.AddField(
model_name='automationconfig',
name='test_trigger_at',
field=models.DateTimeField(blank=True, null=True, help_text='Set datetime to trigger a test run (auto-clears after trigger)'),
),
migrations.AddIndex(
model_name='automationconfig',
index=models.Index(fields=['test_mode_enabled', 'test_trigger_at'], name='automation__test_mo_idx'),
),
]

View File

@@ -0,0 +1,63 @@
# Generated manually for DefaultAutomationConfig model
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('automation', '0010_add_test_mode_fields'),
]
operations = [
migrations.CreateModel(
name='DefaultAutomationConfig',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('singleton_key', models.CharField(default='X', editable=False, max_length=1, unique=True)),
('is_enabled', models.BooleanField(default=False, help_text='Default: Enable scheduled automation for new sites')),
('frequency', models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly')], default='daily', max_length=20)),
('base_scheduled_hour', models.IntegerField(default=2, help_text='Starting hour (0-23) for auto-assignment. Each new site gets next hour.')),
('next_scheduled_hour', models.IntegerField(default=2, help_text='Next hour to assign (auto-increments, wraps at 24)')),
('stage_1_enabled', models.BooleanField(default=True, help_text='Process Stage 1: Keywords → Clusters')),
('stage_2_enabled', models.BooleanField(default=True, help_text='Process Stage 2: Clusters → Ideas')),
('stage_3_enabled', models.BooleanField(default=True, help_text='Process Stage 3: Ideas → Tasks')),
('stage_4_enabled', models.BooleanField(default=True, help_text='Process Stage 4: Tasks → Content')),
('stage_5_enabled', models.BooleanField(default=True, help_text='Process Stage 5: Content → Image Prompts')),
('stage_6_enabled', models.BooleanField(default=True, help_text='Process Stage 6: Image Prompts → Images')),
('stage_7_enabled', models.BooleanField(default=True, help_text='Process Stage 7: Review → Published')),
('stage_1_batch_size', models.IntegerField(default=50, help_text='Keywords per batch')),
('stage_2_batch_size', models.IntegerField(default=1, help_text='Clusters at a time')),
('stage_3_batch_size', models.IntegerField(default=20, help_text='Ideas per batch')),
('stage_4_batch_size', models.IntegerField(default=1, help_text='Tasks - sequential')),
('stage_5_batch_size', models.IntegerField(default=1, help_text='Content at a time')),
('stage_6_batch_size', models.IntegerField(default=1, help_text='Images - sequential')),
('stage_1_use_testing', models.BooleanField(default=False, help_text='Use testing model for Stage 1')),
('stage_2_use_testing', models.BooleanField(default=False, help_text='Use testing model for Stage 2')),
('stage_4_use_testing', models.BooleanField(default=False, help_text='Use testing model for Stage 4')),
('stage_5_use_testing', models.BooleanField(default=False, help_text='Use testing model for Stage 5')),
('stage_6_use_testing', models.BooleanField(default=False, help_text='Use testing model for Stage 6')),
('stage_1_budget_pct', models.IntegerField(default=15, help_text='Budget percentage for Stage 1')),
('stage_2_budget_pct', models.IntegerField(default=10, help_text='Budget percentage for Stage 2')),
('stage_4_budget_pct', models.IntegerField(default=40, help_text='Budget percentage for Stage 4')),
('stage_5_budget_pct', models.IntegerField(default=5, help_text='Budget percentage for Stage 5')),
('stage_6_budget_pct', models.IntegerField(default=30, help_text='Budget percentage for Stage 6')),
('within_stage_delay', models.IntegerField(default=3, help_text='Delay between batches within a stage (seconds)')),
('between_stage_delay', models.IntegerField(default=5, help_text='Delay between stage transitions (seconds)')),
('max_keywords_per_run', models.IntegerField(default=0, help_text='Max keywords to process in stage 1 (0=unlimited)')),
('max_clusters_per_run', models.IntegerField(default=0, help_text='Max clusters to process in stage 2 (0=unlimited)')),
('max_ideas_per_run', models.IntegerField(default=0, help_text='Max ideas to process in stage 3 (0=unlimited)')),
('max_tasks_per_run', models.IntegerField(default=0, help_text='Max tasks to process in stage 4 (0=unlimited)')),
('max_content_per_run', models.IntegerField(default=0, help_text='Max content pieces for image prompts in stage 5 (0=unlimited)')),
('max_images_per_run', models.IntegerField(default=0, help_text='Max images to generate in stage 6 (0=unlimited)')),
('max_approvals_per_run', models.IntegerField(default=0, help_text='Max content pieces to auto-approve in stage 7 (0=unlimited)')),
('max_credits_per_run', models.IntegerField(default=0, help_text='Max credits to use per run (0=unlimited)')),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Default Automation Config',
'verbose_name_plural': 'Default Automation Config',
'db_table': 'igny8_default_automation_config',
},
),
]

View File

@@ -0,0 +1,73 @@
# Generated manually for publishing and image default fields
from django.db import migrations, models
def set_default_values(apps, schema_editor):
"""Set default values for publish_days and publish_time_slots"""
DefaultAutomationConfig = apps.get_model('automation', 'DefaultAutomationConfig')
for config in DefaultAutomationConfig.objects.all():
if not config.publish_days:
config.publish_days = ['mon', 'tue', 'wed', 'thu', 'fri']
if not config.publish_time_slots:
config.publish_time_slots = ['09:00', '14:00', '18:00']
config.save()
class Migration(migrations.Migration):
dependencies = [
('automation', '0011_add_default_automation_config'),
]
operations = [
# Publishing defaults
migrations.AddField(
model_name='defaultautomationconfig',
name='auto_approval_enabled',
field=models.BooleanField(default=False, help_text='Auto-approve content after review'),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='auto_publish_enabled',
field=models.BooleanField(default=False, help_text='Auto-publish approved content to site'),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='daily_publish_limit',
field=models.IntegerField(default=3, help_text='Max posts per day'),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='weekly_publish_limit',
field=models.IntegerField(default=15, help_text='Max posts per week'),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='monthly_publish_limit',
field=models.IntegerField(default=50, help_text='Max posts per month'),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='publish_days',
field=models.JSONField(default=list, help_text="Days to publish (e.g., ['mon', 'tue', 'wed', 'thu', 'fri'])"),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='publish_time_slots',
field=models.JSONField(default=list, help_text="Time slots to publish (e.g., ['09:00', '14:00', '18:00'])"),
),
# Image defaults
migrations.AddField(
model_name='defaultautomationconfig',
name='image_style',
field=models.CharField(default='photorealistic', help_text='Default image style', max_length=50),
),
migrations.AddField(
model_name='defaultautomationconfig',
name='max_images_per_article',
field=models.IntegerField(default=4, help_text='Images per article (1-8)'),
),
# Set default JSON values
migrations.RunPython(set_default_values, migrations.RunPython.noop),
]