Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加数据库字段,重建知识库使用多线程 #1280

Merged
merged 8 commits into from Aug 28, 2023

Conversation

liunux4odoo
Copy link
Collaborator

@liunux4odoo liunux4odoo commented Aug 28, 2023

升级注意

对数据库结构做了修改,需要执行python init_database.py --recreate-vs

新增功能

  1. KnowledgeFileModel增加3个字段:file_mtime(文件修改时间),file_size(文件大小),custom_docs(是否使用自定义docs)。为后面比对上传文件、支持用户自定义文档加载做准备。
  2. KnowledgeFileModel增加"docs_count"字段,代表该文件加载到向量库中的Document数量,并在WEBUI中进行展示。
  3. 给所有String字段加上长度,防止mysql建表错误(pr fix some bug in knowledge base #1177)(thanks to hongkong9771)
  4. 统一[faiss/milvus/pgvector]_kb_service.add_doc接口,使其支持自定义docs
  5. 为faiss_kb_service增加一些方法,便于调用
  6. 为KnowledgeFile增加一些方法,便于获取文件信息,缓存file2text的结果。
  7. 重建知识库python init_database.py --recreate-vs支持多线程。(close 上传文件到知识库的解析过程太慢,CPU占用率不足2%。能否改为多线程并发处理? #821, [FEATURE] 是否能增加一个功能,直接读取服务器下某个文件夹的所有文件自动添加到知识库 #1261

修复问题

修复/chat/fastchat无法流式输出的问题

其它:

统一代码中知识库相关函数用词:file代表一个文件名称或路径,doc代表langchain加载后的Document。部分与API接口有关或含义重叠的函数暂未修改。

liunux4odoo added 8 commits August 26, 2023 18:18
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的结果。
1、KnowledgeFileModel增加"docs_count"字段,代表该文件加载到向量库中的Document数量,并在WEBUI中进行展示。
2、重建知识库`python init_database.py --recreate-vs`支持多线程。

其它:
统一代码中知识库相关函数用词:file代表一个文件名称或路径,doc代表langchain加载后的Document。部分与API接口有关或含义重叠的函数暂未修改。
@liunux4odoo liunux4odoo merged commit 3acbf4d into dev Aug 28, 2023
liunux4odoo added a commit that referenced this pull request Aug 29, 2023
* 更新shutdown_all.sh:更新mac设备的额外说明

* update VERSION

* Add files via upload

* Update README.md

* search_engine_chat bug

* 修复 milvus 作为默认数据库初始化异常和调用search方法异常

* Add files via upload

* Update README.md

* 修复搜索引擎聊天接口 (#1228)

* 修复搜索引擎聊天接口

* 修复知识库聊天接口

* 恢复

* 调整KBService 接口函数do_search 并适配pg

* 修正 milvus 更改错误

* update readme about startup.py

* 在search_engine_chat中检查Bing KEY,并更新tests

* update server_config.py.example: 增加多卡启动的说明

* change default search_engine option to 'duckduckgo'

* update readme.md, shutdown_all.sh: 在Linux上使用ctrl+C退出可能会由于linux的多进程机制导致multiprocessing遗留孤儿进程

* update VERSION

* Update README.md

* update requirements.txt

* update requirements

* update requirements

* update VERSION

* [BUG] 修复csv文件读取后,单行数据被分成多段。

* update INSTALL.md (#1250)

Co-authored-by: zzflybird <cmz1@qq.com>

* Update requirements.txt

* fix #1224: failed to load json and pdf files (#1252)

Co-authored-by: liunux4odoo <liunu@qq.com>

* close #1172: 给webui_page/utils添加一些log信息,方便定位错误

* 修复:重建知识库时页面未实时显示进度

* 修复重建知识库界面无反应的问题,添加一些log信息 (#1258)

* close #1172: 给webui_page/utils添加一些log信息,方便定位错误

* 修复:重建知识库时页面未实时显示进度

---------

Co-authored-by: liunux4odoo <liunu@qq.com>

* 适配score_threshold

* skip model_worker running when using online model api such as chatgpt

* 修复使用chatgpt等在线API服务时模型加载错误 (#1271)

* close #1172: 给webui_page/utils添加一些log信息,方便定位错误

* 修复:重建知识库时页面未实时显示进度

* skip model_worker running when using online model api such as chatgpt

---------

Co-authored-by: liunux4odoo <liunu@qq.com>

* update format

* 修改知识库管理相关内容:
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接口有关或含义重叠的函数暂未修改。

* 统一XX_kb_service.add_doc/do_add_doc接口,不再需要embeddings参数

* 增加数据库字段,重建知识库使用多线程 (#1280)

* 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

* 运行startup.py时,如果不加参数直接显示配置和帮助信息后退出

* 运行startup.py时,如果不加参数直接显示配置和帮助信息后退出 (#1284)

* 统一XX_kb_service.add_doc/do_add_doc接口,不再需要embeddings参数

* 运行startup.py时,如果不加参数直接显示配置和帮助信息后退出

---------

Co-authored-by: liunux4odoo <liunu@qq.com>

* update server_config.py:
- 在model_config中增加HISTORY_LEN配置参数
- 将server_config中helper function移动到server.utils中
- 统一set_httpx_timeout的定义和调用

* update webui.py:
应用model_config中的配置项:HISTORY_LEN,VECTOR_SEARCH_TOP_K,SEARCH_ENGINE_TOP_K

* 优化server_config配置项 (#1293)

* update server_config.py:
- 在model_config中增加HISTORY_LEN配置参数
- 将server_config中helper function移动到server.utils中
- 统一set_httpx_timeout的定义和调用

* update webui.py:
应用model_config中的配置项:HISTORY_LEN,VECTOR_SEARCH_TOP_K,SEARCH_ENGINE_TOP_K

---------

Co-authored-by: liunux4odoo <liunu@qq.com>

* fix bug

---------

Co-authored-by: hzg0601 <hzg0601@163.com>
Co-authored-by: imClumsyPanda <littlepanda0716@gmail.com>
Co-authored-by: zqt <1178747941@qq.com>
Co-authored-by: Pickupppp <dingchanghaoo@qq.com>
Co-authored-by: Meiracle <meidanlong@gmail.com>
Co-authored-by: zqt996 <67185303+zqt996@users.noreply.github.com>
Co-authored-by: liunux4odoo <liunu@qq.com>
Co-authored-by: mz <1069732181@qq.com>
Co-authored-by: zzflybird <cmz1@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant