Skip to content

Commit

Permalink
fix: delete datasource bug (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aries-ckt authored May 17, 2024
1 parent c500fb9 commit 6fb3d33
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dbgpt/storage/vector_store/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import os
from collections import defaultdict
from typing import Any, Dict, List, Optional, Tuple, Type, cast
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Type, cast

from dbgpt.core import Chunk, Embeddings
from dbgpt.core.awel.flow import (
Expand All @@ -22,7 +22,7 @@
logger = logging.getLogger(__name__)

connector: Dict[str, Tuple[Type, Type]] = {}
pools = defaultdict(dict)
pools: DefaultDict[str, Dict] = defaultdict(dict)


def _load_vector_options() -> List[OptionValue]:
Expand Down Expand Up @@ -248,7 +248,13 @@ def delete_vector_name(self, vector_name: str):
Args:
- vector_name: vector store name
"""
return self.client.delete_vector_name(vector_name)
try:
if self.vector_name_exists():
self.client.delete_vector_name(vector_name)
except Exception as e:
logger.error(f"delete vector name {vector_name} failed: {e}")
raise Exception(f"delete name {vector_name} failed")
return True

def delete_by_ids(self, ids):
"""Delete vector by ids.
Expand Down

0 comments on commit 6fb3d33

Please sign in to comment.