Aider làm gì trong khóa IB Bot?
- Refactor script
deploy_pr_*,test_webhook_*.py - Sửa nhanh JSON workflow n8n
- Commit có message rõ ràng sau khi agent sửa xong
Không thay Cursor khi soạn bài markdown dài — bổ sung cho workflow terminal.
Yêu cầu
| Thành phần | Ghi chú |
|---|---|
| OS | Windows 10/11 |
| Python | 3.8+ (installer aider-install có thể cài sẵn Python 3.12) |
| Git | Khuyến nghị — Aider mạnh nhất với repo Git |
| API key | Anthropic, OpenAI, DeepSeek, … |
Cách 1 — Cài khuyến nghị (aider-install)
Mở PowerShell:
python -m pip install aider-install
aider-install
- Tạo môi trường Python tách biệt (không làm bẩn Python hệ thống)
- Tự cài Python 3.12 qua
uvnếu thiếu
Sau cài, đóng/mở terminal mới rồi chạy aider --version.
Cách 2 — One-liner PowerShell (Windows)
powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
Cách 3 — pipx / uv (nâng cao)
python -m pip install pipx
pipx install aider-chat
Hoặc:
python -m pip install uv
uv tool install --force --python python3.12 --with pip aider-chat@latest
Bước — Chạy Aider lần đầu
cd "D:Website DocusaurusHuongNghiepPhanTichDinhLuong"
aider --model sonnet --api-key anthropic=sk-ant-...
Ví dụ model khác:
# OpenAI
aider --model gpt-4o --api-key openai=sk-...
# DeepSeek
aider --model deepseek --api-key deepseek=sk-...
Trong session Aider, gõ yêu cầu bằng tiếng Việt:
/add test_form_webhook.py
Thêm test case ID rỗng trả về 400
Aider sẽ sửa file và hỏi có commit không.
Lệnh hữu ích trong session
| Lệnh | Mục đích |
|---|---|
/add <file> |
Thêm file vào context |
/drop <file> |
Bỏ file khỏi context |
/commit |
Commit thay đổi |
/help |
Xem lệnh |
/exit |
Thoát |
Cấu hình lưu API key (tùy chọn)
Tạo file .aider.conf.yml trong home hoặc project — xem aider.chat/docs/config.html.
Không commit file chứa API key.
Xử lý lỗi
| Lỗi | Cách xử lý |
|---|---|
aider không nhận lệnh |
Chạy python -m aider hoặc mở terminal mới sau aider-install |
| Lỗi pip / quyền | Dùng aider-install thay vì pip install aider-chat trực tiếp |
| Không thấy Git | git init trong folder project |
Checklist
- [ ]
python -m pip install aider-install+aider-install - [ ]
aider --versionOK - [ ] Có Git repo (hoặc
git init) - [ ] Chạy thử với 1 file
.py+ API key - [ ] Hiểu
/addvà/commit
Zalo hỗ trợ: 039.791.9841