Skip to content

Commit 4376394

Browse files
committed
fix:issue2484
1 parent 88bbd69 commit 4376394

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/dbgpt-ext/src/dbgpt_ext/storage/vector_store/chroma_store.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
VectorStoreConfig,
1515
)
1616
from dbgpt.storage.vector_store.filters import FilterOperator, MetadataFilters
17+
from dbgpt.util import string_utils
1718
from dbgpt.util.i18n_utils import _
1819

1920
logger = logging.getLogger(__name__)
@@ -110,6 +111,11 @@ def __init__(
110111
self.embeddings = embedding_fn
111112
if not self.embeddings:
112113
raise ValueError("Embeddings is None")
114+
self._collection_name = name
115+
if string_utils.contains_chinese(name):
116+
bytes_str = self._collection_name.encode("utf-8")
117+
hex_str = bytes_str.hex()
118+
self._collection_name = hex_str
113119
chroma_settings = Settings(
114120
# chroma_db_impl="duckdb+parquet", => deprecated configuration of Chroma
115121
persist_directory=self.persist_dir,
@@ -121,9 +127,9 @@ def __init__(
121127
path=self.persist_dir, settings=chroma_settings
122128
)
123129
collection_metadata = collection_metadata or {"hnsw:space": "cosine"}
124-
self._collection_name = name
130+
125131
self._collection = self._chroma_client.get_or_create_collection(
126-
name=name,
132+
name=self._collection_name,
127133
embedding_function=None,
128134
metadata=collection_metadata,
129135
)

0 commit comments

Comments
 (0)