|
| 1 | +# Frequently Asked Questions (FAQ) |
| 2 | + |
| 3 | +This document collects common questions and solutions for the Code Review GPT Gitlab project. |
| 4 | + |
| 5 | +## 📦 Installation & Deployment |
| 6 | + |
| 7 | +!!! question "Q1: What should I do if Docker containers fail to start?" |
| 8 | + |
| 9 | + !!! tip "Solution" |
| 10 | + |
| 11 | + Please follow these steps to troubleshoot: |
| 12 | + |
| 13 | + 1. **Check Docker and Docker Compose versions** |
| 14 | + ```bash |
| 15 | + docker --version |
| 16 | + docker compose version |
| 17 | + ``` |
| 18 | + Ensure Docker 20.10+ and Docker Compose v2 are installed. |
| 19 | + |
| 20 | + 2. **View container logs** |
| 21 | + ```bash |
| 22 | + docker compose logs backend |
| 23 | + docker compose logs frontend |
| 24 | + ``` |
| 25 | + |
| 26 | + 3. **Check port occupancy** |
| 27 | + ```bash |
| 28 | + # Check if ports are occupied |
| 29 | + lsof -i :3000 # Frontend port |
| 30 | + lsof -i :8000 # Backend port |
| 31 | + lsof -i :6379 # Redis port |
| 32 | + ``` |
| 33 | + |
| 34 | + 4. **Rebuild and start** |
| 35 | + ```bash |
| 36 | + docker compose down |
| 37 | + docker compose up -d --build |
| 38 | + ``` |
| 39 | + |
| 40 | +!!! question "Q2: How to configure environment variables?" |
| 41 | + |
| 42 | + !!! info "Configuration Steps" |
| 43 | + |
| 44 | + The project uses `.env` file to manage environment variables: |
| 45 | + |
| 46 | + 1. Copy the example file: |
| 47 | + ```bash |
| 48 | + cp .env.example .env |
| 49 | + ``` |
| 50 | + |
| 51 | + 2. Edit the `.env` file and configure necessary variables: |
| 52 | + - `VITE_API_BASE_URL`: Frontend API base URL |
| 53 | + - `VITE_DEV_PROXY_TARGET`: Development environment proxy target |
| 54 | + - Other necessary configuration items |
| 55 | + |
| 56 | + 3. Restart services to apply configuration: |
| 57 | + ```bash |
| 58 | + docker compose restart |
| 59 | + ``` |
| 60 | + |
| 61 | +## 🔧 Configuration |
| 62 | + |
| 63 | +!!! question "Q3: How to configure GitLab Webhook?" |
| 64 | + |
| 65 | + !!! info "Configuration Steps" |
| 66 | + |
| 67 | + Configuration steps: |
| 68 | + |
| 69 | + 1. **Get Webhook URL** |
| 70 | + - Format: `http://your-domain.com/api/webhook/gitlab/` |
| 71 | + - Note: URL must end with `/api/webhook/gitlab/` |
| 72 | + |
| 73 | + 2. **Configure Webhook in GitLab project** |
| 74 | + - Go to Project Settings → Webhooks |
| 75 | + - Fill in Webhook URL |
| 76 | + - Select trigger events: `Merge Request events`, `Push events`, etc. |
| 77 | + - Save configuration |
| 78 | + |
| 79 | + 3. **Enable project review in the system** |
| 80 | + - Log in to the system management interface |
| 81 | + - Go to project list |
| 82 | + - Find the corresponding project and enable code review functionality |
| 83 | + |
| 84 | +## 🚀 Usage |
| 85 | + |
| 86 | +!!! question "Q4: What should I do if code review doesn't trigger automatically?" |
| 87 | + |
| 88 | + !!! warning "Troubleshooting Steps" |
| 89 | + |
| 90 | + Please check the following: |
| 91 | + |
| 92 | + 1. **Check if project review is enabled** |
| 93 | + - Confirm that `review_enabled` status in project list is enabled |
| 94 | + - Confirm that `auto_review_on_mr` option is enabled |
| 95 | + |
| 96 | + 2. **Check Webhook configuration** |
| 97 | + - Confirm GitLab Webhook URL is configured correctly |
| 98 | + - Confirm Webhook events are selected correctly |
| 99 | + - Check Webhook logs to confirm if requests are received |
| 100 | + |
| 101 | + 3. **Check Webhook event rules** |
| 102 | + - Confirm the project has enabled corresponding Webhook event rules |
| 103 | + - Check `Webhook Logs` to confirm if events are correctly identified |
| 104 | + |
| 105 | + 4. **View system logs** |
| 106 | + ```bash |
| 107 | + docker compose logs -f backend |
| 108 | + ``` |
| 109 | + |
| 110 | +!!! question "Q5: Code review results are not sending notifications?" |
| 111 | + |
| 112 | + !!! tip "Troubleshooting Steps" |
| 113 | + |
| 114 | + Troubleshooting steps: |
| 115 | + |
| 116 | + 1. **Check notification channel configuration** |
| 117 | + - Confirm notification channel is created and status is active |
| 118 | + - Confirm project is associated with notification channel |
| 119 | + - Check if notification channel configuration information is correct |
| 120 | + |
| 121 | + 2. **Check review status** |
| 122 | + - View review records, confirm review status is `completed` |
| 123 | + - Check `notification_sent` field status |
| 124 | + - View error information in `notification_result` field |
| 125 | + |
| 126 | + 3. **Test notification channel** |
| 127 | + - Manually test notification channel in management backend |
| 128 | + - Check network connection and API key validity |
| 129 | + |
| 130 | +!!! question "Q6: How to view code review history?" |
| 131 | + |
| 132 | + !!! info "Viewing Methods" |
| 133 | + |
| 134 | + There are multiple ways to view: |
| 135 | + |
| 136 | + 1. **Through frontend interface** |
| 137 | + - Log in to system frontend interface |
| 138 | + - Go to "Review Records" page |
| 139 | + - Can filter by project, time range, etc. |
| 140 | + |
| 141 | + 2. **Through management backend** |
| 142 | + - Access `http://localhost:8000/admin/` |
| 143 | + - Go to `Merge Request Reviews` menu |
| 144 | + - View all review records |
| 145 | + |
| 146 | + 3. **View detailed logs** |
| 147 | + - Go to "Logs" page to view detailed processing logs |
| 148 | + - Can view logs of each step: Webhook reception, LLM calls, notification sending, etc. |
| 149 | + |
| 150 | +## 🔍 Troubleshooting |
| 151 | + |
| 152 | +!!! question "Q7: Webhook requests are rejected or return 403/401?" |
| 153 | + |
| 154 | + !!! warning "Possible Causes" |
| 155 | + |
| 156 | + Possible causes: |
| 157 | + |
| 158 | + 1. **Check Webhook Secret Token** |
| 159 | + - If Secret Token is configured, ensure the system side also has the same Token configured |
| 160 | + |
| 161 | + 2. **Check GitLab Token permissions** |
| 162 | + - Confirm GitLab Token has sufficient permissions to access the project |
| 163 | + - Confirm Token is not expired |
| 164 | + |
| 165 | + 3. **Check firewall and network** |
| 166 | + - Confirm server can access GitLab |
| 167 | + - Confirm GitLab can access Webhook URL |
| 168 | + |
| 169 | + 4. **View request logs** |
| 170 | + - View detailed request headers and error information in Webhook Logs |
| 171 | + |
| 172 | +!!! question "Q8: System runs slowly or times out?" |
| 173 | + |
| 174 | + !!! warning "Optimization Suggestions" |
| 175 | + |
| 176 | + Optimization suggestions: |
| 177 | + |
| 178 | + 1. **Check resource usage** |
| 179 | + ```bash |
| 180 | + docker stats |
| 181 | + ``` |
| 182 | + |
| 183 | + 2. **Optimize LLM calls** |
| 184 | + - Use faster models |
| 185 | + - Reduce number of files to review |
| 186 | + - Configure reasonable timeout |
| 187 | + |
| 188 | + 3. **Database optimization** |
| 189 | + - Regularly clean up old log records |
| 190 | + - Add indexes to frequently queried fields |
| 191 | + |
| 192 | + 4. **Increase resources** |
| 193 | + - Increase container memory limits |
| 194 | + - Use more powerful servers |
| 195 | + |
| 196 | +## 📚 Other Questions |
| 197 | + |
| 198 | +!!! question "Q9: How to upgrade to a new version?" |
| 199 | + |
| 200 | + !!! tip "Upgrade Steps" |
| 201 | + |
| 202 | + Upgrade steps: |
| 203 | + |
| 204 | + 1. **Backup current data** |
| 205 | + ```bash |
| 206 | + # Backup database and configuration |
| 207 | + cp backend/db.sqlite3 backend/db.sqlite3.backup |
| 208 | + cp .env .env.backup |
| 209 | + ``` |
| 210 | + |
| 211 | + 2. **Pull latest code** |
| 212 | + ```bash |
| 213 | + git pull origin main |
| 214 | + ``` |
| 215 | + |
| 216 | + 3. **Update dependencies** |
| 217 | + ```bash |
| 218 | + docker compose down |
| 219 | + docker compose build --no-cache |
| 220 | + docker compose up -d |
| 221 | + ``` |
| 222 | + |
| 223 | + 4. **Execute database migration** |
| 224 | + ```bash |
| 225 | + docker compose exec backend python manage.py migrate |
| 226 | + ``` |
| 227 | + |
| 228 | +!!! question "Q10: Which programming languages are supported?" |
| 229 | + |
| 230 | + !!! info "Language Support" |
| 231 | + |
| 232 | + Theoretically supports all programming languages because: |
| 233 | + |
| 234 | + - The system uses LLM for code review, and LLM itself supports multiple programming languages |
| 235 | + - Does not depend on specific syntax analyzers |
| 236 | + - Review quality depends on LLM model capabilities |
| 237 | + |
| 238 | + !!! tip "Recommendations" |
| 239 | + |
| 240 | + Recommendations: |
| 241 | + - Mainstream languages (Python, JavaScript, Java, Go, etc.) have better review results |
| 242 | + - For special languages, customizing Prompt may be needed for better results |
| 243 | + |
| 244 | +!!! question "Q11: How to contribute code or report issues?" |
| 245 | + |
| 246 | + !!! success "Welcome Contributions" |
| 247 | + |
| 248 | + Welcome contributions: |
| 249 | + |
| 250 | + 1. **Report issues** |
| 251 | + - Submit issues in GitHub Issues |
| 252 | + - Provide detailed error information and reproduction steps |
| 253 | + |
| 254 | + 2. **Submit code** |
| 255 | + - Fork the project |
| 256 | + - Create a feature branch |
| 257 | + - Submit Pull Request |
| 258 | + |
| 259 | + 3. **Contact maintainers** |
| 260 | + - Email: mixuxin@163.com |
| 261 | + - WeChat: isxuxin |
| 262 | + |
| 263 | +--- |
| 264 | + |
| 265 | +!!! tip "💡 Tips" |
| 266 | + |
| 267 | + If none of the above questions solve your problem, please: |
| 268 | + |
| 269 | + 1. Check project [GitHub Issues](https://github.com/mimo-x/Code-Review-GPT-Gitlab/issues) |
| 270 | + 2. View detailed system logs |
| 271 | + 3. Contact project maintainers for help |
| 272 | + |
| 273 | + **Enjoy using!** 🎉 |
| 274 | + |
0 commit comments