fix: enforce security profile language across DAVE
This commit is contained in:
@@ -44,6 +44,24 @@ test('Telegram AI chat reports missing LLM configuration', async () => {
|
||||
assert.match(await assistant.reply('hello', { chatId: 1 }), /unavailable/i);
|
||||
});
|
||||
|
||||
test('Telegram AI chat enforces the encrypted profile language in provider prompts', async () => {
|
||||
const calls = [];
|
||||
const assistant = new TelegramChatAssistant({
|
||||
provider: {
|
||||
isConfigured: true,
|
||||
async complete(systemPrompt, userMessage) {
|
||||
calls.push({ systemPrompt, userMessage });
|
||||
return { text: 'Antwort auf Deutsch.' };
|
||||
},
|
||||
},
|
||||
getPreferredLanguage: () => 'de',
|
||||
});
|
||||
|
||||
assert.equal(await assistant.reply('Kurzer Lagecheck', { chatId: 42 }), 'Antwort auf Deutsch.');
|
||||
assert.match(calls[0].systemPrompt, /REQUIRED RESPONSE LANGUAGE: German \(de\)/);
|
||||
assert.match(calls[0].userMessage, /All user-visible prose in the final answer must be German/);
|
||||
});
|
||||
|
||||
test('Telegram chat context is compact and operationally useful', () => {
|
||||
const context = JSON.parse(buildTelegramChatContext({
|
||||
meta: { generatedAt: '2026-07-05T10:00:00Z' },
|
||||
|
||||
Reference in New Issue
Block a user