parent
97fe817186
commit
6c4e6bf1d6
119 changed files with 3181 additions and 5892 deletions
|
|
@ -4,7 +4,7 @@ import time
|
|||
import click
|
||||
from celery import shared_task
|
||||
|
||||
from core.index.index import IndexBuilder
|
||||
from core.rag.datasource.vdb.vector_factory import Vector
|
||||
from models.dataset import Dataset
|
||||
from services.dataset_service import DatasetCollectionBindingService
|
||||
|
||||
|
|
@ -30,12 +30,11 @@ def delete_annotation_index_task(annotation_id: str, app_id: str, tenant_id: str
|
|||
collection_binding_id=dataset_collection_binding.id
|
||||
)
|
||||
|
||||
vector_index = IndexBuilder.get_default_high_quality_index(dataset)
|
||||
if vector_index:
|
||||
try:
|
||||
vector_index.delete_by_metadata_field('annotation_id', annotation_id)
|
||||
except Exception:
|
||||
logging.exception("Delete annotation index failed when annotation deleted.")
|
||||
try:
|
||||
vector = Vector(dataset, attributes=['doc_id', 'annotation_id', 'app_id'])
|
||||
vector.delete_by_metadata_field('annotation_id', annotation_id)
|
||||
except Exception:
|
||||
logging.exception("Delete annotation index failed when annotation deleted.")
|
||||
end_at = time.perf_counter()
|
||||
logging.info(
|
||||
click.style('App annotations index deleted : {} latency: {}'.format(app_id, end_at - start_at),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue