1 Star 1 Fork 1

xuelong cao/langchain-ChatGLM

forked from jim/langchain-ChatGLM 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
init_database.py 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
liunux4odoo 提交于 2023-08-11 08:33 . add tools to migrate knowledge base
from server.knowledge_base.migrate import create_tables, folder2db, recreate_all_vs, list_kbs_from_folder
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.formatter_class = argparse.RawTextHelpFormatter
parser.add_argument(
"--recreate-vs",
action="store_true",
help=('''
recreate all vector store.
use this option if you have copied document files to the content folder, but vector store has not been populated or DEFAUL_VS_TYPE/EMBEDDING_MODEL changed.
if your vector store is ready with the configs, just skip this option to fill info to database only.
'''
)
)
args = parser.parse_args()
create_tables()
print("database talbes created")
if args.recreate_vs:
print("recreating all vector stores")
recreate_all_vs()
else:
print("filling kb infos to database")
for kb in list_kbs_from_folder():
folder2db(kb, "fill_info_only")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/pmpleader/langchain-ChatGLM.git
git@gitee.com:pmpleader/langchain-ChatGLM.git
pmpleader
langchain-ChatGLM
langchain-ChatGLM
master

搜索帮助