使用源碼部署
運行環(huán)境安裝
使用conda
創(chuàng)建環(huán)境
conda create -n chatchat python=3.9
拉取源碼
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
進入主目錄
cd Langchain-Chatchat/libs/chatchat-server/
配置環(huán)境變量
export CHATCHAT_ROOT=/parth/to/chatchat_data
初始化配置
python chatchat/cli.py init
運行后會在配置的環(huán)境變量目錄中生成配置文件
basic_settings.yaml # 基本配置信息锌俱,包括數(shù)據(jù)目錄、服務器配置等
kb_settings.yaml # 知識庫相關配置項
model_settings.yaml # 模型相關配置項
prompt_settings.yaml # prompt 模板
tool_settings.yaml # 工具相關配置項
需要內(nèi)網(wǎng)中其他設備訪問需要修改·basic_settings.yaml
以下配置
# basic_settings.yaml
# WEBUI 服務器地址
WEBUI_SERVER:
host: 0.0.0.0
port: 8501
可自定義模型加載平臺烈和,默認使用xinference
'xinference', 'ollama', 'oneapi', 'fastchat', 'openai', 'custom openai'
在model_settings.yaml
配置
- platform_name: xinference
platform_type: xinference
api_base_url: http://127.0.0.1:9997/v1 # 修改為自定義的配置
api_key: EMPTY
api_proxy: ''
api_concurrencies: 5
auto_detect_model: true
llm_models: []
embed_models: []
text2image_models: []
image2text_models: []
rerank_models: []
speech2text_models: []
text2speech_models: []
啟動服務
python chatchat/cli.py start -a
langchain-chatchat
啟動后報錯
2024-12-20 16:40:15.222 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.221 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.227 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.231 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.232 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.232 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:15.233 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正確的JSON。'NoneType' object has no attribute 'json'
2024-12-20 16:40:15.233 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正確的JSON呵曹。'NoneType' object has no attribute 'json'
2024-12-20 16:40:16.266 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:16.270 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:16.271 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:16.275 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正確的JSON民镜。'NoneType' object has no attribute 'json'
2024-12-20 16:40:18.400 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:18.406 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:18.406 | ERROR | chatchat.webui_pages.utils:get:64 - TypeError: error when get /tools: __init__() got an unexpected keyword argument 'proxies'
2024-12-20 16:40:18.407 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API未能返回正確的JSON。'NoneType' object has no attribute 'json'
httpx
版本問題過高的問題
將httpx
版本降級
pip install httpx==0.27.2
啟動成功訪問磕潮,訪問服務http://127.0.0.1:8501
參考
https://github.com/chatchat-space/Langchain-Chatchat/blob/master/docs/contributing/README_dev.md
https://github.com/chatchat-space/Langchain-Chatchat/issues/5115
https://github.com/chatchat-space/Langchain-Chatchat/blob/master/docs/contributing/settings.md