Increase meme funniness requirements
This commit is contained in:
+11
-3
@@ -1,5 +1,5 @@
|
||||
const DEFAULT_MODEL = process.env.OPENAI_MODERATION_MODEL || 'gpt-4o-mini';
|
||||
const AUTO_APPROVE_MIN_SCORE = 80;
|
||||
const DEFAULT_AUTO_APPROVE_MIN_SCORE = 80;
|
||||
|
||||
export async function moderateImage({ buffer, mime }) {
|
||||
if (!process.env.OPENAI_API_KEY) {
|
||||
@@ -59,6 +59,7 @@ export async function moderateImage({ buffer, mime }) {
|
||||
}
|
||||
|
||||
function moderationPrompt() {
|
||||
const autoApproveMinScore = autoApproveMinScoreValue();
|
||||
return [
|
||||
'You are moderating image uploads for THE_MEME_PROTOCOL, a meme gallery.',
|
||||
'This is a meme site. Images may be sarcastic, roasting, edgy, political, profane, absurd, or not PG-13.',
|
||||
@@ -72,7 +73,7 @@ function moderationPrompt() {
|
||||
'Assign MEME_CONSENSUS_SCORE from 0-100: higher means it is legal, clearly a meme/reaction/roast/remix, visually meaningful, has a real punchline, and is suitable for this site; lower means random photo, spam, ad, QR scam, screenshot dump, unclear, generic template caption, text-only joke, weak payoff, or AI-slop.',
|
||||
'Return only compact JSON with keys: decision, score, reason.',
|
||||
'decision must be one of: approved, pending, rejected.',
|
||||
`Use approved only when it appears legal and score is at least ${AUTO_APPROVE_MIN_SCORE}.`,
|
||||
`Use approved only when it appears legal and score is at least ${autoApproveMinScore}.`,
|
||||
'Use pending for ambiguity, uncertainty, low meme relevance, weak quality, generic/slop memes, or anything that needs human review.',
|
||||
'Use rejected only for likely illegal content.'
|
||||
].join('\n');
|
||||
@@ -100,12 +101,19 @@ function normalizeDecision(raw) {
|
||||
? raw.reason.trim().slice(0, 300)
|
||||
: 'No moderation reason supplied.';
|
||||
|
||||
if (decision === 'approved' && score < AUTO_APPROVE_MIN_SCORE) {
|
||||
const autoApproveMinScore = autoApproveMinScoreValue();
|
||||
if (decision === 'approved' && score < autoApproveMinScore) {
|
||||
return { status: 'pending', score, reason: `${reason} Low MEME_CONSENSUS_SCORE queued for review.` };
|
||||
}
|
||||
return { status: decision, score, reason };
|
||||
}
|
||||
|
||||
function autoApproveMinScoreValue() {
|
||||
const value = Number.parseInt(process.env.AUTO_APPROVE_MIN_SCORE || '', 10);
|
||||
if (!Number.isFinite(value)) return DEFAULT_AUTO_APPROVE_MIN_SCORE;
|
||||
return Math.max(0, Math.min(100, value));
|
||||
}
|
||||
|
||||
function extractOutputText(payload) {
|
||||
const parts = [];
|
||||
for (const item of payload.output || []) {
|
||||
|
||||
Reference in New Issue
Block a user