mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-21 14:23:33 +08:00
* close #1172: 给webui_page/utils添加一些log信息,方便定位错误 * 修复:重建知识库时页面未实时显示进度 * skip model_worker running when using online model api such as chatgpt * 修改知识库管理相关内容: 1.KnowledgeFileModel增加3个字段:file_mtime(文件修改时间),file_size(文件大小),custom_docs(是否使用自定义docs)。为后面比对上传文件做准备。 2.给所有String字段加上长度,防止mysql建表错误(pr#1177) 3.统一[faiss/milvus/pgvector]_kb_service.add_doc接口,使其支持自定义docs 4.为faiss_kb_service增加一些方法,便于调用 5.为KnowledgeFile增加一些方法,便于获取文件信息,缓存file2text的结果。 * 修复/chat/fastchat无法流式输出的问题 * 新增功能: 1、KnowledgeFileModel增加"docs_count"字段,代表该文件加载到向量库中的Document数量,并在WEBUI中进行展示。 2、重建知识库`python init_database.py --recreate-vs`支持多线程。 其它: 统一代码中知识库相关函数用词:file代表一个文件名称或路径,doc代表langchain加载后的Document。部分与API接口有关或含义重叠的函数暂未修改。 --------- Co-authored-by: liunux4odoo <liunux@qq.com>, hongkong9771
20 lines
850 B
Python
20 lines
850 B
Python
from sqlalchemy import Column, Integer, String, DateTime, func
|
|
|
|
from server.db.base import Base
|
|
|
|
|
|
class KnowledgeBaseModel(Base):
|
|
"""
|
|
知识库模型
|
|
"""
|
|
__tablename__ = 'knowledge_base'
|
|
id = Column(Integer, primary_key=True, autoincrement=True, comment='知识库ID')
|
|
kb_name = Column(String(50), comment='知识库名称')
|
|
vs_type = Column(String(50), comment='向量库类型')
|
|
embed_model = Column(String(50), comment='嵌入模型名称')
|
|
file_count = Column(Integer, default=0, comment='文件数量')
|
|
create_time = Column(DateTime, default=func.now(), comment='创建时间')
|
|
|
|
def __repr__(self):
|
|
return f"<KnowledgeBase(id='{self.id}', kb_name='{self.kb_name}', vs_type='{self.vs_type}', embed_model='{self.embed_model}', file_count='{self.file_count}', create_time='{self.create_time}')>"
|