From 6b4ccc8dfcb70c0c2449cd7231ceddb1945aaee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=90=E5=B1=B1=E5=AE=A2?= <157097695@qq.com> Date: Fri, 27 Dec 2024 17:50:41 +0800 Subject: [PATCH] Fix Bug #2224 (#2240) --- dbgpt/serve/rag/connector.py | 1 + dbgpt/storage/vector_store/chroma_store.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/dbgpt/serve/rag/connector.py b/dbgpt/serve/rag/connector.py index 6eb266015..d4a76ffc8 100644 --- a/dbgpt/serve/rag/connector.py +++ b/dbgpt/serve/rag/connector.py @@ -224,6 +224,7 @@ def delete_vector_name(self, vector_name: str): try: if self.vector_name_exists(): self.client.delete_vector_name(vector_name) + del pools[self._vector_store_type][vector_name] except Exception as e: logger.error(f"delete vector name {vector_name} failed: {e}") raise Exception(f"delete name {vector_name} failed") diff --git a/dbgpt/storage/vector_store/chroma_store.py b/dbgpt/storage/vector_store/chroma_store.py index 93191c715..fdc36e58f 100644 --- a/dbgpt/storage/vector_store/chroma_store.py +++ b/dbgpt/storage/vector_store/chroma_store.py @@ -4,6 +4,7 @@ from typing import Any, Dict, Iterable, List, Mapping, Optional, Union from chromadb import PersistentClient +from chromadb.api.client import SharedSystemClient from chromadb.config import Settings from dbgpt._private.pydantic import ConfigDict, Field @@ -201,6 +202,7 @@ def delete_vector_name(self, vector_name: str): logger.info(f"chroma vector_name:{vector_name} begin delete...") # self.vector_store_client.delete_collection() self._chroma_client.delete_collection(self._collection.name) + SharedSystemClient.clear_system_cache() self._clean_persist_folder() return True