mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-25 04:53:36 +00:00
fix: Fix the mypy check error (#1373)
Co-authored-by: yyhhyy <95077259+Hui824@users.noreply.github.com> Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: Fangyin Cheng <staneyffer@gmail.com>
This commit is contained in:
parent
62f90c95ce
commit
f2a6284c0e
2
.github/workflows/pylint.yml
vendored
2
.github/workflows/pylint.yml
vendored
@ -27,3 +27,5 @@ jobs:
|
|||||||
run: make setup
|
run: make setup
|
||||||
- name: Check Python code style
|
- name: Check Python code style
|
||||||
run: make fmt-check
|
run: make fmt-check
|
||||||
|
- name: Check Python code type
|
||||||
|
run: make mypy
|
||||||
|
@ -444,7 +444,13 @@ class KnowledgeService:
|
|||||||
if len(spaces) == 0:
|
if len(spaces) == 0:
|
||||||
raise Exception(f"delete error, no space name:{space_name} in database")
|
raise Exception(f"delete error, no space name:{space_name} in database")
|
||||||
space = spaces[0]
|
space = spaces[0]
|
||||||
config = VectorStoreConfig(name=space.name)
|
embedding_factory = CFG.SYSTEM_APP.get_component(
|
||||||
|
"embedding_factory", EmbeddingFactory
|
||||||
|
)
|
||||||
|
embedding_fn = embedding_factory.create(
|
||||||
|
model_name=EMBEDDING_MODEL_CONFIG[CFG.EMBEDDING_MODEL]
|
||||||
|
)
|
||||||
|
config = VectorStoreConfig(name=space.name, embedding_fn=embedding_fn)
|
||||||
vector_store_connector = VectorStoreConnector(
|
vector_store_connector = VectorStoreConnector(
|
||||||
vector_store_type=CFG.VECTOR_STORE_TYPE,
|
vector_store_type=CFG.VECTOR_STORE_TYPE,
|
||||||
vector_store_config=config,
|
vector_store_config=config,
|
||||||
|
@ -174,7 +174,10 @@ class MilvusStore(VectorStoreBase):
|
|||||||
bytes_str = self.collection_name.encode("utf-8")
|
bytes_str = self.collection_name.encode("utf-8")
|
||||||
hex_str = bytes_str.hex()
|
hex_str = bytes_str.hex()
|
||||||
self.collection_name = hex_str
|
self.collection_name = hex_str
|
||||||
|
if vector_store_config.embedding_fn is None:
|
||||||
|
# Perform runtime checks on self.embedding to
|
||||||
|
# ensure it has been correctly set and loaded
|
||||||
|
raise ValueError("embedding_fn is required for MilvusStore")
|
||||||
self.embedding: Embeddings = vector_store_config.embedding_fn
|
self.embedding: Embeddings = vector_store_config.embedding_fn
|
||||||
self.fields: List = []
|
self.fields: List = []
|
||||||
self.alias = milvus_vector_config.get("alias") or "default"
|
self.alias = milvus_vector_config.get("alias") or "default"
|
||||||
|
Loading…
Reference in New Issue
Block a user