Commit Graph

49 Commits

Author SHA1 Message Date
wvivi2023 319475e0f6 编辑分块功能 2024-03-21 11:11:34 +08:00
wvivi2023 df993defcc fix faiss vector error 2024-03-01 14:04:27 +08:00
wvivi2023 338b4c30db 知识库显示不正确的问题 2024-01-31 15:34:54 +08:00
wvivi2023 5b211fc44d Merge branch 'master' into branch-0.2.9 2024-01-26 18:08:14 +08:00
liunux4odoo 9c525b7fa5
publish 0.2.10 (#2797)
新功能:
- 优化 PDF 文件的 OCR,过滤无意义的小图片 by @liunux4odoo #2525
- 支持 Gemini 在线模型 by @yhfgyyf #2630
- 支持 GLM4 在线模型 by @zRzRzRzRzRzRzR
- elasticsearch更新https连接 by @xldistance #2390
- 增强对PPT、DOC知识库文件的OCR识别 by @596192804 #2013
- 更新 Agent 对话功能 by @zRzRzRzRzRzRzR
- 每次创建对象时从连接池获取连接,避免每次执行方法时都新建连接 by @Lijia0 #2480
- 实现 ChatOpenAI 判断token有没有超过模型的context上下文长度 by @glide-the
- 更新运行数据库报错和项目里程碑 by @zRzRzRzRzRzRzR #2659
- 更新配置文件/文档/依赖 by @imClumsyPanda @zRzRzRzRzRzRzR
- 添加日文版 readme by @eltociear #2787

修复:
- langchain 更新后,PGVector 向量库连接错误 by @HALIndex #2591
- Minimax's model worker 错误 by @xyhshen 
- ES库无法向量检索.添加mappings创建向量索引 by MSZheng20 #2688
2024-01-26 06:58:49 +08:00
wvivi2023 173b23ad7d enhance 2024-01-18 15:44:14 +08:00
wvivi2023 9fc4793b79 enahnce 2024-01-05 09:58:29 +08:00
wvivi2023 3593e6ca2c update 2024-01-04 18:02:43 +08:00
liunux4odoo 9ff7bef2c2
新功能:知识库管理界面支持查看、编辑、删除向量库文档 (#2471)
* 新功能:
- 知识库管理界面支持查看、编辑、删除向量库文档。暂不支持增加(aggrid添加新行比较麻烦,需要另外实现)
- 去除知识库管理界面中重建知识库和删除知识库按钮,建议用户到终端命令操作

修复:
- 所有与知识库名称、文件名称有关的数据库操作函数都改成大小写不敏感,所有路径统一为 posix 风格,避免因路径文本不一致导致数据重复和操作失效 (close #2232)

开发者:
- 添加 update_docs_by_id 函数与 API 接口。当前仅支持 FAISS,暂时未用到,未将来对知识库做更细致的修改做准备
- 统一 DocumentWithScore 与 DocumentWithVsId
- FAISS 返回的 Document.metadata 中包含 ID, 方便后续查找比对
- /knowledge_base/search_docs 接口支持 file_name, metadata 参数,可以据此检索文档

* fix bug
2023-12-26 13:44:36 +08:00
imClumsyPanda 60f8e1d55e update aggrid pagination 2023-11-30 23:40:03 +08:00
qiankunli fa906b33a8
添加对话评分与历史消息保存功能 (#1940)
* 新功能:
- WEBUI 添加对话评分功能
- 增加 /chat/feedback 接口,用于接收对话评分
- /chat/chat 接口返回值由 str 改为 {"text":str, "chat_history_id": str}
- init_database.py 添加 --create-tables --clear-tables 参数

依赖:
- streamlit-chatbox==1.1.11

开发者:
- ChatHistoryModel 的 id 字段支持自动生成
- SAVE_CHAT_HISTORY 改到 basic_config.py

* 修复:点击反馈后页面未刷新

---------

Co-authored-by: liqiankun.1111 <liqiankun.1111@bytedance.com>
Co-authored-by: liunux4odoo <liunux@qq.com>
Co-authored-by: liunux4odoo <41217877+liunux4odoo@users.noreply.github.com>
2023-11-03 11:31:45 +08:00
liunux4odoo 65592a45c3
支持在线 Embeddings, Lite 模式支持所有知识库相关功能 (#1924)
新功能:
- 支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api
- API 增加 /other/embed_texts 接口
- init_database.py 增加 --embed-model 参数,可以指定使用的嵌入模型(本地或在线均可)
- 对于 FAISS 知识库,支持多向量库,默认位置:{KB_PATH}/vector_store/{embed_model}
- Lite 模式支持所有知识库相关功能。此模式下最主要的限制是:
  - 不能使用本地 LLM 和 Embeddings 模型
  - 知识库不支持 PDF 文件
- init_database.py 重建知识库时不再默认情况数据库表,增加 clear-tables 参数手动控制。
- API 和 WEBUI 中 score_threshold 参数范围改为 [0, 2],以更好的适应在线嵌入模型

问题修复:
- API 中 list_config_models 会删除 ONLINE_LLM_MODEL 中的敏感信息,导致第二轮API请求错误

开发者:
- 统一向量库的识别:以(kb_name,embed_model)为判断向量库唯一性的依据,避免 FAISS 知识库缓存加载逻辑错误
- KBServiceFactory.get_service_by_name 中添加 default_embed_model 参数,用于在构建新知识库时设置 embed_model
- 优化 kb_service 中 Embeddings 操作:
  - 统一加载接口: server.utils.load_embeddings,利用全局缓存避免各处 Embeddings 传参
  - 统一文本嵌入接口:server.knowledge_base.kb_service.base.[embed_texts, embed_documents]
- 重写 normalize 函数,去除对 scikit-learn/scipy 的依赖
2023-10-31 14:26:50 +08:00
liunux4odoo deed92169f
支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api (#1907)
* 新功能:
- 支持在线 Embeddings:zhipu-api, qwen-api, minimax-api, qianfan-api
- API 增加 /other/embed_texts 接口
- init_database.py 增加 --embed-model 参数,可以指定使用的嵌入模型(本地或在线均可)

问题修复:
- API 中 list_config_models 会删除 ONLINE_LLM_MODEL 中的敏感信息,导致第二轮API请求错误

开发者:
- 优化 kb_service 中 Embeddings 操作:
  - 统一加载接口: server.utils.load_embeddings,利用全局缓存避免各处 Embeddings 传参
  - 统一文本嵌入接口:server.embedding_api.[embed_texts, embed_documents]
2023-10-28 23:37:30 +08:00
liunux4odoo 27418ba9fa fix bug, add dependencies: strsimpy, markdownify 2023-10-25 08:58:31 +08:00
zR 69e5da4e7a
北京黑客松更新 (#1785)
* 北京黑客松更新

知识库支持:
支持zilliz数据库
Agent支持:
支持以下工具调用
1. 支持互联网Agent调用
2. 支持知识库Agent调用
3. 支持旅游助手工具(未上传)

知识库更新
1. 支持知识库简介,用于Agent选择
2. UI对应知识库简介

提示词选择
1. UI 和模板支持提示词模板更换选择
2023-10-18 15:19:02 +08:00
liunux4odoo f7c73b842a
优化configs (#1474)
* remove llm_model_dict

* optimize configs

* fix get_model_path

* 更改一些默认参数,添加千帆的默认配置

* Update server_config.py.example
2023-09-15 17:52:22 +08:00
imClumsyPanda a87a2815da update knowledge_base and dialogue page of webui 2023-09-15 13:45:47 +08:00
imClumsyPanda eb49a91190 update webui_pages/knowledge_base.py 2023-09-15 11:04:23 +08:00
imClumsyPanda f066e427ce update webui_pages/knowledge_base.py 2023-09-15 10:58:52 +08:00
liunux4odoo 30aeec1c45
修改智谱API默认名称,给WEBUI设置主题 (#1484)
* 給WEBUI设置主题

* chatglm-api更名为zhipu-api
2023-09-15 01:48:02 +08:00
liunux4odoo 16d8809c9a
api和webui知识库操作支持chunk_size/overlap_size/zh_title_enhance参数 (#1459) 2023-09-13 11:19:47 +08:00
liunux4odoo 1195eb75eb merge pr1413 2023-09-08 10:30:07 +08:00
liunux4odoo 4cfee9c17c 根据新的接口修改ApiRequest和webui,以及测试用例。修改后预期webui中批量知识文件相关操作减少时间 2023-09-08 10:22:04 +08:00
imClumsyPanda 6702f39db1 update knowledge_base page 2023-09-05 21:01:40 +08:00
imClumsyPanda fdfbf31318 fix streamlit-aggrid showing "For Trial Use Only" 2023-09-05 18:19:13 +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
liunux4odoo 96f69edf7b
修复重建知识库界面无反应的问题,添加一些log信息 (#1258)
* close #1172: 给webui_page/utils添加一些log信息,方便定位错误

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

---------

Co-authored-by: liunux4odoo <liunu@qq.com>
2023-08-26 18:26:38 +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
liunux4odoo f40bb69224 优化FAISS向量库多文件操作;修复recreate_vector_store,大量文件时不再超时。 2023-08-20 19:10:29 +08:00
liunux4odoo 69627a2fa3 update chat and knowledge base api: unify exception processing and return types 2023-08-19 15:14:45 +08:00
liunux4odoo d4cf77170a fix webui: correct error messages 2023-08-18 11:47:49 +08:00
liunux4odoo 1551adb867 fix webui: use kb_names as selected_kb's options to avoid index error after delete_doc 2023-08-16 10:04:17 +08:00
liunux4odoo 7c0e9c46db fix api & webui: 1.add logs, 2. check json response, 3. set timeout=False in recreate_vector_stoore 2023-08-15 14:24:54 +08:00
liunux4odoo ec984205ae fix knowledge base management:
1. docs in database were note deleted when clear vector store
2. diable buttons when local doc file not exist.
2023-08-14 19:09:02 +08:00
imClumsyPanda 2ad33e010d update webui.py and README.md 2023-08-12 14:08:21 +08:00
imClumsyPanda 844b15a6f7 update webui.knowledge_base layout 2023-08-12 01:26:17 +08:00
imClumsyPanda afc6aa968d update webui layout 2023-08-11 23:40:41 +08:00
liunux4odoo 2bb9a7949f fix: delete knowledge base error 2023-08-11 23:35:27 +08:00
liunux4odoo 9add46ebbd add recreate vector store to knowledge base mamagement ui 2023-08-11 14:11:34 +08:00
liunux4odoo 2a57f49d80 update knowledge base management ui.
remove numpy/pandas from requirements, move them to webui requirements
2023-08-11 13:53:20 +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 3c44cf65cd update webui layout 2023-08-10 23:51:10 +08:00
liunux4odoo d89fcb3b2e update knowledge base management page:
1. move get_kb_details & get_doc_details to utils.py
2. adjust aggrid columns width.
2023-08-10 11:37:14 +08:00
liunux4odoo 450b23c4f2 update knowledge base management api and ui 2023-08-09 22:00:33 +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 ec76adc81d update knowledge base management ui 2023-08-08 23:58:44 +08:00
liunux4odoo 08493bffbb add a basic knowledge base management ui. 2023-08-07 21:00:55 +08:00
imClumsyPanda 5ce2484af0 update webui.py 2023-08-01 15:08:19 +08:00
imClumsyPanda bcfd3f5af5 add webui_pages 2023-08-01 14:47:38 +08:00