2025-02-18 17:20:53 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:55:25 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 16:53:34 +08:00
2025-02-18 17:20:53 +08:00

ai-code-review

一个基于AI的代码审查工具支持多种Git平台和AI模型。

功能特点

  • 支持多个Git平台(GitLab、Gitee、Gogs等)
  • 支持多种AI模型(OpenAI、Ollama等)
  • 支持AI服务负载均衡
  • 提供Web界面进行配置管理
  • 支持自动禁用异常的AI服务

快速开始

  1. 下载并编译项目:
git clone https://github.com/your-username/ai-code-review.git
cd ai-code-review
go build
  1. 配置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"
  1. 运行服务:
./ai-code-review
  1. 访问管理界面:
  • 打开浏览器访问 http://localhost:53321
  • 使用配置文件中的admin_token登录
  • 在Web界面中管理AI和Git平台配置
  1. 配置Git平台:
  • 在你的Git平台中添加Webhook
  • Webhook URL设置为: http://your-server:53321/api/webhook/git-name
  • 设置Webhook密钥与配置文件中的webhook_secret一致

注意事项

  • 请确保AI服务和Git平台的API地址可以正常访问
  • 妥善保管各类密钥和Token
  • 建议在生产环境中使用HTTPS
Description
No description provided
Readme 119 KiB
Languages
Go 65.6%
HTML 33.3%
Dockerfile 1.1%