From 53c2695ce43465effd4c8732df1954758f1cb513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=90=E5=B1=B1=E5=AE=A2?= <157097695@qq.com> Date: Sat, 21 Dec 2024 15:34:08 +0800 Subject: [PATCH 1/4] Fix bug #2224 --- dbgpt/serve/rag/connector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbgpt/serve/rag/connector.py b/dbgpt/serve/rag/connector.py index 6eb266015..da4fa785e 100644 --- a/dbgpt/serve/rag/connector.py +++ b/dbgpt/serve/rag/connector.py @@ -3,6 +3,7 @@ import copy import logging import os +import chromadb from collections import defaultdict from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Type, cast @@ -224,6 +225,8 @@ def delete_vector_name(self, vector_name: str): try: if self.vector_name_exists(): self.client.delete_vector_name(vector_name) + chromadb.api.client.SharedSystemClient.clear_system_cache() + 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") From 9debf9311caa116c7e1468917da8260906391c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=90=E5=B1=B1=E5=AE=A2?= <157097695@qq.com> Date: Mon, 23 Dec 2024 09:27:49 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=94=BE=E5=85=A5=20chroma=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbgpt/serve/rag/connector.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/dbgpt/serve/rag/connector.py b/dbgpt/serve/rag/connector.py index da4fa785e..d4a76ffc8 100644 --- a/dbgpt/serve/rag/connector.py +++ b/dbgpt/serve/rag/connector.py @@ -3,7 +3,6 @@ import copy import logging import os -import chromadb from collections import defaultdict from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Type, cast @@ -225,7 +224,6 @@ def delete_vector_name(self, vector_name: str): try: if self.vector_name_exists(): self.client.delete_vector_name(vector_name) - chromadb.api.client.SharedSystemClient.clear_system_cache() del pools[self._vector_store_type][vector_name] except Exception as e: logger.error(f"delete vector name {vector_name} failed: {e}") From 3e1af3f039723046f5d39b13785c6edc6bc2fc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9D=90=E5=B1=B1=E5=AE=A2?= <157097695@qq.com> Date: Mon, 23 Dec 2024 09:28:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=94=BE=E5=85=A5=20chroma=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbgpt/storage/vector_store/chroma_store.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbgpt/storage/vector_store/chroma_store.py b/dbgpt/storage/vector_store/chroma_store.py index 93191c715..25f8140b7 100644 --- a/dbgpt/storage/vector_store/chroma_store.py +++ b/dbgpt/storage/vector_store/chroma_store.py @@ -5,6 +5,7 @@ from chromadb import PersistentClient from chromadb.config import Settings +from chromadb.api.client import SharedSystemClient from dbgpt._private.pydantic import ConfigDict, Field from dbgpt.configs.model_config import PILOT_PATH @@ -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 From 66c0cbd742e5b8ef2ef502f9cf0dfbfd848626ff Mon Sep 17 00:00:00 2001 From: dusx1981 <157097695@qq.com> Date: Mon, 23 Dec 2024 19:47:12 +0800 Subject: [PATCH 4/4] fix lint error --- dbgpt/storage/vector_store/chroma_store.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbgpt/storage/vector_store/chroma_store.py b/dbgpt/storage/vector_store/chroma_store.py index 25f8140b7..fdc36e58f 100644 --- a/dbgpt/storage/vector_store/chroma_store.py +++ b/dbgpt/storage/vector_store/chroma_store.py @@ -4,8 +4,8 @@ from typing import Any, Dict, Iterable, List, Mapping, Optional, Union from chromadb import PersistentClient -from chromadb.config import Settings from chromadb.api.client import SharedSystemClient +from chromadb.config import Settings from dbgpt._private.pydantic import ConfigDict, Field from dbgpt.configs.model_config import PILOT_PATH