首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >langchain-chatchat安装

langchain-chatchat安装

原创
作者头像
六花踏雪
发布2025-01-14 18:53:43
发布2025-01-14 18:53:43
2330
举报

使用源码部署

运行环境安装

使用conda

创建环境

代码语言:powershell
复制
conda create -n chatchat python=3.9 

拉取源码

代码语言:powershell
复制
git clone https://github.com/chatchat-space/Langchain-Chatchat.git

进入主目录

代码语言:powershell
复制
cd  Langchain-Chatchat/libs/chatchat-server/

配置环境变量

代码语言:powershell
复制
export CHATCHAT_ROOT=/parth/to/chatchat_data

初始化配置

代码语言:powershell
复制
python chatchat/cli.py init

运行后会在配置的环境变量目录中生成配置文件

代码语言:txt
复制
basic_settings.yaml # 基本配置信息,包括数据目录、服务器配置等
kb_settings.yaml # 知识库相关配置项
model_settings.yaml # 模型相关配置项
prompt_settings.yaml # prompt 模板
tool_settings.yaml # 工具相关配置项

需要内网中其他设备访问需要修改·basic_settings.yaml 以下配置

代码语言:yaml
复制
# basic_settings.yaml 
# WEBUI 服务器地址
WEBUI_SERVER:
  host: 0.0.0.0
  port: 8501

可自定义模型加载平台,默认使用xinference

代码语言:txt
复制
'xinference', 'ollama', 'oneapi', 'fastchat', 'openai', 'custom openai'

model_settings.yaml 配置

代码语言: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: []

启动服务

代码语言:powershell
复制
python chatchat/cli.py start -a

langchain-chatchat启动后报错

代码语言:txt
复制
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版本降级

代码语言:powershell
复制
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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档