@postalsys/email-ai-tools 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/generate-summary.js +4 -6
- package/package.json +3 -3
package/lib/generate-summary.js
CHANGED
|
@@ -16,13 +16,12 @@ const OPENAI_API_URL = 'https://api.openai.com/v1/chat/completions';
|
|
|
16
16
|
const DEFAULT_ALLOWED_HEADERS = ['from', 'to', 'cc', 'bcc', 'subject', 'mime-version', 'authentication-results', 'date', 'content-type', 'list-id'];
|
|
17
17
|
|
|
18
18
|
const DEFAULT_SYSTEM_PROMPT = `
|
|
19
|
-
I want you to act as an
|
|
19
|
+
I want you to act as an executive assistant that processes emails for reporting.
|
|
20
20
|
`.trim();
|
|
21
21
|
|
|
22
22
|
const DEFAULT_USER_PROMPT = `
|
|
23
23
|
Instructions:
|
|
24
|
-
- You are an executive assistant scanning incoming emails to
|
|
25
|
-
- Your task is to monitor and analyze incoming emails, which consist of the message headers, a list of attachments, and text content
|
|
24
|
+
- You are an executive assistant scanning incoming emails to report what is important and what is not, and also to inform about obvious fraud attempts.
|
|
26
25
|
- Describe the sentiment of the email using one word. Use either "positive", "neutral", or "negative". Include this value in the response as a "sentiment" property.
|
|
27
26
|
- Generate a one-sentence summary of the email. Include this value in the response as a "summary" property.
|
|
28
27
|
- Does it seem like the sender of the email would expect a reply to this email? Include this information in the response as a "shouldReply" property with the value "true" if they expect it and "false" if not.
|
|
@@ -161,9 +160,8 @@ async function generateSummary(message, apiToken, opts) {
|
|
|
161
160
|
}),
|
|
162
161
|
attachments: []
|
|
163
162
|
.concat(message.attachments || [])
|
|
164
|
-
.map(attachment =>
|
|
165
|
-
|
|
166
|
-
)
|
|
163
|
+
.map(attachment => ({ filename: attachment.filename, contentType: attachment.contentType }))
|
|
164
|
+
.filter(attachment => attachment.filename || attachment.contentType)
|
|
167
165
|
};
|
|
168
166
|
|
|
169
167
|
let charactersRemoved = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@postalsys/email-ai-tools",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Email AI tools",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"mailparser": "3.6.5"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@postalsys/email-text-tools": "2.1.
|
|
26
|
+
"@postalsys/email-text-tools": "2.1.1",
|
|
27
27
|
"gpt3-tokenizer": "1.1.5",
|
|
28
28
|
"libmime": "5.2.1",
|
|
29
|
-
"undici": "5.
|
|
29
|
+
"undici": "5.24.0"
|
|
30
30
|
}
|
|
31
31
|
}
|