Browse Source
Add EmbeddingSession model and admin interface for background processing
Add EmbeddingSession model and admin interface for background processing
- Introduced the `EmbeddingSession` model to track the status and progress of embedding tasks, including fields for status, progress, processed items, and error messages. - Created `EmbeddingSessionAdmin` to manage embedding sessions in the admin interface, featuring custom display methods for status badges and progress bars. - Implemented background processing to trigger a FastAPI agent upon creating a new embedding session, enhancing the system's responsiveness and user experience. - Added migrations to establish the new model in the database.master
8 changed files with 229 additions and 3 deletions
-
102apps/agent/admin.py
-
25apps/agent/migrations/0004_embeddingsession.py
-
24apps/agent/models.py
-
18apps/article/migrations/0002_article_embedded_in.py
-
9apps/article/models.py
-
28apps/hadis/migrations/0006_hadis_embedded_in_hadiscorrection_embedded_in_and_more.py
-
16apps/hadis/models/hadis.py
-
10apps/hadis/models/transmitter.py
@ -0,0 +1,25 @@ |
|||||
|
# Generated by Django 4.2.27 on 2026-02-18 11:29 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('agent', '0003_alter_agentprompt_options_and_more'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name='EmbeddingSession', |
||||
|
fields=[ |
||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
|
('status', models.CharField(choices=[('PENDING', 'Pending'), ('PROCESSING', 'Processing'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed')], default='PENDING', max_length=20)), |
||||
|
('progress', models.IntegerField(default=0)), |
||||
|
('processed_items', models.IntegerField(default=0)), |
||||
|
('total_items', models.IntegerField(default=0)), |
||||
|
('error_message', models.TextField(blank=True, null=True)), |
||||
|
('created_at', models.DateTimeField(auto_now_add=True)), |
||||
|
], |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,18 @@ |
|||||
|
# Generated by Django 4.2.27 on 2026-02-18 11:29 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('article', '0001_initial'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name='article', |
||||
|
name='embedded_in', |
||||
|
field=models.JSONField(blank=True, default=list), |
||||
|
), |
||||
|
] |
||||
@ -0,0 +1,28 @@ |
|||||
|
# Generated by Django 4.2.27 on 2026-02-18 11:29 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('hadis', '0005_alter_hadiscategory_slug'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AddField( |
||||
|
model_name='hadis', |
||||
|
name='embedded_in', |
||||
|
field=models.JSONField(blank=True, default=list), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name='hadiscorrection', |
||||
|
name='embedded_in', |
||||
|
field=models.JSONField(blank=True, default=list), |
||||
|
), |
||||
|
migrations.AddField( |
||||
|
model_name='transmitteroriginaltext', |
||||
|
name='embedded_in', |
||||
|
field=models.JSONField(blank=True, default=list), |
||||
|
), |
||||
|
] |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue