mirror of
https://github.com/RYDE-WORK/Langchain-Chatchat.git
synced 2026-02-08 16:10:18 +08:00
docs/contributing 增加贡献说明。
This commit is contained in:
parent
4acab04fab
commit
5062347f87
@ -1,49 +1,4 @@
|
|||||||
|
|
||||||
### 加入开发
|
|
||||||
#### 依赖管理:Poetry与env/dependency管理方法
|
|
||||||
这个项目使用 Poetry 来管理依赖。
|
|
||||||
> 注意:在安装Poetry之前,如果您使用Conda,请创建并激活一个新的Conda env(例如,`conda create-n chatchat python=3.9`)
|
|
||||||
|
|
||||||
Install Poetry: [documentation on how to install it.](https://python-poetry.org/docs/#installing-with-pipx)
|
|
||||||
|
|
||||||
> 注意: 如果您使用 Conda 或 Pyenv 作为您的环境/包管理器,在安装Poetry之后,
|
|
||||||
> 使用如下命令使Poetry使用virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
|
|
||||||
|
|
||||||
#### 本地开发环境安装
|
|
||||||
|
|
||||||
- 选择主项目目录
|
|
||||||
```shell
|
|
||||||
cd chatchat
|
|
||||||
```
|
|
||||||
|
|
||||||
- 安装chatchat依赖(for running chatchat lint\tests):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
poetry install --with lint,test
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 格式化和代码检查
|
|
||||||
在提交PR之前,请在本地运行以下命令;CI系统也会进行检查。
|
|
||||||
|
|
||||||
##### 代码格式化
|
|
||||||
本项目使用ruff进行代码格式化。
|
|
||||||
|
|
||||||
要对某个库进行格式化,请在相应的库目录下运行相同的命令:
|
|
||||||
```shell
|
|
||||||
cd {model-providers|chatchat|chatchat-server|chatchat-frontend}
|
|
||||||
make format
|
|
||||||
```
|
|
||||||
|
|
||||||
此外,你可以使用format_diff命令仅对当前分支中与主分支相比已修改的文件进行格式化:
|
|
||||||
|
|
||||||
|
|
||||||
```shell
|
|
||||||
|
|
||||||
make format_diff
|
|
||||||
```
|
|
||||||
当你对项目的一部分进行了更改,并希望确保更改的部分格式正确,而不影响代码库的其他部分时,这个命令特别有用。
|
|
||||||
|
|
||||||
|
|
||||||
### 开始使用
|
### 开始使用
|
||||||
|
|
||||||
> 环境配置完成后,启动步骤为先启动chatchat-server,然后启动chatchat-frontend。
|
> 环境配置完成后,启动步骤为先启动chatchat-server,然后启动chatchat-frontend。
|
||||||
@ -55,7 +10,8 @@ make format_diff
|
|||||||
pip install langchain-chatchat -U
|
pip install langchain-chatchat -U
|
||||||
```
|
```
|
||||||
- 复制配置文件
|
- 复制配置文件
|
||||||
|
> 后面我们会提供一个一键初始化的脚本,现在您可以手动复制配置文件
|
||||||
|
> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
|
||||||
```shell
|
```shell
|
||||||
cd chatchat-server/
|
cd chatchat-server/
|
||||||
mkdir ~/.config/chatchat/
|
mkdir ~/.config/chatchat/
|
||||||
@ -79,12 +35,9 @@ chatchat -a
|
|||||||
|
|
||||||
|
|
||||||
#### 源码启动chatchat-server
|
#### 源码启动chatchat-server
|
||||||
- 初始化依赖
|
|
||||||
```shell
|
|
||||||
cd chatchat-server/chatchat
|
|
||||||
python copy_config_example.py
|
|
||||||
```
|
|
||||||
- 初始化仓库
|
- 初始化仓库
|
||||||
|
> 请注意:这个命令会清空数据库,如果您有重要数据,请备份
|
||||||
```shell
|
```shell
|
||||||
cd chatchat-server/chatchat
|
cd chatchat-server/chatchat
|
||||||
python init_database.py
|
python init_database.py
|
||||||
|
|||||||
30
docs/contributing/README.md
Normal file
30
docs/contributing/README.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
### 贡献指南
|
||||||
|
各位开发者,chatchat由个人组织经过了不断地迭代和完善,作为一个不断进化的项目,
|
||||||
|
我们欢迎您的参与,无论是提交bug报告、功能请求、代码贡献、文档编写、测试、或者其他形式的贡献。
|
||||||
|
|
||||||
|
#### 贡献方式
|
||||||
|
这里列出了一些您可以为chatchat做出贡献的方式:
|
||||||
|
- Code: 帮助我们编写代码,修复bug,或者改进基础设施。
|
||||||
|
- Documentation: 帮助我们编写文档,使chatchat更容易使用。
|
||||||
|
- Discussions: 帮助回答用户的使用问题,讨论问题。
|
||||||
|
当您的贡献被接受后,我们会将您的名字添加到贡献者列表中。
|
||||||
|
在功能贡献达到2次以上,我们会考虑将您加入到chatchat的开发团队中。
|
||||||
|
|
||||||
|
#### Github Issue
|
||||||
|
我们需要跟踪功能请求与bug报告
|
||||||
|
|
||||||
|
目前我们有使用Issue默认模板来让用户更好的描述问题,但是目前这个大部分issue的用户可能依然选择只回复一句话,
|
||||||
|
|
||||||
|
对于这样的情况我们需要告知用户如何更好的描述问题。在15天内没有回复的issue我们会关闭issue。
|
||||||
|
|
||||||
|
关于功能请求,备受关注的RAG话题我们会考虑加入到我们的开发计划中。
|
||||||
|
|
||||||
|
我们努力保持issue的更新,但是我们也需要您的帮助,如果您发现有问题没有得到及时回复,请在issue下@我们。
|
||||||
|
|
||||||
|
#### 寻求帮助
|
||||||
|
我们尽量使开发者更容易上手,当您遇到问题时,请联系维护人员,我们会尽力帮助您。
|
||||||
|
|
||||||
|
类似的 diff、formatting、linting、testing等问题,如果您不确定如何解决,请随时联系我们,
|
||||||
|
很多时候规则校验会阻碍一些开发者,您的思路如果足够优秀,我们会考虑调整规则。
|
||||||
|
|
||||||
58
docs/contributing/code.md
Normal file
58
docs/contributing/code.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
### 代码贡献
|
||||||
|
贡献此仓库的代码时,请查阅 ["fork and pull request"](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) 流程,除非您是项目的维护者。请不要直接提交到主分支。
|
||||||
|
在提交PR之前,请检查按照pull request模板的指导进行操作。注意,我们的CI系统会自动运行linting和测试,以确保您的代码符合我们的标准。
|
||||||
|
更重要的是,我们需要保持良好的单元测试和文档,如果你做了如下操作:
|
||||||
|
- 添加新功能
|
||||||
|
更新受影响的操作文档
|
||||||
|
- 修复bug
|
||||||
|
尽可能添加一个单元测试,在tests/integration_tests或tests/unit_tests中
|
||||||
|
|
||||||
|
|
||||||
|
#### 依赖管理:Poetry与env/dependency管理方法
|
||||||
|
这个项目使用 Poetry 来管理依赖。
|
||||||
|
> 注意:在安装Poetry之前,如果您使用Conda,请创建并激活一个新的Conda env(例如,`conda create-n chatchat python=3.9`)
|
||||||
|
|
||||||
|
Install Poetry: [documentation on how to install it.](https://python-poetry.org/docs/#installing-with-pipx)
|
||||||
|
|
||||||
|
> 注意: 如果您使用 Conda 或 Pyenv 作为您的环境/包管理器,在安装Poetry之后,
|
||||||
|
> 使用如下命令使Poetry使用virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
|
||||||
|
|
||||||
|
#### 本地开发环境安装
|
||||||
|
|
||||||
|
- 选择主项目目录
|
||||||
|
```shell
|
||||||
|
cd chatchat
|
||||||
|
```
|
||||||
|
|
||||||
|
- 安装chatchat依赖(for running chatchat lint\tests):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
poetry install --with lint,test
|
||||||
|
```
|
||||||
|
> Poetry install后会在你的site-packages安装一个chatchat-`<version>`.dist-info文件夹带有direct_url.json文件,这个文件指向你的开发环境
|
||||||
|
|
||||||
|
#### 格式化和代码检查
|
||||||
|
在提交PR之前,请在本地运行以下命令;CI系统也会进行检查。
|
||||||
|
|
||||||
|
##### 代码格式化
|
||||||
|
本项目使用ruff进行代码格式化。
|
||||||
|
|
||||||
|
##### 关于
|
||||||
|
|
||||||
|
要对某个库进行格式化,请在相应的库目录下运行相同的命令:
|
||||||
|
```shell
|
||||||
|
cd {model-providers|chatchat-server|chatchat-frontend}
|
||||||
|
make format
|
||||||
|
```
|
||||||
|
|
||||||
|
此外,你可以使用format_diff命令仅对当前分支中与主分支相比已修改的文件进行格式化:
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
|
||||||
|
make format_diff
|
||||||
|
```
|
||||||
|
当你对项目的一部分进行了更改,并希望确保更改的部分格式正确,而不影响代码库的其他部分时,这个命令特别有用。
|
||||||
|
|
||||||
|
|
||||||
36
docs/contributing/repo_structure.md
Normal file
36
docs/contributing/repo_structure.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
### 仓库结构
|
||||||
|
如果您想要贡献代码,您需要了解仓库的结构。这将有助于您找到您想要的文件,以及了解如何将您的代码提交到仓库。
|
||||||
|
|
||||||
|
chatchat沿用了 monorepo的组织方式, 项目的代码库包含了多个包。
|
||||||
|
|
||||||
|
以下是可视化为树的结构:
|
||||||
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
.
|
||||||
|
├── docs # 文档
|
||||||
|
├── chatchat-server # 服务端
|
||||||
|
│ └── tests
|
||||||
|
│ ├── integration_tests # 集成测试 (每个包都有,为了简洁没有展示)
|
||||||
|
│ └── unit_tests # 单元测试 (每个包都有,为了简洁没有展示)
|
||||||
|
├── frontend # 前端
|
||||||
|
└── model-providers # 模型平台
|
||||||
|
|
||||||
|
```
|
||||||
|
根目录还包含以下文件:
|
||||||
|
|
||||||
|
pyproject.toml: 用于构建文档和文档linting的依赖项,cookbook。
|
||||||
|
Makefile: 包含用于构建,linting和文档和cookbook的快捷方式的文件。
|
||||||
|
|
||||||
|
根目录中还有其他文件,但它们的都应该是顾名思义的,请查看相应的文件夹以了解更多信息。
|
||||||
|
|
||||||
|
### 代码
|
||||||
|
|
||||||
|
代码库中的代码分为两个部分:
|
||||||
|
|
||||||
|
- /chatchat-server目录包含chatchat服务端代码。
|
||||||
|
- /frontend目录包含chatchat前端代码。
|
||||||
|
- /model-providers目录包含对供应商模型转换的代码。
|
||||||
|
|
||||||
|
详细的
|
||||||
@ -1,50 +1,4 @@
|
|||||||
|
|
||||||
### 加入开发
|
|
||||||
#### 依赖管理:Poetry与env/dependency管理方法
|
|
||||||
这个项目使用 Poetry 来管理依赖。
|
|
||||||
> 注意:在安装Poetry之前,如果您使用Conda,请创建并激活一个新的Conda env(例如,`conda create-n chatchat python=3.9`)
|
|
||||||
|
|
||||||
Install Poetry: [documentation on how to install it.](https://python-poetry.org/docs/#installing-with-pipx)
|
|
||||||
|
|
||||||
> 注意: 如果您使用 Conda 或 Pyenv 作为您的环境/包管理器,在安装Poetry之后,
|
|
||||||
> 使用如下命令使Poetry使用virtualenv python environment (`poetry config virtualenvs.prefer-active-python true`)
|
|
||||||
|
|
||||||
#### 本地开发环境安装
|
|
||||||
|
|
||||||
- 选择主项目目录
|
|
||||||
```shell
|
|
||||||
cd model-providers
|
|
||||||
```
|
|
||||||
|
|
||||||
- 安装model-providers依赖(for running model-providers lint\tests):
|
|
||||||
|
|
||||||
```shell
|
|
||||||
poetry install --with lint,test
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 格式化和代码检查
|
|
||||||
在提交PR之前,请在本地运行以下命令;CI系统也会进行检查。
|
|
||||||
|
|
||||||
##### 代码格式化
|
|
||||||
本项目使用ruff进行代码格式化。
|
|
||||||
|
|
||||||
要对某个库进行格式化,请在相应的库目录下运行相同的命令:
|
|
||||||
```shell
|
|
||||||
cd {model-providers|chatchat|chatchat-server|chatchat-frontend}
|
|
||||||
make format
|
|
||||||
```
|
|
||||||
|
|
||||||
此外,你可以使用format_diff命令仅对当前分支中与主分支相比已修改的文件进行格式化:
|
|
||||||
|
|
||||||
|
|
||||||
```shell
|
|
||||||
|
|
||||||
make format_diff
|
|
||||||
```
|
|
||||||
当你对项目的一部分进行了更改,并希望确保更改的部分格式正确,而不影响代码库的其他部分时,这个命令特别有用。
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 开始使用
|
### 开始使用
|
||||||
|
|
||||||
当项目安装完成,配置这个`model_providers.yaml`文件,即可完成平台加载
|
当项目安装完成,配置这个`model_providers.yaml`文件,即可完成平台加载
|
||||||
@ -57,7 +11,7 @@ model_providers包含了不同平台提供的 全局配置`provider_credential`,
|
|||||||
关于`schemas`信息详细描述设计,请查看 [README_CN.md](model_providers/core/model_runtime/README_CN.md)
|
关于`schemas`信息详细描述设计,请查看 [README_CN.md](model_providers/core/model_runtime/README_CN.md)
|
||||||
|
|
||||||
|
|
||||||
#### 相关平台配置说明
|
### 相关平台配置说明
|
||||||
|
|
||||||
|
|
||||||
#### 要加载xinference平台,操作如下
|
#### 要加载xinference平台,操作如下
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user