fix: remove http delete-kinds regression
This commit is contained in:
@@ -155,14 +155,6 @@ class ThothHttpVectorStore:
|
||||
except VectorRestError as exc:
|
||||
raise VectorStoreError(str(exc)) from exc
|
||||
|
||||
def delete_kinds(self, collection: str, kinds: list[str]) -> int:
|
||||
_collection("vectors", collection)
|
||||
_validate_collection_kinds(collection, kinds)
|
||||
try:
|
||||
return self._require_writer().delete_kinds(collection, kinds)
|
||||
except VectorRestError as exc:
|
||||
raise VectorStoreError(str(exc)) from exc
|
||||
|
||||
def delete_generation(self, collection: str, generation: str, workspace_id: str) -> int:
|
||||
if collection != "evidence" or re.fullmatch(r"gen:[0-9a-f]{32}", generation) is None:
|
||||
raise VectorStoreError("Only exact Evidence generations may be deleted")
|
||||
|
||||
@@ -45,8 +45,15 @@ def _resync_memory(cfg):
|
||||
|
||||
def clear_memory_index(cfg):
|
||||
from tht.adapters.factory import build_vector_store
|
||||
from tht.cli.vector_cmd import make_embedder, open_store, require_direct_vector_cfg
|
||||
|
||||
return build_vector_store(cfg, require_write=True).delete_kinds("memory", ["memory"])
|
||||
if cfg.vectors is not None and cfg.vectors.type == "qdrant":
|
||||
return build_vector_store(cfg, require_write=True).delete_kinds("memory", ["memory"])
|
||||
|
||||
require_direct_vector_cfg(cfg)
|
||||
legacy_store = open_store(cfg, "memory")
|
||||
legacy_store.sync([], make_embedder(cfg.embeddings), kinds={"memory"})
|
||||
return 0
|
||||
|
||||
|
||||
@memory_app.command("promote")
|
||||
|
||||
@@ -80,8 +80,6 @@ class VectorStore(Protocol):
|
||||
|
||||
def upsert(self, collection: str, records: list[VectorWriteRecord]) -> int: ...
|
||||
|
||||
def delete_kinds(self, collection: str, kinds: list[str]) -> int: ...
|
||||
|
||||
def delete_generation(self, collection: str, generation: str, workspace_id: str) -> int: ...
|
||||
|
||||
def list_evidence_generations(self, collection: str, workspace_id: str) -> list[str]: ...
|
||||
|
||||
@@ -150,22 +150,6 @@ class VectorRestClient:
|
||||
return int(payload.get("deleted", 0))
|
||||
return 0
|
||||
|
||||
def delete_kinds(self, table_name: str, kinds: list[str]) -> int:
|
||||
try:
|
||||
payload = self._call(
|
||||
"delete_vector_kinds",
|
||||
{"table_name": table_name, "kinds": kinds},
|
||||
)
|
||||
except VectorRestError as error:
|
||||
if "HTTP 404" in str(error):
|
||||
raise VectorRestError(
|
||||
"delete_vector_kinds RPC is unavailable; deploy the cleanup migration"
|
||||
) from None
|
||||
raise
|
||||
if isinstance(payload, dict):
|
||||
return int(payload.get("deleted", 0))
|
||||
return 0
|
||||
|
||||
def list_evidence_generations(self, table_name: str, workspace_id: str) -> list[str]:
|
||||
if re.fullmatch(r"[a-z][a-z0-9_-]{0,63}", workspace_id) is None:
|
||||
raise ValueError("workspace namespace must be canonical")
|
||||
|
||||
Reference in New Issue
Block a user