Add commenter targeting mode
This commit is contained in:
1 parent
0dfdda61fd
commit
e9a4c965ee
23 files changed
+374
-10
No files matched your search
@@ -135,6 +135,24 @@ describe('OpenRouterClient', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('screenCommentReactions', () => {
|
||||
it('parses batched reaction verdicts and fences comments as untrusted data', async () => {
|
||||
mockCreate.mockResolvedValueOnce({
|
||||
model: 'chat-model', usage: {},
|
||||
choices: [{ message: { content: '{"results":[{"id":"t1_a","qualifies":true,"expressedGender":"female","confidence":0.92,"evidence":"wants the depicted role"}]}' } }],
|
||||
});
|
||||
|
||||
await expect(client.screenCommentReactions([
|
||||
{ id: 't1_a', text: "I'd love that to be done to me" },
|
||||
])).resolves.toEqual([
|
||||
{ id: 't1_a', qualifies: true, expressedGender: 'female', confidence: 0.92, evidence: 'wants the depicted role' },
|
||||
]);
|
||||
const request = mockCreate.mock.calls[0][0];
|
||||
expect(request.temperature).toBe(0);
|
||||
expect(request.messages[1].content).toContain('<<<UNTRUSTED COMMENT>>>');
|
||||
});
|
||||
});
|
||||
|
||||
describe('isRefusal (internal)', () => {
|
||||
// We test refusal detection by checking the analyzeImage behavior
|
||||
// since isRefusal is private. We do this by mocking responses that
|
||||
@@ -638,6 +656,17 @@ describe('OpenRouterClient', () => {
|
||||
expect(prompt).toContain('different opening words');
|
||||
});
|
||||
|
||||
it('states that a comment-target recipient is not the person depicted', async () => {
|
||||
mockCreate.mockResolvedValueOnce({ choices: [{ message: { content: 'That comment caught my attention.' } }] });
|
||||
await client.generateMessage(
|
||||
'Analysis', 'Title', 'Commenter', [], undefined, null, null, undefined, [],
|
||||
'<<<UNTRUSTED PUBLIC COMMENT>>>\nI want that too\n<<<END COMMENT>>>',
|
||||
);
|
||||
const prompt = mockCreate.mock.calls[0][0].messages[0].content as string;
|
||||
expect(prompt).toContain('The recipient commented on somebody else\'s post');
|
||||
expect(prompt).toContain('Do not imply that the image depicts the recipient');
|
||||
});
|
||||
|
||||
it('substitutes {rating} placeholder when score provided', async () => {
|
||||
const cfg = getTestConfig({
|
||||
openrouter: {
|
||||
|
||||
Reference in new issue
Block a user