[O] Dockerize AI github moderator
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
FROM python:3.12-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
RUN pip install openai pygithub fastapi uvicorn hypy_utils hatchling
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONUNBUFFERED=true
|
||||
ENV PYTHONPATH=/app
|
||||
|
||||
# The app looks for config at ~/.config/gh_moderator.toml
|
||||
# We will mount it via compose
|
||||
|
||||
CMD ["uvicorn", "tools.gh_moderator:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
@@ -5,6 +5,10 @@ webhook_secret = "secret"
|
||||
gh_token = "token"
|
||||
gh_repo = "owner/repo"
|
||||
|
||||
# AI harm classifier token
|
||||
harm_classifier_url = "https://example.com/classify"
|
||||
harm_classifier_token = "token"
|
||||
|
||||
|
||||
[OpenAI]
|
||||
org = "your-org-id"
|
||||
key = "your-api-key"
|
||||
model = "omni-moderation-latest"
|
||||
threshold = 0.7
|
||||
|
||||
@@ -37,8 +37,6 @@ me = gh.get_user()
|
||||
repo = gh.get_repo(config["gh_repo"])
|
||||
printc(f"&a[+] Logged in as {me.login}")
|
||||
|
||||
harm_classifier_url, harm_classifier_token = config["harm_classifier_url"], config["harm_classifier_token"]
|
||||
|
||||
script_path = Path(__file__).parent
|
||||
supported_events = ["issue_comment", "issues", "pull_request", "pull_request_review_comment"]
|
||||
ai_notice = f"If you think this is a false-positive, please contact the owner of this repo."
|
||||
|
||||
Reference in New Issue
Block a user