mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-01-19 13:23:16 +08:00
编写配置说明
This commit is contained in:
parent
94abc0f87b
commit
ec48f136ba
@ -1,27 +1,51 @@
|
||||
### 开始使用
|
||||
|
||||
> 环境配置完成后,启动步骤为先启动chatchat-server,然后启动chatchat-frontend。
|
||||
> chatchat可通过pypi安装一键启动,您也可以选择使用源码启动。(Tips:源码配置可以帮助我们更快的寻找bug,或者改进基础设施。我们不建议新手使用这个方式)
|
||||
> chatchat可通过pypi安装一键启动,您也可以选择使用[源码启动](README_dev.md)。(Tips:源码配置可以帮助我们更快的寻找bug,或者改进基础设施。我们不建议新手使用这个方式)
|
||||
|
||||
#### pypi安装一键启动
|
||||
- 安装chatchat
|
||||
```shell
|
||||
pip install langchain-chatchat -U
|
||||
```
|
||||
- 复制配置文件
|
||||
> 后面我们会提供一个一键初始化的脚本,现在您可以手动复制配置文件
|
||||
> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
|
||||
|
||||
> 工作空间配置
|
||||
>
|
||||
> 操作指令` chatchat-config`
|
||||
```text
|
||||
options:
|
||||
|
||||
-h, --help show this help message and exit
|
||||
-v {true,false}, --verbose {true,false}
|
||||
是否开启详细日志
|
||||
-d DATA, --data DATA 数据存放路径
|
||||
-f FORMAT, --format FORMAT
|
||||
日志格式
|
||||
--clear 清除配置
|
||||
```
|
||||
> 查看配置
|
||||
```shell
|
||||
cd chatchat-server/chatchat
|
||||
mkdir -p ~/.config/chatchat/
|
||||
cp -r configs ~/.config/chatchat/
|
||||
cp -r data ~/.config/chatchat/
|
||||
cp -r img ~/.config/chatchat/
|
||||
chatchat-config --show ±[●●][dev_config_init]
|
||||
{
|
||||
"log_verbose": false,
|
||||
"CHATCHAT_ROOT": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat",
|
||||
"DATA_PATH": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/data",
|
||||
"IMG_DIR": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/img",
|
||||
"NLTK_DATA_PATH": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/data/nltk_data",
|
||||
"LOG_FORMAT": "%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s",
|
||||
"LOG_PATH": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/data/logs",
|
||||
"MEDIA_PATH": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/data/media",
|
||||
"BASE_TEMP_DIR": "/media/gpt4-pdf-chatbot-langchain/langchain-ChatGLM/libs/chatchat-server/chatchat/data/temp",
|
||||
"class_name": "ConfigBasic"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
> 当配置文件复制完成后,配置拷贝后路径的`model_providers.yaml`文件,即可完成自定义平台加载
|
||||
|
||||
- 自定义平台加载
|
||||
> 配置*CHATCHAT_ROOT*文件夹configs中的`model_providers.yaml`文件,即可完成自定义平台加载
|
||||
```shell
|
||||
cd ~/.config/chatchat/configs
|
||||
|
||||
vim model_providers.yaml
|
||||
```
|
||||
>
|
||||
@ -38,35 +62,3 @@ chatchat-kb -r
|
||||
```shell
|
||||
chatchat -a
|
||||
```
|
||||
|
||||
#### 源码启动chatchat-server
|
||||
- 安装chatchat
|
||||
```shell
|
||||
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
|
||||
```
|
||||
- 修改`model_providers.yaml`文件,即可完成自定义平台加载
|
||||
```shell
|
||||
cd Langchain-Chatchat/libs/chatchat-server/chatchat/configs
|
||||
vim model_providers.yaml
|
||||
```
|
||||
- 平台配置
|
||||
> 注意: 在您配置平台之前,请确认平台依赖完整,例如智谱平台,您需要安装智谱sdk `pip install zhipuai`
|
||||
>
|
||||
> 详细配置请参考[README.md](../model-providers/README.md)
|
||||
|
||||
|
||||
- 初始化开发环境
|
||||
|
||||
> [Code](../../docs/contributing/code.md): 源码配置可以帮助我们更快的寻找bug,或者改进基础设施。
|
||||
|
||||
- 初始化仓库
|
||||
> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
|
||||
```shell
|
||||
cd Langchain-Chatchat/libs/chatchat-server/chatchat
|
||||
python init_database.py --recreate-vs
|
||||
```
|
||||
- 启动服务
|
||||
```shell
|
||||
cd Langchain-Chatchat/libs/chatchat-server/chatchat
|
||||
python startup.py -a
|
||||
```
|
||||
50
libs/chatchat-server/README_dev.md
Normal file
50
libs/chatchat-server/README_dev.md
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
#### 源码启动chatchat-server
|
||||
- 安装chatchat
|
||||
```shell
|
||||
git clone https://github.com/chatchat-space/Langchain-Chatchat.git
|
||||
```
|
||||
|
||||
- 关于chatchat-config
|
||||
> chatchat-config由ConfigWorkSpace接口提供知识库配置载入存储
|
||||
>
|
||||
> 具体实现可以参考basic_config.py
|
||||
>
|
||||
|
||||
- ConfigWorkSpace接口说明
|
||||
```text
|
||||
|
||||
ConfigWorkSpace是一个配置工作空间的抽象类,提供基础的配置信息存储和读取功能。
|
||||
提供ConfigFactory建造方法产生实例。
|
||||
该类的实例对象用于存储工作空间的配置信息,如工作空间的路径等
|
||||
工作空间的配置信息存储在用户的家目录下的.chatchat/workspace/workspace_config.json文件中。
|
||||
注意:不存在则读取默认
|
||||
```
|
||||
|
||||
- 关于`model_providers.yaml`文件,是平台配置文件
|
||||
|
||||
> 我们抽象了不同平台提供的 全局配置`provider_credential`,和模型配置`model_credential`
|
||||
|
||||
>关于设计文稿,请查看 [README_CN.md](model_providers/core/model_runtime/README_CN.md)
|
||||
|
||||
- 平台配置
|
||||
> 注意: 在您配置平台之前,请确认平台依赖完整,例如智谱平台,您需要安装智谱sdk `pip install zhipuai`
|
||||
>
|
||||
> 详细配置请参考[README.md](../model-providers/README.md)
|
||||
|
||||
|
||||
- 初始化开发环境
|
||||
|
||||
> [Code](../../docs/contributing/code.md): 源码配置可以帮助我们更快的寻找bug,或者改进基础设施。
|
||||
|
||||
- 初始化仓库
|
||||
> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
|
||||
```shell
|
||||
cd Langchain-Chatchat/libs/chatchat-server/chatchat
|
||||
python init_database.py --recreate-vs
|
||||
```
|
||||
- 启动服务
|
||||
```shell
|
||||
cd Langchain-Chatchat/libs/chatchat-server/chatchat
|
||||
python startup.py -a
|
||||
```
|
||||
@ -1,4 +1,4 @@
|
||||
from chatchat.configs import config_workspace as workspace
|
||||
from chatchat.configs import config_basic_workspace as workspace
|
||||
|
||||
|
||||
def main():
|
||||
@ -27,6 +27,11 @@ def main():
|
||||
action="store_true",
|
||||
help="清除配置"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--show",
|
||||
action="store_true",
|
||||
help="显示配置"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.verbose:
|
||||
@ -40,7 +45,8 @@ def main():
|
||||
workspace.set_log_format(args.format)
|
||||
if args.clear:
|
||||
workspace.clear()
|
||||
print(workspace.get_config())
|
||||
if args.show:
|
||||
print(workspace.get_config())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -39,7 +39,7 @@ class ConfigBasic(core_config.Config):
|
||||
return cls.__name__
|
||||
|
||||
def __str__(self):
|
||||
return f"ConfigBasic(log_verbose={self.log_verbose}, CHATCHAT_ROOT={self.CHATCHAT_ROOT}, DATA_PATH={self.DATA_PATH}, IMG_DIR={self.IMG_DIR}, NLTK_DATA_PATH={self.NLTK_DATA_PATH}, LOG_FORMAT={self.LOG_FORMAT}, LOG_PATH={self.LOG_PATH}, MEDIA_PATH={self.MEDIA_PATH}, BASE_TEMP_DIR={self.BASE_TEMP_DIR})"
|
||||
return self.to_json()
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@ -25,7 +25,7 @@ class Config(BaseModel):
|
||||
|
||||
def to_json(self, **kwargs: Any) -> str:
|
||||
data = self.to_dict(**kwargs)
|
||||
return json.dumps(data)
|
||||
return json.dumps(data, indent=4, ensure_ascii=False)
|
||||
|
||||
|
||||
F = TypeVar("F", bound=Config)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user