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

View File

@@ -86,3 +86,14 @@ def upsert_comment(owner: str, repo: str, index: int, marker: str, body: str) ->
data={"body": full},
)
return created["id"]
def post_comment(owner: str, repo: str, index: int, body: str) -> int:
"""Legt einen NEUEN Kommentar an (nicht idempotent — für Chat-Antworten,
wo jede @mention ihre eigene Antwort bekommen soll)."""
created = _request(
"POST",
f"/repos/{owner}/{repo}/issues/{index}/comments",
data={"body": body},
)
return created["id"]