mirror of
https://github.com/thecyberlearn/quantum-ai-v2.git
synced 2026-08-18 13:52:59 +00:00
- Add is_locked field to Agent model with migration - Create stable-working-agents branch and v1.0-working tag - Export working agents and user data to backups/ - Implement freeze_agents command to lock/unlock agents - Create restore_working_state command for one-click restoration - Lock current 3 working agents (Social Ads, Job Posting, PDF Summarizer) - Add lock status to admin interface Safe house established! All working agents are now protected. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from django.core.management.base import BaseCommand
|
|
from agents.models import Agent
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Lock all currently active agents to prevent modifications'
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument(
|
|
'--unlock',
|
|
action='store_true',
|
|
help='Unlock all agents instead of locking them',
|
|
)
|
|
|
|
def handle(self, *args, **options):
|
|
if options['unlock']:
|
|
# Unlock all agents
|
|
updated = Agent.objects.filter(is_locked=True).update(is_locked=False)
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f'✅ Unlocked {updated} agents')
|
|
)
|
|
else:
|
|
# Lock all active agents
|
|
active_agents = Agent.objects.filter(is_active=True, is_locked=False)
|
|
agent_names = list(active_agents.values_list('name', flat=True))
|
|
updated = active_agents.update(is_locked=True)
|
|
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f'🔒 Locked {updated} active agents:')
|
|
)
|
|
for name in agent_names:
|
|
self.stdout.write(f' - {name}')
|
|
|
|
self.stdout.write(
|
|
self.style.WARNING('⚠️ Locked agents cannot be modified until unlocked')
|
|
) |