From 4086d6bd27084068fcad5efd4fca91fe0dba9868 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 18 Jan 2026 16:20:15 +0900 Subject: [PATCH] Limit email body length in prompt context Truncate the email body to a maximum of 2000 characters when adding it to the prompt context to reduce token usage and avoid sending overly large or sensitive content. --- testloader.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/testloader.js b/testloader.js index b48787f..abdbc66 100644 --- a/testloader.js +++ b/testloader.js @@ -1408,7 +1408,13 @@ var test_implements = { // Add an email data to the prompt text context prompt_texts.push(text); - prompt_texts.push(" Body: " + body); // No preview, it is a full text + // The body to reduce token usage and avoid sending overly large/sensitive content. + var bodyForPrompt = body; + var maxBodyLengthForPrompt = 2000; // Keep the body snippet short + if (bodyForPrompt.length > maxBodyLengthForPrompt) { + bodyForPrompt = bodyForPrompt.substring(0, maxBodyLengthForPrompt) + "..."; + } + prompt_texts.push(" Body: " + bodyForPrompt); }, maxCount); outlook.close();