赞
踩
https://github.com/chatchat-space/Langchain-Chatchat
整体安装比较方便,在阿里云购买云主机,购买的国外站点机器,
该项目运行最佳坏境为
- git clone https://github.com/chatchat-space/Langchain-Chatchat.git
- cd Langchain-Chatchat/
- pip install -r requirements_lite.txt
- mv basic_config.py.example basic_config.py
- mv kb_config.py.example kb_config.py
- mv model_config.py.example model_config.py
- mv prompt_config.py.example prompt_config.py
- mv server_config.py.example server_config.py
修改model的大模型配置
"openai-api": {
"model_name": "gpt-3.5-turbo",
"api_base_url": "https://api.chatanywhere.tech/v1",
"api_key": "sk-45aHXQhjXoZJzXCZyuY2OjmAIhDHN9BnoN26nFTFdFgl7y1R",
"openai_proxy": "https://api.chatanywhere.tech/v1",
},
免费chatgpts国内代理,只能使用3.5
启动服务
python startup.py -a --lite
启动报错,缺少依赖包,需要安装依赖包,重新启动即可
pip install streamlit sentence_transformers markdownify strsimpy cachetools websockets
启动成功
==============================Langchain-Chatchat Configuration==============================
操作系统:Linux-5.15.0-92-generic-x86_64-with-glibc2.35.
python版本:3.11.7 (main, Feb 27 2024, 00:07:27) [GCC 11.4.0]
项目版本:v0.2.10
langchain版本:0.0.354. fastchat版本:0.2.36
当前使用的分词器:ChineseRecursiveTextSplitter
当前启动的LLM模型:['chatglm3-6b', 'zhipu-api', 'openai-api'] @ cpu
{'device': 'cuda',
'host': '0.0.0.0',
'infer_turbo': False,
'model_path': 'THUDM/chatglm3-6b',
'port': 20002}
{'api_key': '',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'online_api': True,
'port': 21001,
'provider': 'ChatGLMWorker',
'version': 'glm-4',
'worker_class': <class 'server.model_workers.zhipu.ChatGLMWorker'>}
{'api_base_url': 'https://api.chatanywhere.tech/v1/chat/completions',
'api_key': 'sk-45aHXQhjXoZJzXCZyuY2OjmAIhDHN9BnoN26nFTFdFgl7y1R',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'model_name': 'gpt-3.5-turbo',
'online_api': True,
'openai_proxy': 'https://api.chatanywhere.tech/v1/chat/completions',
'port': 20002}
当前Embbedings模型: bge-large-zh-v1.5 @ cpu
==============================Langchain-Chatchat Configuration==============================
2024-02-27 10:38:49,365 - startup.py[line:655] - INFO: 正在启动服务:
2024-02-27 10:38:49,365 - startup.py[line:656] - INFO: 如需查看 llm_api 日志,请前往 /opt/Langchain-Chatchat/logs
/usr/local/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: 模型启动功能将于 Langchain-Chatchat 0.3.x重写,支持更多模式和加速启动,0.2.x中相关功能将废弃
warn_deprecated(
2024-02-27 10:38:54 | INFO | model_worker | Register to controller
2024-02-27 10:38:54 | ERROR | stderr | INFO: Started server process [24223]
2024-02-27 10:38:54 | ERROR | stderr | INFO: Waiting for application startup.
2024-02-27 10:38:54 | ERROR | stderr | INFO: Application startup complete.
2024-02-27 10:38:54 | ERROR | stderr | INFO: Uvicorn running on http://0.0.0.0:20000 (Press CTRL+C to quit)
INFO: Started server process [24241]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:7861 (Press CTRL+C to quit)
==============================Langchain-Chatchat Configuration==============================
操作系统:Linux-5.15.0-92-generic-x86_64-with-glibc2.35.
python版本:3.11.7 (main, Feb 27 2024, 00:07:27) [GCC 11.4.0]
项目版本:v0.2.10
langchain版本:0.0.354. fastchat版本:0.2.36
当前使用的分词器:ChineseRecursiveTextSplitter
当前启动的LLM模型:['chatglm3-6b', 'zhipu-api', 'openai-api'] @ cpu
{'device': 'cuda',
'host': '0.0.0.0',
'infer_turbo': False,
'model_path': 'THUDM/chatglm3-6b',
'port': 20002}
{'api_key': '',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'online_api': True,
'port': 21001,
'provider': 'ChatGLMWorker',
'version': 'glm-4',
'worker_class': <class 'server.model_workers.zhipu.ChatGLMWorker'>}
{'api_base_url': 'https://api.chatanywhere.tech/v1/chat/completions',
'api_key': 'sk-45aHXQhjXoZJzXCZyuY2OjmAIhDHN9BnoN26nFTFdFgl7y1R',
'device': 'auto',
'host': '0.0.0.0',
'infer_turbo': False,
'model_name': 'gpt-3.5-turbo',
'online_api': True,
'openai_proxy': 'https://api.chatanywhere.tech/v1/chat/completions',
'port': 20002}
当前Embbedings模型: bge-large-zh-v1.5 @ cpu
服务端运行信息:
OpenAI API Server: http://127.0.0.1:20000/v1
Chatchat API Server: http://127.0.0.1:7861
Chatchat WEBUI Server: http://0.0.0.0:8501
==============================Langchain-Chatchat Configuration==============================
Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.
You can now view your Streamlit app in your browser.
URL: http://0.0.0.0:8501
访问地址http://eip:8501,成功打开webUI界面
打开如果有报错,一般是缺少依赖,解决依赖问题
pip install streamlit-aggrid streamlit_modal streamlit_chatbox streamlit_option_menu
选择LLM对话,选择openai-api , 成功完成对话
2024-02-27 10:38:39 | ERROR | stderr | ERROR: [Errno 98] error while attempting to bind on address ('0.0.0.0', 20000): address already in use
端口占用,先shutdown之间的进程
- chmod +x shutdown_all.sh
- ./shutdown_all.sh
访问webUI缺少依赖包,继续下载
pip install streamlit-aggrid streamlit_modal streamlit_chatbox streamlit_option_menu
参考资料
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。