feat(bot): interactive Gitea webhook bot (FastAPI) — @mention chat + auto PR review

A small persistent service (bot/app.py) that reuses the ci-ai modules
(llm.py->Jetson, gitea_api.py, ai_review prompt). Handles issue_comment
@ci-ai mentions as threaded chat and pull_request events as idempotent
reviews — answering in seconds via webhook, with NO runner/clone/hairpin.
Runs on the Pi next to Gitea (internal http://gitea:3000 API).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 22:23:00 +02:00
parent 2ae14a51e4
commit ddeb3142e7
3 changed files with 136 additions and 0 deletions

12
bot/Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
# ci-ai-bot — build from the repo ROOT so it can pull in scripts/:
# docker build -f bot/Dockerfile -t ci-ai-bot .
FROM python:3.12-slim
WORKDIR /app
RUN pip install --no-cache-dir "fastapi>=0.115,<0.116" "uvicorn[standard]>=0.32,<0.33"
COPY scripts/ /app/scripts/
COPY bot/app.py /app/app.py
ENV PYTHONUNBUFFERED=1
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
CMD python -c "import urllib.request;urllib.request.urlopen('http://localhost:8080/healthz')" || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]