2025-11-08 10:52:09 +08:00
|
|
|
|
# 参与贡献
|
|
|
|
|
|
|
2026-03-17 18:56:42 +08:00
|
|
|
|
感谢你对 Yuxi 项目的兴趣!我们欢迎任何形式的贡献,包括但不限于代码提交、功能建议、问题反馈和文档改进。
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/xerrors/Yuxi-Know/contributors">
|
|
|
|
|
|
<img src="https://contributors.nn.ci/api?repo=xerrors/Yuxi-Know" alt="贡献者名单">
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
## 贡献流程
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
### 1. Fork 项目
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
在 GitHub 上点击 Fork 按钮,将项目复制到你的账户。
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 2. 创建功能分支
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git checkout -b feature/amazing-feature
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 3. 开发并提交
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-03-10 13:55:19 +08:00
|
|
|
|
git commit -m 'feat: 添加新功能'
|
2025-11-08 10:52:09 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 4. 推送代码
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git push origin feature/amazing-feature
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 5. 创建 Pull Request
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
在 GitHub 上创建 PR,详细描述你的更改内容和动机。
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
## 代码规范
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
项目对代码质量有一定要求,提交前请确保:
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
- Python 代码使用 `make format` 格式化
|
|
|
|
|
|
- 使用 `make lint` 检查代码质量
|
|
|
|
|
|
- 添加必要的测试用例
|
|
|
|
|
|
- 更新相关文档
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
## 提交信息规范
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
使用清晰规范的提交信息:
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
feat: 添加新功能
|
|
|
|
|
|
fix: 修复 bug
|
|
|
|
|
|
docs: 更新文档
|
|
|
|
|
|
style: 代码格式调整
|
|
|
|
|
|
refactor: 代码重构
|
|
|
|
|
|
test: 添加测试
|
|
|
|
|
|
chore: 构建过程或辅助工具的变动
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
## Bug 修复发布流程
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
当发布后发现 bug 需要修复时:
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 情况 1:main 上没有未完成的新功能
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
直接在 main 修复并发布:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-03-10 13:55:19 +08:00
|
|
|
|
git commit -m "fix: 解决配置解析器崩溃问题"
|
2025-11-08 10:52:09 +08:00
|
|
|
|
git tag -a v0.3.1 -m "Hotfix v0.3.1"
|
|
|
|
|
|
git push origin main --tags
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 情况 2:main 上已有新功能未完成
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
从上一个 tag 建立 hotfix 分支:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
git checkout -b hotfix/0.3.1 v0.3.0
|
|
|
|
|
|
# 修复问题
|
2026-03-10 13:55:19 +08:00
|
|
|
|
git commit -m "fix: 解决配置解析器崩溃问题"
|
2025-11-08 10:52:09 +08:00
|
|
|
|
git push origin hotfix/0.3.1
|
|
|
|
|
|
|
|
|
|
|
|
# 测试后合并回 main 并打 tag
|
|
|
|
|
|
git checkout main
|
|
|
|
|
|
git merge --no-ff hotfix/0.3.1
|
|
|
|
|
|
git tag -a v0.3.1 -m "Hotfix v0.3.1"
|
|
|
|
|
|
git push origin main --tags
|
|
|
|
|
|
|
|
|
|
|
|
# 删除临时分支
|
|
|
|
|
|
git branch -d hotfix/0.3.1
|
|
|
|
|
|
git push origin --delete hotfix/0.3.1
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
## 测试指南
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 运行测试
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
# 全量路由测试
|
|
|
|
|
|
make router-tests
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
# 运行特定测试
|
2025-11-08 10:52:09 +08:00
|
|
|
|
make router-tests PYTEST_ARGS="-k knowledge_router"
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
# 直接运行 pytest
|
2025-11-08 10:52:09 +08:00
|
|
|
|
uv run --group test pytest test/api -vv
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
### 测试配置
|
|
|
|
|
|
|
|
|
|
|
|
首次运行测试前,需要配置测试凭据:
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
cp test/.env.test.example test/.env.test
|
|
|
|
|
|
```
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
---
|
2025-11-08 10:52:09 +08:00
|
|
|
|
|
2026-03-10 13:55:19 +08:00
|
|
|
|
感谢每一位贡献者的付出!
|