Deploying from Source Code
Running Environment Installation
Using conda
Create Environment
conda create -n chatchat python=3.9
Pull Source Code
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
Enter Main Directory
cd Langchain-Chatchat/libs/chatchat-server/
Configure Environment Variables
export CHATCHAT_ROOT=/parth/to/chatchat_data
Initialize Configuration
python chatchat/cli.py init
After running, a configuration file will be generated in the directory specified by the environment variable
basic_settings.yaml # Basic configuration information, including data directory, server configuration, etc.
kb_settings.yaml # Configuration items related to the knowledge base
model_settings.yaml # Configuration items related to the model
prompt_settings.yaml # Prompt templates
tool_settings.yaml # Configuration items related to tools
To allow access from other devices in the internal network, modify the following configuration in basic_settings.yaml
# basic_settings.yaml
# WEBUI server address
WEBUI_SERVER:
host: 0.0.0.0
port: 8501
You can customize the model loading platform, default is xinference
'xinference', 'ollama', 'oneapi', 'fastchat', 'openai', 'custom openai'
Configure in model_settings.yaml
- platform_name: xinference
platform_type: xinference
api_base_url: http://127.0.0.1:9997/v1 # Change to your custom configuration
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: []
Start Service
python chatchat/cli.py start -a
Error after starting 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 failed to return valid JSON. 'NoneType' object has no attribute 'json'
2024-12-20 16:40:15.233 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: API failed to return valid 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 failed to return valid 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 failed to return valid JSON. 'NoneType' object has no attribute 'json'
Issue with high version of httpx
Downgrade httpx
version
pip install httpx==0.27.2
Successfully started, access the service at http://127.0.0.1:8501
References#
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