From e3f7c4f1fc4488e14b4b132b7ffefa4efecda5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82?= Date: Thu, 30 Jul 2026 19:08:18 +0200 Subject: [PATCH] feat: AI generates its own warning message, 250 tokens --- .github/workflows/ai-moderator.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ai-moderator.yml b/.github/workflows/ai-moderator.yml index 3d96402..9514dc2 100644 --- a/.github/workflows/ai-moderator.yml +++ b/.github/workflows/ai-moderator.yml @@ -40,6 +40,7 @@ jobs: const prompt = [ 'You are a community moderator for the Antergos NeXT project.', + 'Be concise and professional. When you warn someone, be direct but not rude.', '', 'Code of Conduct:', coc, @@ -47,12 +48,12 @@ jobs: 'Contributing Guidelines:', contributing, '', - 'Analyze the following content for violations of this Code of Conduct.', + 'Analyze the following content for violations.', 'Respond with ONLY valid JSON - no markdown, no backticks, no explanation.', '', - '{"violation": true/false, "reason": "short reason or empty", "severity": 1-10}', + '{"violation": true/false, "message": "warning message if violation else empty", "severity": 1-10}', '', - 'Content:', + 'Content to analyze:', content ].join('\n'); @@ -73,7 +74,7 @@ jobs: { role: 'user', content: prompt } ], temperature: 0.1, - max_tokens: 150 + max_tokens: 250 }) }); @@ -98,23 +99,12 @@ jobs: return; } - const warning = [ - '**AI Moderator Notice**', - '', - 'Your comment appears to violate the project\'s ' + - '[Code of Conduct](' + context.serverUrl + '/' + context.repo.owner + '/' + context.repo.repo + '/blob/master/.github/CODE_OF_CONDUCT.md).', - '', - 'Reason: ' + decision.reason, - '', - 'Please keep discussions respectful and constructive. Repeated violations may result in moderation actions.' - ].join('\n'); - try { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumber, - body: warning + body: decision.message }); await github.rest.issues.addLabels({