Refactor and implement queueing messages

This commit is contained in:
2025-02-12 18:45:21 +00:00
parent 213df9176e
commit 018d2f87c7
23 changed files with 804 additions and 338 deletions

View File

@@ -0,0 +1,22 @@
# Generated by Django 5.1.5 on 2025-02-08 15:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0012_alter_chatsession_last_interaction'),
]
operations = [
migrations.RemoveField(
model_name='manipulation',
name='send_enabled',
),
migrations.AddField(
model_name='manipulation',
name='mode',
field=models.CharField(blank=True, choices=[('active', 'Send replies to messages'), ('instant', 'Click link to send reply'), ('prospective', 'Click link to open page'), ('notify', 'Send notification of ideal reply only'), ('silent', 'Do not generate or send replies')], max_length=50, null=True),
),
]

View File

@@ -0,0 +1,32 @@
# Generated by Django 5.1.5 on 2025-02-08 16:07
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_remove_manipulation_send_enabled_manipulation_mode'),
]
operations = [
migrations.CreateModel(
name='QueuedMessage',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('ts', models.BigIntegerField()),
('sender_uuid', models.CharField(blank=True, max_length=255, null=True)),
('text', models.TextField(blank=True, null=True)),
('custom_author', models.CharField(blank=True, max_length=255, null=True)),
('manipulation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.manipulation')),
('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.chatsession')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['ts'],
},
),
]