Commit Graph

85 Commits

Author SHA1 Message Date
glide-the 1027ab6c06 增加构建文档metadata检索的开关,移动到dev_metadata_search 2023-09-05 20:59:57 +08:00
glide-the 491c9605d9 增加构建文档metadata检索的开关 2023-09-05 18:35:11 +08:00
liunux4odoo 93b133f9ac 将KnowledgeFile的file2text拆分成file2docs、docs2texts和file2text三个部分,在保持接口不变的情况下,实现:
1、支持chunk_size和chunk_overlap参数
2、支持自定义text_splitter
3、支持自定义docs
修复:csv文件不使用text_splitter
2023-09-04 21:00:16 +08:00
imClumsyPanda d6dce95682 bug fix 2023-09-01 14:15:13 +08:00
imClumsyPanda 6c4ef26e9a
add RapidOCRPDFLoader and RapidOCRLoader (#1275)
* add RapidOCRPDFLoader

* update mypdfloader.py and requirements.txt

* add myimgloader.py

* add test samples

* add TODO to mypdfloader

* add loaders to KnowledgeFile class

* add loaders to KnowledgeFile class
2023-09-01 10:23:57 +08:00
liunux4odoo 3acbf4d5d1
增加数据库字段,重建知识库使用多线程 (#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
2023-08-28 13:50:35 +08:00
imClumsyPanda 8faafa6a32 update format 2023-08-27 20:23:07 +08:00
liunux4odoo 9ca53fa3ad
fix #1224: failed to load json and pdf files (#1252)
Co-authored-by: liunux4odoo <liunu@qq.com>
2023-08-26 14:21:59 +08:00
imClumsyPanda f95d41ef47 [BUG] 修复csv文件读取后,单行数据被分成多段。 2023-08-26 11:45:01 +08:00
zR 7291e77978
support for bge-large-zh-noinstruct and openai text-embedding-ada-002 (#1119)
* support for bge-large-zh-noinstruct and openai text-embedding-ada-002

* 完善了readme,修改了BGE模型的载入方式

* 补充了readme中bge-large-zh-noinstruct的信息

* Update faiss_kb_service.py

* Update utils.py

---------

Co-authored-by: zR <zRzRzRzRzRzRzR>
Co-authored-by: imClumsyPanda <littlepanda0716@gmail.com>
2023-08-23 22:55:53 +08:00
xain 6d1ea9bc99 Update utils.py (#1128)
不区分文件扩展名的大小写。
2023-08-17 21:09:05 +08:00
liunux4odoo a47240e871 fix KnowledgeFile: set text_splitter_name in database to SpacyTextSplitter if it is not set 2023-08-16 10:14:47 +08:00
liunux4odoo a08fe994c2 更新API与ApiReuest:
1. 重新整理webui_pages/utils与server/knowledge_base间的工具依赖
2.
将delete_knowledge_base与delete_doc接口从delete改为post.delete不支持body参数
3. 修复update_doc
4. 修复部分bug
2023-08-11 08:45:26 +08:00
imClumsyPanda ef098111dc update webui and utils 2023-08-10 23:04:05 +08:00
imClumsyPanda 8a4d9168fa update import pkgs and format 2023-08-10 21:26:05 +08:00
imClumsyPanda 8df00d0b04 add SCORE_THRESHOLD to faiss and milvus kb service 2023-08-10 00:36:59 +08:00
imClumsyPanda 02b9d57072 update textsplitter and pdfloader 2023-08-09 23:36:43 +08:00
imClumsyPanda 24a280ce8c re-add zh_title_enhance.py 2023-08-09 23:09:24 +08:00
imClumsyPanda 1b70fb5f9b update faiss_kb_service.py 2023-08-09 22:57:36 +08:00
liunux4odoo c7b91bfaf1 update api/kb_doc_api and knowledge base management ui:
1. add update_doc to api which can udpate vector store from existed
   content file
2. add parameter `delete_content` to delete_doc api. user can decide
   whether delete local content file when delete doc.
3. fix bug in ApiReqeust.upload_doc
4. support listing docs existed in local folder bu not in db
2023-08-09 16:52:04 +08:00
liunux4odoo 2b0f8caa62 improve recreate_vector_store:
1. allow empty knowledge base
2. skip unspported files instead of exception
2023-08-08 17:59:41 +08:00
liunux4odoo e918244159 move KBServiceFactory to server.knowledge_base.kb_service.base 2023-08-08 17:41:58 +08:00
liunux4odoo c4a3995310 move commonto tools from kbservice.base to server.knowledge_base.utils 2023-08-08 16:40:18 +08:00
liunux4odoo 584e3a9234 remove server/knowledge_base/knowledge_base_factory.py 2023-08-08 16:21:00 +08:00
liunux4odoo 0746272525 remove server/knowledge_base/knowledge_base.py 2023-08-08 13:36:20 +08:00
imClumsyPanda 18d31f5116 add KBService and KBServiceFactory class 2023-08-06 23:44:02 +08:00
imClumsyPanda b91d96ab0c update kb_doc_api.py 2023-08-06 18:32:10 +08:00
imClumsyPanda 7e1472a95b add KnowledgeBase class 2023-08-05 00:10:10 +08:00
imClumsyPanda 590367a5b5 add KnowledgeFile class 2023-08-04 23:54:26 +08:00
imClumsyPanda 775d46fecf format update in knowledge_base/utils.py 2023-08-04 23:14:43 +08:00
imClumsyPanda b4f80ca370 update server.knowledge_base.utils 2023-08-04 15:32:42 +08:00
imClumsyPanda 7bfbe18011 update requirements.txt and kb_doc_api.py 2023-08-04 15:12:14 +08:00
liunux4odoo c4994e85df fix: knowledge_base_chat and search_engine_chat should stream json text
instead of dict. client should use json.loads.
2023-08-04 12:12:13 +08:00
liunux4odoo 88682c87ff 优化server下知识库相关模块的结构:将知识库相关操作从knowledge_base_chat移动到knowledge_base.utils;优化kb_doc_api中embeddings加载。 2023-08-04 10:16:30 +08:00
imClumsyPanda dcf49a59ef v0.2.0 first commit 2023-07-27 23:22:07 +08:00