6010a37dbff72d0f3ecd8fe2bfa3d89841cf9ba4
ai-code-review
一个基于AI的代码审查工具,支持多种Git平台和AI模型。
功能特点
- 支持多个Git平台(GitLab、Gitee、Gogs等)
- 支持多种AI模型(OpenAI、Ollama等)
- 支持AI服务负载均衡
- 提供Web界面进行配置管理
- 支持自动禁用异常的AI服务
快速开始
- 下载并编译项目:
git clone https://github.com/your-username/ai-code-review.git
cd ai-code-review
go build
- 配置config.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"
- 运行服务:
./ai-code-review
- 访问管理界面:
- 打开浏览器访问
http://localhost:53321
- 使用配置文件中的admin_token登录
- 在Web界面中管理AI和Git平台配置
- 配置Git平台:
- 在你的Git平台中添加Webhook
- Webhook URL设置为:
http://your-server:53321/api/webhook/git-name
- 设置Webhook密钥与配置文件中的webhook_secret一致
注意事项
- 请确保AI服务和Git平台的API地址可以正常访问
- 妥善保管各类密钥和Token
- 建议在生产环境中使用HTTPS
Description
Languages
Go
65.6%
HTML
33.3%
Dockerfile
1.1%