mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-16 06:30:02 +00:00
globalization, upgrade
This commit is contained in:
@@ -99,7 +99,7 @@ def gen_sqlgen_conversation(dbname):
|
||||
schemas = mo.get_schema(dbname)
|
||||
for s in schemas:
|
||||
message += s["schema_info"] + ";"
|
||||
return f"数据库{dbname}的Schema信息如下: {message}\n"
|
||||
return f"Database {dbname} Schema information as follows: {message}\n"
|
||||
|
||||
|
||||
conv_one_shot = Conversation(
|
||||
@@ -162,7 +162,7 @@ auto_dbgpt_one_shot = Conversation(
|
||||
|
||||
|
||||
Schema:
|
||||
数据库gpt-user的Schema信息如下: users(city,create_time,email,last_login_time,phone,user_name);
|
||||
Database gpt-user Schema information as follows: users(city,create_time,email,last_login_time,phone,user_name);
|
||||
|
||||
|
||||
Commands:
|
||||
|
@@ -17,7 +17,7 @@ from pilot.logs import logger
|
||||
|
||||
def inspect_zip_for_modules(zip_path: str, debug: bool = False) -> list[str]:
|
||||
"""
|
||||
加载zip文件的插件,完全兼容Auto_gpt_plugin
|
||||
Loader zip plugin file. Native support Auto_gpt_plugin
|
||||
|
||||
Args:
|
||||
zip_path (str): Path to the zipfile.
|
||||
|
@@ -40,8 +40,8 @@ def knownledge_tovec_st(filename):
|
||||
|
||||
|
||||
def load_knownledge_from_doc():
|
||||
"""从数据集当中加载知识
|
||||
# TODO 如果向量存储已经存在, 则无需初始化
|
||||
"""Loader Knownledge from current datasets
|
||||
# TODO if the vector store is exists, just use it.
|
||||
"""
|
||||
|
||||
if not os.path.exists(DATASETS_DIR):
|
||||
|
@@ -40,15 +40,15 @@ class KnownLedge2Vector:
|
||||
|
||||
def init_vector_store(self):
|
||||
persist_dir = os.path.join(VECTORE_PATH, ".vectordb")
|
||||
print("向量数据库持久化地址: ", persist_dir)
|
||||
print("Vector store Persist address is: ", persist_dir)
|
||||
if os.path.exists(persist_dir):
|
||||
# 从本地持久化文件中Load
|
||||
print("从本地向量加载数据...")
|
||||
# Loader from local file.
|
||||
print("Loader data from local persist vector file...")
|
||||
vector_store = Chroma(persist_directory=persist_dir, embedding_function=self.embeddings)
|
||||
# vector_store.add_documents(documents=documents)
|
||||
else:
|
||||
documents = self.load_knownlege()
|
||||
# 重新初始化
|
||||
# reinit
|
||||
vector_store = Chroma.from_documents(documents=documents,
|
||||
embedding=self.embeddings,
|
||||
persist_directory=persist_dir)
|
||||
@@ -61,17 +61,17 @@ class KnownLedge2Vector:
|
||||
for file in files:
|
||||
filename = os.path.join(root, file)
|
||||
docs = self._load_file(filename)
|
||||
# 更新metadata数据
|
||||
# update metadata.
|
||||
new_docs = []
|
||||
for doc in docs:
|
||||
doc.metadata = {"source": doc.metadata["source"].replace(DATASETS_DIR, "")}
|
||||
print("文档2向量初始化中, 请稍等...", doc.metadata)
|
||||
print("Documents to vector running, please wait...", doc.metadata)
|
||||
new_docs.append(doc)
|
||||
docments += new_docs
|
||||
return docments
|
||||
|
||||
def _load_file(self, filename):
|
||||
# 加载文件
|
||||
# Loader file
|
||||
if filename.lower().endswith(".pdf"):
|
||||
loader = UnstructuredFileLoader(filename)
|
||||
text_splitor = CharacterTextSplitter()
|
||||
|
Reference in New Issue
Block a user