This commit is contained in:
Hua
2025-02-18 17:20:53 +08:00
parent a34a797b6c
commit 6010a37dbf

View File

@ -1,2 +1,57 @@
# ai-code-review
一个基于AI的代码审查工具支持多种Git平台和AI模型。
## 功能特点
- 支持多个Git平台(GitLab、Gitee、Gogs等)
- 支持多种AI模型(OpenAI、Ollama等)
- 支持AI服务负载均衡
- 提供Web界面进行配置管理
- 支持自动禁用异常的AI服务
## 快速开始
1. 下载并编译项目:
```bash
git clone https://github.com/your-username/ai-code-review.git
cd ai-code-review
go build
```
2. 配置config.yaml:
```yaml
port: 53321
admin_token: "your-admin-token" # 管理页面访问令牌
ais:
- name: "your-ai"
type: "ollama" # 或 "openai"
url: "http://localhost:11434" # AI服务地址
model: "your-model" # 使用的模型名称
git:
- name: "your-git"
type: "gitlab" # 或 "gitee", "gogs"
token: "your-git-token"
webhook_secret: "your-webhook-secret"
api_base: "your-git-api-base"
```
3. 运行服务:
```bash
./ai-code-review
```
4. 访问管理界面:
- 打开浏览器访问 `http://localhost:53321`
- 使用配置文件中的admin_token登录
- 在Web界面中管理AI和Git平台配置
5. 配置Git平台:
- 在你的Git平台中添加Webhook
- Webhook URL设置为: `http://your-server:53321/api/webhook/git-name`
- 设置Webhook密钥与配置文件中的webhook_secret一致
## 注意事项
- 请确保AI服务和Git平台的API地址可以正常访问
- 妥善保管各类密钥和Token
- 建议在生产环境中使用HTTPS