mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 21:37:20 +08:00
* 知识库支持子目录(不包括temp和tmp开头的目录),文件相对路径总长度不可超过255 * init_database.py 增加 --import-db 参数,在版本升级时,如果 info.db 表结构发生变化,但向量库无需重建,可以在重建数据库后,使用本参数从旧的数据库中导入信息
17 lines
454 B
Python
17 lines
454 B
Python
from sqlalchemy import create_engine
|
|
from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
from configs import SQLALCHEMY_DATABASE_URI
|
|
import json
|
|
|
|
|
|
engine = create_engine(
|
|
SQLALCHEMY_DATABASE_URI,
|
|
json_serializer=lambda obj: json.dumps(obj, ensure_ascii=False),
|
|
)
|
|
|
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
|
|
|
Base: DeclarativeMeta = declarative_base()
|