Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete datasource bug #1533

Merged
merged 5 commits into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading