Add Qdrant and ChromaDB support to the project
- Added Qdrant service to both docker-compose files for production and development. - Updated environment variables in .env.example and settings.py to include Qdrant configuration. - Included necessary dependencies for Qdrant and ChromaDB in requirements.txt. - Updated .gitignore to exclude ChromaDB data files.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
ورودی RAG: لحن، پایگاه دانش و اطلاعات کاربر را embed و به Qdrant میفرستد.
|
||||
اجرا: python manage.py rag_ingest [--recreate]
|
||||
"""
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from rag.ingest import ingest
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "Embed لحن، پایگاه دانش و اطلاعات کاربر و ذخیره در Qdrant"
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
"--recreate",
|
||||
action="store_true",
|
||||
help="collection را از نو بساز (حذف و ایجاد مجدد)",
|
||||
)
|
||||
|
||||
def handle(self, *args, **options):
|
||||
recreate = options.get("recreate", False)
|
||||
result = ingest(recreate=recreate)
|
||||
if "error" in result:
|
||||
self.stderr.write(self.style.ERROR(result["error"]))
|
||||
return
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(
|
||||
f"✓ {result['chunks_added']} چانک از منابع {result['sources']} ذخیره شد."
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user