File tree Expand file tree Collapse file tree 4 files changed +99
-50
lines changed Expand file tree Collapse file tree 4 files changed +99
-50
lines changed Original file line number Diff line number Diff line change 2323
2424## 原理
2525
26- 当用户在 GitLab 上提交代码(如 Merge Request 或 Push 操作)时,GitLab 将自动触发 webhook 事件,调用本系统的接口。系统随后通过第三方大模型对代码进行审查,并将审查结果直接反馈到对应的 Merge Request 或 Commit 的 Note 中,便于团队查看和处理。
26+ 当用户在 GitLab 上提交代码(如 Merge Request 或 Push 操作)时,GitLab 将自动触发 webhook
27+ 事件,调用本系统的接口。系统随后通过第三方大模型对代码进行审查,并将审查结果直接反馈到对应的 Merge Request 或 Commit 的
28+ Note 中,便于团队查看和处理。
2729
2830![ 流程图] ( ./doc/img/process.png )
2931
@@ -137,34 +139,15 @@ streamlit run ui.py --server.port=5002 --server.address=0.0.0.0
137139 DINGTALK_WEBHOOK_URL=https://oapi.dingtalk.com/robot/send?access_token=xxx #替换为你的Webhook URL
138140 ```
139141
140- #### 2.配置企业微信推送
141-
142- - 在企业微信群中添加一个自定义机器人,获取 Webhook URL。
143-
144- - 更新 .env 中的配置:
145- ```
146- #企业微信配置
147- WECOM_ENABLED=1 #0不发送企业微信消息,1发送企业微信消息
148- WECOM_WEBHOOK_URL=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx #替换为你的Webhook URL
149- ```
150-
151- #### 3.配置飞书推送
152-
153- - 在飞书群中添加一个自定义机器人,获取 Webhook URL。
154- - 更新 .env 中的配置:
155- ```
156- #飞书配置
157- FEISHU_ENABLED=1
158- FEISHU_WEBHOOK_URL=https://open.feishu.cn/open-apis/bot/v2/hook/xxx #替换为你的Webhook URL
159- ```
142+ 企业微信和飞书推送配置类似,具体参见 [ 常见问题] ( doc/faq.md )
160143
161144## 其它
162145
163146** 1.如何review代码结构?**
164147
165148可通过命令工具对代码结构进行检查,命令如下:
166149
167- ``` aiignore
150+ ``` bash
168151python -m biz.cmd.review
169152```
170153
Original file line number Diff line number Diff line change @@ -85,4 +85,48 @@ OLLAMA_API_BASE_URL=http://127.0.0.1:11434 # 错误
8585OLLAMA_API_BASE_URL=http://{宿主机/外网IP地址}:11434 # 正确
8686```
8787
88+ #### 5.如何使用Redis Queue队列?
8889
90+ ** 操作步骤**
91+
92+ 1.开发调试模式下,启动容器:
93+
94+ ```
95+ docker compose -f docker-compose.rq.yml up -d
96+ ```
97+
98+ 2.生产模式下,启动容器:
99+ ```
100+ docker compose -f docker-compose.prod.yml up -d
101+ ```
102+
103+ ** 特别说明:**
104+
105+ 在 .env 文件中配置 WORKER_QUEUE,其值为 GitLab 域名,并将域名中的点(.)替换为下划线(_ )。如果域名为 gitlab.test.cn,则配置为:
106+
107+ ```
108+ WORKER_QUEUE=gitlab_test_cn
109+ ```
110+
111+ #### 如何配置企业微信和飞书消息推送?
112+
113+ ** 1.配置企业微信推送**
114+
115+ - 在企业微信群中添加一个自定义机器人,获取 Webhook URL。
116+
117+ - 更新 .env 中的配置:
118+ ```
119+ #企业微信配置
120+ WECOM_ENABLED=1 #0不发送企业微信消息,1发送企业微信消息
121+ WECOM_WEBHOOK_URL=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx #替换为你的Webhook URL
122+ ```
123+
124+ ** 2.配置飞书推送**
125+
126+ - 在飞书群中添加一个自定义机器人,获取 Webhook URL。
127+ - 更新 .env 中的配置:
128+ ```
129+ #飞书配置
130+ FEISHU_ENABLED=1
131+ FEISHU_WEBHOOK_URL=https://open.feishu.cn/open-apis/bot/v2/hook/xxx #替换为你的Webhook URL
132+ ```
Original file line number Diff line number Diff line change 1+ services :
2+ app :
3+ build :
4+ context : .
5+ dockerfile : Dockerfile
6+ target : dev
7+ image : ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1
8+ ports :
9+ - " 5001:5001"
10+ - " 5002:5002"
11+ volumes :
12+ - ./biz:/app/biz
13+ - ./conf:/app/conf
14+ - ./data:/app/data
15+ - ./log:/app/log
16+ - ./api.py:/app/api.py
17+ - ./requirements.txt:/app/requirements.txt
18+ - ./ui.py:/app/ui.py
19+ env_file :
20+ - ./conf/.env
21+ depends_on :
22+ redis :
23+ condition : service_started
24+ restart : unless-stopped
25+
26+ worker :
27+ build :
28+ context : .
29+ dockerfile : Dockerfile
30+ target : worker
31+ image : ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1-worker
32+ volumes_from :
33+ - app
34+ env_file :
35+ - ./conf/.env
36+ depends_on :
37+ redis :
38+ condition : service_started
39+ restart : unless-stopped
40+
41+ redis :
42+ image : redis:alpine
43+ ports :
44+ - " 6379:6379"
45+ volumes :
46+ - redis_data:/data
47+ restart : unless-stopped
48+
49+ volumes :
50+ redis_data:
Original file line number Diff line number Diff line change @@ -14,37 +14,9 @@ services:
1414 - ./data:/app/data
1515 - ./log:/app/log
1616 - ./api.py:/app/api.py
17- - ./requirements.txt:/app/requirements.txt
1817 - ./ui.py:/app/ui.py
1918 env_file :
2019 - ./conf/.env
21- depends_on :
22- redis :
23- condition : service_started
2420 restart : unless-stopped
25-
26- worker :
27- build :
28- context : .
29- dockerfile : Dockerfile
30- target : worker
31- image : ghcr.io/sunmh207/ai-codereview-gitlab:1.3.1-worker
32- volumes_from :
33- - app
34- env_file :
35- - ./conf/.env
36- depends_on :
37- redis :
38- condition : service_started
39- restart : unless-stopped
40-
41- redis :
42- image : redis:alpine
43- ports :
44- - " 6379:6379"
45- volumes :
46- - redis_data:/data
47- restart : unless-stopped
48-
4921volumes :
5022 redis_data:
You can’t perform that action at this time.
0 commit comments