方式一:通过命令方式搭建
搭建该项目分为两部分:安装 xinference 框架以载入 LLM 和嵌入模型,以及配置 Langchain-Chatchat 项目。
Langchain-Chatchat 项目支持两种搭建方式:命令行与网页端。核心流程包括创建 Conda 环境、安装 Xinference 框架、加载 LLM 及 Embedding 模型、配置 Chatchat 参数及启动服务。命令行方式需手动执行 pip 安装与模型加载命令,网页方式则通过 Xinference UI 操作模型注册。配置阶段需注意 model_settings.yaml 中的模型名称匹配及知识库路径设置。若遇到对话功能异常,建议检查 xinference 版本兼容性并进行降级处理。

搭建该项目分为两部分:安装 xinference 框架以载入 LLM 和嵌入模型,以及配置 Langchain-Chatchat 项目。
conda create -n xinference python=3.10
进入该环境:
conda activate xinference
pip install "xinference[transformers]" -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
拉起 xinference 服务:
XINFERENCE_HOME=自定义路径 xinference-local --host 0.0.0.0 --port 9997
详细信息请查看 xinference 官网。注意不同模型要求的引擎可能不同(如 Transformers),请根据模型查询官方文档。
确保模型文件完整后再加载。使用本地下载模型或参考官网自动下载。
xinference launch --model-engine Transformers --model-name qwen-chat --size-in-billions 7 --model-format pytorch --quantization none --model_path ~/.cache/modelscope/hub/Qwen/Qwen-7B-Chat
参数说明:
--model-name:固定为模型注册名,不可随意更改。--model_path:本地模型存储路径,若使用 modelscope 下载通常在 ~/.cache/modelscope/hub 下。--model-engine:在 xinference 管理页面查看对应引擎类型。例如使用 bge-large-zh-v1.5:
xinference launch --model-name bge-large-zh-v1.5 --model-type embedding --model_path ~/.cache/modelscope/hub/Xorbits/bge-large-zh-v1.5
conda create -n chatchat python=3.10
conda activate chatchat
pip install "langchain-chatchat[xinference]" -U -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
设置 Chatchat 存储配置文件和数据文件的根目录(可选):
# Linux or macOS
export CHATCHAT_ROOT=/path/to/chatchat_data
# Windows
set CHATCHAT_ROOT=/path/to/chatchat_data
若不设置环境变量,则自动使用当前目录。
chatchat init
该命令会创建数据目录、复制知识库内容并生成默认 yaml 配置文件。
配置模型(model_settings.yaml) 根据步骤中使用的模型推理框架与加载模型进行配置,主要修改以下内容:
DEFAULT_LLM_MODEL: qwen1.5-chat
DEFAULT_EMBEDDING_MODEL: bge-large-zh-v1.5
在 MODEL_PLATFORMS 中修改对应模型平台信息。
配置知识库路径(basic_settings.yaml)
默认知识库位于 CHATCHAT_ROOT/data/knowledge_base。如需修改存储位置或数据库连接 URI,可在此调整。
配置知识库(kb_settings.yaml)
默认使用 FAISS 知识库,如需切换其他类型可修改 DEFAULT_VS_TYPE 和 kbs_config。
chatchat kb -r
chatchat start -a
启动成功后应显示 Web 界面。
注意事项: 若部署后无法对话,可能是 xinference 版本兼容性问题,建议降低 xinference 版本至稳定版(如 0.15.3)。
pip install xinference==0.15.3 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
使用网页搭建与命令方式类似,区别在于通过 Xinference 网页界面装载模型。
XINFERENCE_HOME=自定义路径 xinference-local --host 0.0.0.0 --port 9997
http://127.0.0.1:9997/ui。
微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
使用加密算法(如AES、TripleDES、Rabbit或RC4)加密和解密文本明文。 在线工具,加密/解密文本在线工具,online
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
解析常见 curl 参数并生成 fetch、axios、PHP curl 或 Python requests 示例代码。 在线工具,curl 转代码在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online