mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-02-05 16:11:58 +00:00
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.
This commit is contained in:
parent
552bd10e82
commit
4086d6bd27
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user