Increase meme funniness requirements
This commit is contained in:
@@ -27,22 +27,24 @@ test('queues uploads when AI moderation is not configured', async () => {
|
||||
|
||||
test('queues model approvals below the auto-publish quality threshold', async () => {
|
||||
const originalApiKey = process.env.OPENAI_API_KEY;
|
||||
const originalThreshold = process.env.AUTO_APPROVE_MIN_SCORE;
|
||||
const originalFetch = globalThis.fetch;
|
||||
process.env.OPENAI_API_KEY = 'test-key';
|
||||
process.env.AUTO_APPROVE_MIN_SCORE = '90';
|
||||
|
||||
globalThis.fetch = async (_url, options) => {
|
||||
const body = JSON.parse(options.body);
|
||||
const prompt = body.input[0].content.find((item) => item.type === 'input_text').text;
|
||||
|
||||
assert.match(prompt, /could the exact same caption work on 50 unrelated images/);
|
||||
assert.match(prompt, /Use approved only when it appears legal and score is at least 80/);
|
||||
assert.match(prompt, /Use approved only when it appears legal and score is at least 90/);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
json: async () => ({
|
||||
output_text: JSON.stringify({
|
||||
decision: 'approved',
|
||||
score: 79,
|
||||
score: 89,
|
||||
reason: 'Specific joke, but not strong enough.'
|
||||
})
|
||||
})
|
||||
@@ -56,7 +58,7 @@ test('queues model approvals below the auto-publish quality threshold', async ()
|
||||
});
|
||||
|
||||
assert.equal(moderation.status, 'pending');
|
||||
assert.equal(moderation.score, 79);
|
||||
assert.equal(moderation.score, 89);
|
||||
assert.match(moderation.reason, /Low MEME_CONSENSUS_SCORE queued for review/);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
@@ -65,5 +67,10 @@ test('queues model approvals below the auto-publish quality threshold', async ()
|
||||
} else {
|
||||
process.env.OPENAI_API_KEY = originalApiKey;
|
||||
}
|
||||
if (originalThreshold === undefined) {
|
||||
delete process.env.AUTO_APPROVE_MIN_SCORE;
|
||||
} else {
|
||||
process.env.AUTO_APPROVE_MIN_SCORE = originalThreshold;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user