Commit Graph

260 Commits

Author SHA1 Message Date
zqt996 67ac53242d
Merge pull request #1233 from Pickupppp/master
修复 milvus 作为默认数据库初始化异常和调用search方法异常
2023-08-24 22:28:38 +08:00
Meiracle bc3dbb443e
修复搜索引擎聊天接口 (#1228)
* 修复搜索引擎聊天接口

* 修复知识库聊天接口

* 恢复
2023-08-24 22:18:33 +08:00
Pickupppp 050a585a9d 修复 milvus 作为默认数据库初始化异常和调用search方法异常 2023-08-24 21:31:02 +08:00
zqt 2a2b95d214 search_engine_chat bug 2023-08-24 17:25:54 +08:00
liunux4odoo 63ca393731 参照chat,给knowledge_base_chat/search_engine_chat添加chatgpt代理设置 2023-08-24 15:10:51 +08:00
zqt ea4b5ebd16 Merge branch 'master' into dev 2023-08-24 14:16:21 +08:00
zqt 37454db3ec 添加chatgpt 调用代理设置 2023-08-24 13:51:17 +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
liunux4odoo 351b62f7a7 fix part of #1206: add/delete/update_doc() get unexpected keyword argument 'not_refresh_vs_cache` 2023-08-23 15:26:52 +08:00
liunux4odoo 44edce6bcf fix #1142: 在History中使用jinja2模板代替f-string,避免消息中含有{ }时出错 2023-08-23 08:35:26 +08:00
zqt 16542f20b4 修复pg和milvus kbservice代码 2023-08-22 16:52:04 +08:00
zqt996 11856cc542
Merge pull request #1160 from shutter-cp/master
fix bug 1159
2023-08-22 16:38:06 +08:00
liunux4odoo c571585ffd optimize recreate vector store: save vector store once after all docs parsed for FAISS 2023-08-21 08:50:15 +08:00
liunux4odoo f40bb69224 优化FAISS向量库多文件操作;修复recreate_vector_store,大量文件时不再超时。 2023-08-20 19:10:29 +08:00
liunux4odoo 150a78bfd9 update kb_doc_api:make faiss cache working; delete vector store docs before add duplicate docs 2023-08-20 16:52:49 +08:00
imClumsyPanda 62aa97bb32 Merge branch 'master' into dev 2023-08-20 10:39:30 +08:00
imClumsyPanda cdea240c31 update README.md and llm_api_stale.py 2023-08-20 10:38:41 +08:00
liunux4odoo 69627a2fa3 update chat and knowledge base api: unify exception processing and return types 2023-08-19 15:14:45 +08:00
陈鹏 95d9fb0ee9
fix bug 1159
修复使用使用pg存储向量时,向量检索错误 {TypeError}TypeError("'Document' object is not subscriptable")
2023-08-18 14:41:11 +08:00
imClumsyPanda 4fb2e2198b merge dev_allinone 2023-08-17 22:29:26 +08:00
imClumsyPanda 52837429d2 update configs.__init__, webui.py and api.py 2023-08-17 22:19:37 +08:00
xain 6d1ea9bc99 Update utils.py (#1128)
不区分文件扩展名的大小写。
2023-08-17 21:09:05 +08:00
hzg0601 44d4bacf1c update llm_api_launch,api_allinone,webui_allinone,readme:1.llm_api_launch,api_allinone_webui_allinone更名;2. 更新readme关于startup的说明 2023-08-17 16:59:16 +08:00
liunux4odoo f92b002342 add startup.py: start specified servers with one command. see python startup.py --help 2023-08-17 13:24:53 +08:00
imClumsyPanda 8396b57101 update format of api_allinone.py and llm_api_launch.py 2023-08-16 22:24:29 +08:00
liunux4odoo 6c00c03faa llm_api can be terminated by Ctrl+c. success on windows 2023-08-16 17:48:55 +08:00
liunux4odoo e7d07a7923 Merge remote-tracking branch 'refs/remotes/origin/dev' into dev 2023-08-16 16:16:56 +08:00
liunux4odoo 8ed1f8efca update fastchat to 0.2.24 2023-08-16 16:15:45 +08:00
hzg0601 84b491b8b2 Merge branch 'dev' of github.com:chatchat-space/Langchain-Chatchat into dev 2023-08-16 16:00:40 +08:00
hzg0601 5f1471232d update llm_api_launch.py:修复本地加载问题 2023-08-16 16:00:24 +08:00
liunux4odoo f64affc930 update llm_api and api server:
1. fastchat's controller/model_worker/api_server use swagger UI offline.
2. add custom title and icon.
3. remove fastapi-offline dependence
2023-08-16 14:20:09 +08:00
liunux4odoo 67b8ebef52 update api and webui:
1. 增加search_docs接口,返回原始知识库检索文档,close #1103
2. 为FAISS检索增加score_threshold参数。milvus和PG暂不支持
2023-08-16 13:18:58 +08:00
hzg0601 b97358ea33 Merge branch 'dev' of github.com:chatchat-space/Langchain-Chatchat into dev 2023-08-16 11:15:31 +08:00
hzg0601 8e00f8305b 1. 更新allinone脚本提示,增加中文提示;2. 新增服务一键停止脚本shutdown_all.sh;3. 更新readme说明;3. 修复命令行bug 2023-08-16 11:15:10 +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
hzg0601 348edb9a0d 更新提示 2023-08-16 10:13:51 +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
hzg0601 80f44ba24e git pull dev 2023-08-15 11:22:19 +08:00
hzg0601 5c0274efce 1. 增加api的一键启动脚本;2. 增加webui的一键启动脚本;3. 更新readme;4. 调整llm_api_launch 2023-08-15 11:02:32 +08:00
liunux4odoo 8477adfa33 update api and webui:
1. add download_doc to api
2. return local path or http url in kowledge_base_chat depends on
   no_remote_api
3. change assistant avater in webui
2023-08-14 19:32:28 +08:00
liunux4odoo 087bb37e08 fix chat and knowledge_base_chat 2023-08-14 19:32:28 +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
hzg0601 8b18cf2a5e git rebase and pull 2023-08-14 16:48:35 +08:00
liunux4odoo 0704eabe23 fix chat and knowledge_base_chat 2023-08-14 16:46:26 +08:00
hzg0601 90c92f8c93 解决多卡启动问题 2023-08-14 16:43:01 +08:00
liunux4odoo cc08e2cb96 update api and webui:
1. add download_doc to api
2. return local path or http url in kowledge_base_chat depends on
   no_remote_api
3. change assistant avater in webui
2023-08-14 11:46:36 +08:00
hzg0601 0d6a9cf8f3 Merge branch 'master' into dev 2023-08-14 11:39:12 +08:00
hzg0601 6590ca32db 更新多卡部署 2023-08-14 11:24:52 +08:00
liunux4odoo 126bd51232 fix chat and knowledge_base_chat 2023-08-14 10:35:47 +08:00
imClumsyPanda afc6aa968d update webui layout 2023-08-11 23:40:41 +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
liunux4odoo a261fda20b add tools to migrate knowledge base 2023-08-11 08:33:05 +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
liunux4odoo 18e7e7307b patch fastapi-offline to use local swagger-ui assests 2023-08-10 17:00:39 +08:00
liunux4odoo 0364215987 Merge branch 'pr1037_pg_vs' into dev_fastchat 2023-08-10 15:07:58 +08:00
liunux4odoo 17ddee38a4 fix conflict between def_fastchat and pr1037 2023-08-10 15:02:41 +08:00
hzg0601 9525915a85 update llm_api_launch,llm_api_shutdown 2023-08-10 14:43:18 +08:00
liunux4odoo fd247f4657 Merge branch 'dev_fastchat' into pr1037_pg_vs 2023-08-10 14:21:37 +08:00
liunux4odoo 9ed91f0e8a automatically init vector store info to database when run api.py & webui.py 2023-08-10 14:12:02 +08:00
liunux4odoo f5024245a7 make api.py and webui.py working offline 2023-08-10 13:33:40 +08:00
zqt d4f728dfa2 添加向量数据库pg支持,和向量库docker-compose.ym环境文件 2023-08-10 11:16:52 +08:00
hzg0601 6c2b2b7ba2 测试llm_api_shutdown.py,通过 2023-08-10 09:38:45 +08:00
imClumsyPanda 8df00d0b04 add SCORE_THRESHOLD to faiss and milvus kb service 2023-08-10 00:36:59 +08:00
liunux4odoo 1a112c6908 update fastch_chat: disable streaming in swagger besides streaming in ApiRequest 2023-08-09 23:48:41 +08:00
imClumsyPanda 02b9d57072 update textsplitter and pdfloader 2023-08-09 23:36:43 +08:00
liunux4odoo 222689ed5b update kb and search chat: disable streaming in swagger besides streaming in ApiRequest 2023-08-09 23:35:36 +08:00
hzg0601 66ff913bb4 Merge branch 'dev_fastchat' of https://github.com/chatchat-space/langchain-ChatGLM into dev_fastchat 2023-08-09 23:18:54 +08:00
hzg0601 3e9d088cd9 update server 2023-08-09 23:18:44 +08:00
hzg0601 34bb681db1 删除shell脚本 2023-08-09 23:17:51 +08:00
hzg0601 8a34c3f163 增加停止服务的python脚本 2023-08-09 23:16:02 +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 db29a2fea7 update knowledge_base_chat and search_engine_chat: yield chinese correctly 2023-08-09 22:54:37 +08:00
liunux4odoo ba3335efb8 update llm_api: move fastchat logs to LOG_PATH 2023-08-09 22:43:45 +08:00
liunux4odoo 997f8b2e3f update knowledge base api:
1. list_kbs_from_db return all kbs by default instead of return kbs with
   file_count > 0 only.
2. KBServiceFactory.get_service_by_name could return a FaissKBService
   that not in the db
2023-08-09 21:57:40 +08:00
liunux4odoo 323fc13d4c make parameter examples available in openapi docs 2023-08-09 18:15:14 +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 4da7c04859 fix: parse history parameter to correct type 2023-08-09 12:09:45 +08:00
liunux4odoo 9883341924 update server.chat.*: set default value [] to history parameter. 2023-08-09 10:48:37 +08:00
liunux4odoo b98f5fd0b9 update knowledge base kbservice and api:
1. make huggingfaceembeddings hashable
2. unify embeddings' loading method for all kbservie
3. make ApiRequest skip empty content when streaming json to avoid dict
   KeyError
2023-08-09 10:46:01 +08:00
liunux4odoo 532ed81ecf add functions to get kb and doc details from db 2023-08-08 23:57:39 +08:00
imClumsyPanda 717ddf4d10 add history to chat apis 2023-08-08 23:56:27 +08:00
imClumsyPanda c17572b6a6 add history to chat apis 2023-08-08 23:55:27 +08:00
imClumsyPanda 2d49746a8d add history to chat apis 2023-08-08 23:54:51 +08:00
imClumsyPanda c8b6d53ede add llmchain_with_history.py as example 2023-08-08 22:15:16 +08:00
liunux4odoo 135af5f3ff update knowledge base db orm:
1. set default values for file_count, file_version, create_time.
2. fix bug: add_doc_to_db
3. make add_kb_to_db more flexiable with existing kb
2023-08-08 21:47:20 +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 444e1afad5 remove server/knowledge_base/knowledge_file.py 2023-08-08 16:51:37 +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 7e07f0bbf4 move configs to configs.model_config 2023-08-08 15:56:32 +08:00
zqt b61e0772c9 使用orm操作数据库 2023-08-08 14:25:55 +08:00
zqt 41fd1acc9c Merge remote-tracking branch 'origin/dev_fastchat' into dev_fastchat
# Conflicts:
#	server/knowledge_base/kb_service/default_kb_service.py
#	server/knowledge_base/kb_service/milvus_kb_service.py
#	server/knowledge_base/knowledge_base_factory.py
2023-08-08 14:06:13 +08:00
hzg0601 82494aec00 Merge branch 'dev_fastchat' of github.com:chatchat-space/langchain-ChatGLM into dev_fastchat 2023-08-08 13:39:31 +08:00
hzg0601 360bd0a559 update llm_api_sh.py 2023-08-08 13:39:19 +08:00
liunux4odoo 0746272525 remove server/knowledge_base/knowledge_base.py 2023-08-08 13:36:20 +08:00
glide-the de8db40f4b BaseChatOpenAIChain,支持基础的ChatOpenAI对话的Chain接入 2023-08-07 23:05:54 +08:00
glide-the 823eb06c5d BaseChatOpenAIChain,支持基础的ChatOpenAI对话的Chain接入 2023-08-07 22:57:13 +08:00
liunux4odoo 08493bffbb add a basic knowledge base management ui. 2023-08-07 21:00:55 +08:00
imClumsyPanda 035a199c32 update kb_server.base 2023-08-07 20:48:06 +08:00
liunux4odoo 44c713ef98 use KBServiceFactory to replace all the KnowledgeBase.
make KBServiceFactory support embed_model parameter.
rewrite api: recreate_vector_store.
fix some bugs.
2023-08-07 20:37:16 +08:00
zqt996 0f46185cfb
添加Milvus库 (#1011) 2023-08-07 16:56:57 +08:00
zqt 72951d95fb 添加milvus库支持 2023-08-07 16:32:34 +08:00
imClumsyPanda 18d31f5116 add KBService and KBServiceFactory class 2023-08-06 23:44:02 +08:00
glide-the 06af3f4c5e BaseChatOpenAIChain,支持基础的ChatOpenAI对话的Chain接入 2023-08-06 22:57:57 +08:00
imClumsyPanda b91d96ab0c update kb_doc_api.py 2023-08-06 18:32:10 +08:00
imClumsyPanda a447529c2e update kb_doc_api.py 2023-08-05 23:35:20 +08:00
imClumsyPanda 8773149a3e update api.py 2023-08-05 23:12:17 +08:00
imClumsyPanda 7f89efee4b fix kb_doc_api.py 2023-08-05 23:01:56 +08:00
imClumsyPanda 3f045cedb9 1. add add_doc and list_docs to KnowledgeBase class
2. add DB_ROOT_PATH to model_config.py.example
2023-08-05 22:57:19 +08:00
imClumsyPanda 313e590961 update DocumentLoader in knowledge_file.py 2023-08-05 21:51:07 +08:00
imClumsyPanda f68e432570 update table_name and column_name in SQL 2023-08-05 21:02:14 +08:00
imClumsyPanda cd0f2a2c41 update class method of KnowledgeBase and KnowledgeFile 2023-08-05 20:52:14 +08:00
imClumsyPanda 14a5de6a29 update class method of KnowledgeBase and KnowledgeFile 2023-08-05 13:51:05 +08:00
imClumsyPanda 7beeaacea6 update class method of KnowledgeBase and KnowledgeFile 2023-08-05 13:48:55 +08:00
imClumsyPanda e8a88f174d update class method of KnowledgeBase and KnowledgeFile 2023-08-05 13:48:30 +08:00
imClumsyPanda 206261cd0c update class method of KnowledgeBase and KnowledgeFile 2023-08-05 13:46:00 +08:00
imClumsyPanda 6c7adfbaeb change kb_api functions with KnowledgeBase class method 2023-08-05 03:15:41 +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 bc3ee83910 update kb_doc_api.py 2023-08-04 22:22:48 +08:00
liunux4odoo 5d1a0ec15d add recreate_vector_store to kb_doc_api, and the router in api.py. 2023-08-04 20:26:14 +08:00
liunux4odoo 46c7d8d169 allow kb_doc_api.upload_doc to override existed file by parameter.
update_doc is not needed.
2023-08-04 15:53:44 +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 329c24ee73 1. change bing_search_chat and duckduckgo_search_chat into search_engine_chat
2. add knowledge_base not found to knowledge_base_chat and add search_engine not found to search_engine_chat
2023-08-03 18:22:36 +08:00
imClumsyPanda b62ea6bd2a add top-k to search_chat apis and add top-k params in model_config 2023-08-03 17:06:43 +08:00
liunux4odoo 5c804aac75 make api and webui support top_k paramter 2023-08-03 15:47:53 +08:00
liunux4odoo df61f31c8e 修改knowledge_base_chat实现:利用缓存避免每次请求重新加载向量库;增加top_k参数。 2023-08-03 15:22:46 +08:00
hzg0601 fdbff8a91f Merge branch 'dev_fastchat' of github.com:chatchat-space/langchain-ChatGLM into dev_fastchat 2023-08-03 14:39:14 +08:00
hzg0601 6f93a27e53 更新llm_api_sh.py调用说明 2023-08-03 14:39:00 +08:00
liunux4odoo f7d465b7d4 bug fix 2023-08-03 12:11:18 +08:00
hzg0601 d0fd6253a3 update llm_api_sh 2023-08-02 09:19:58 +08:00
hzg0601 1d1a8e9339 Merge branch 'dev_fastchat' of github.com:chatchat-space/langchain-ChatGLM into dev_fastchat 2023-08-01 22:07:12 +08:00
hzg0601 ab7a76f380 update llm_api_sh.py and model_config.example 2023-08-01 22:07:05 +08:00
imClumsyPanda e4fed93989 update format in api.py 2023-08-01 21:53:19 +08:00
hzg0601 18a94fcf45 Merge branch 'dev_fastchat' of github.com:chatchat-space/langchain-ChatGLM into dev_fastchat 2023-08-01 18:02:52 +08:00
hzg0601 15e67a4d3e 1.*在config里将所有fastchat的命令行参数加入;2.*加入启动和停止fastchat的shell脚本;3. **增加了通过命令行启动所有fastchat服务的python脚本llm_api_sh.py;4. 修改了默认的config日志格式 2023-08-01 17:59:20 +08:00
imClumsyPanda 7c01a2a253 add bing_search_chat.py and duckduckgo_search_chat.py 2023-08-01 16:39:17 +08:00
imClumsyPanda c8a75ab11f update llm_api.py and webui.py 2023-08-01 14:33:18 +08:00
liunux4odoo 9e2b411b01 cuda error with multiprocessing, change model_worker to main process 2023-07-31 11:18:57 +08:00
hzg0601 47dfb6cd8b udpate llm_api 2023-07-31 11:00:33 +08:00
liunux4odoo 946f10e1f2 split api_start to create_app & run_api. user can run api with uvicorn in console: uvicorn server.api:app --port 7861 2023-07-31 10:05:19 +08:00
liunux4odoo 463659f0ba llm_api升级到fschat==0.2.20,支持百川模型 2023-07-30 23:16:47 +08:00