ingest whole textbooks chapter by chapter, resumably
نقشهی فیزیکیِ کتابها (افستِ صفحه، بازهی هر فصل، درسهای داخلِ فصل از فهرستِ خودِ کتاب) در rag/services/textbooks.py ثبت شد تا عنوانِ فصل از کتاب بیاید نه از حدسِ مدل — رشتهی فصل باید دقیقاً بینِ ingest و retrieval یکی باشد وگرنه نتیجه بیسروصدا خالی برمیگردد. rag_ingest_book کتاب را فصلبهفصل ingest میکند و قابلِ ازسرگیری است: rag.IngestedPage نشانهی «این صفحه پردازش شد» را نگه میدارد حتی وقتی صفحه chunkی نساخته، وگرنه هر بار اجرای دوباره بابتِ صفحههای بیمسئله دوباره پول میگرفت. --plan هزینه را رایگان برآورد میکند. rag_import_collection نقاطِ موجودِ Qdrant را در LessonChunk میریزد — فقط میخواند، رایگان و idempotent، برای پایههایی که تیمِ دیگر ingest کرده بود. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.2.17 on 2026-09-12 14:11
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rag', '0002_lessonchunk_chapter_title_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='lessonchunk',
|
||||
name='source_page',
|
||||
field=models.PositiveIntegerField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='lessonchunk',
|
||||
name='lesson_id',
|
||||
field=models.IntegerField(blank=True, db_index=True, null=True),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='lessonchunk',
|
||||
index=models.Index(fields=['collection', 'chapter_title', 'source_page'], name='rag_lessonc_collect_6f5d51_idx'),
|
||||
),
|
||||
]
|
||||
28
rag/migrations/0004_ingestedpage.py
Normal file
28
rag/migrations/0004_ingestedpage.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 5.2.17 on 2026-09-12 14:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rag', '0003_lessonchunk_source_page_alter_lessonchunk_lesson_id_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='IngestedPage',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('collection', models.CharField(db_index=True, max_length=200)),
|
||||
('chapter_title', models.CharField(max_length=255)),
|
||||
('page', models.PositiveIntegerField()),
|
||||
('chunk_count', models.PositiveSmallIntegerField(default=0)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['collection', 'page'],
|
||||
'constraints': [models.UniqueConstraint(fields=('collection', 'page'), name='uniq_ingested_page_per_collection')],
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user