使用ソースコードをデプロイ
実行環境のインストール
conda
を使用
環境を作成
conda create -n chatchat python=3.9
ソースコードを取得
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
メインディレクトリに移動
cd Langchain-Chatchat/libs/chatchat-server/
環境変数を設定
export CHATCHAT_ROOT=/parth/to/chatchat_data
初期設定
python chatchat/cli.py init
実行後、設定した環境変数のディレクトリに設定ファイルが生成されます
basic_settings.yaml # 基本設定情報、データディレクトリ、サーバー設定などを含む
kb_settings.yaml # 知識ベース関連の設定項目
model_settings.yaml # モデル関連の設定項目
prompt_settings.yaml # プロンプトテンプレート
tool_settings.yaml # ツール関連の設定項目
内網の他のデバイスがアクセスする必要がある場合は、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'オブジェクトには'json'属性がありません
2024-12-20 16:40:15.233 | ERROR | chatchat.webui_pages.utils:to_json:233 - AttributeError: APIが正しいJSONを返せませんでした。'NoneType'オブジェクトには'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'オブジェクトには'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'オブジェクトには'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