This commit is contained in:
Daniel
2026-03-31 10:52:49 +08:00
parent c7788fdd92
commit c6fabe262c
4 changed files with 42 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
from sqlalchemy import select
from sqlalchemy.orm import Session, selectinload

View File

@@ -1,3 +1,5 @@
from __future__ import annotations
from sqlalchemy import select
from sqlalchemy.orm import Session, selectinload

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import json
import math
import uuid
from collections import defaultdict
from qdrant_client import QdrantClient, models
@@ -46,7 +47,7 @@ class LightRAGAdapter:
collection_name=self.settings.qdrant_collection,
points=[
models.PointStruct(
id=job.job_id,
id=self._point_id(job.job_id),
vector=self._vectorize(payload["document"]),
payload=payload,
)
@@ -69,7 +70,7 @@ class LightRAGAdapter:
collection_name=self.settings.qdrant_collection,
points=[
models.PointStruct(
id=worker.worker_id,
id=self._point_id(worker.worker_id),
vector=self._vectorize(payload["document"]),
payload=payload,
)
@@ -141,3 +142,7 @@ class LightRAGAdapter:
if chunk:
tokens.append(chunk)
return tokens
def _point_id(self, entity_id: str) -> str:
# Qdrant v1.14 accepts point IDs as UUID or unsigned int.
return str(uuid.uuid5(uuid.NAMESPACE_URL, entity_id))