Prevent location matching in bot messages

This commit is contained in:
jjbrunton committed 2026-08-09 14:37:23 +01:00
1 parent c21932389e
commit d5ebdec076
8 files changed
+112 -2

No files matched your search

+19
View File
@@ -644,6 +644,25 @@ describe('OpenRouterClient', () => {
expect(callArgs.max_tokens).toBe(300);
expect(callArgs.temperature).toBe(0.8);
});
it('rejects a reply that implies the recipient is nearby', async () => {
mockCreate.mockResolvedValueOnce({
choices: [{ message: { content: "I'm in Manchester too, we're really close." } }],
});
await expect(client.generateReply([], 'user')).rejects.toThrow('output safeguards');
});
});
describe('generateChatOpener', () => {
it('rejects an opener that mirrors the recipient location', async () => {
mockCreate.mockResolvedValueOnce({
choices: [{ message: { content: "I'm also in London, fancy meeting up?" } }],
});
await expect(client.generateChatOpener('London chat', '', 'user', 'female'))
.rejects.toThrow('location and meeting safeguards');
});
});
describe('analyzeAndGenerateMessage', () => {