From 255a1367adf995cc0bcd79e3f854d178f98fbde0 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 18 Jan 2026 15:46:16 +0900 Subject: [PATCH 1/3] Update OpenAI API key reference in apikey.json Replaces the 'chatgpt' key with 'openai' and updates the corresponding file path to 'openai_apikey.txt' in apikey.json for clarity and consistency. --- data/apikey.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/apikey.json b/data/apikey.json index 95d661c..ba5b59a 100644 --- a/data/apikey.json +++ b/data/apikey.json @@ -1,5 +1,5 @@ { - "chatgpt": "file:data/chatgpt_apikey.txt", + "openai": "file:data/openai_apikey.txt", "anthropic": "file:data/anthropic_apikey.txt", "groq": "file:data/groq_apikey.txt", "grok": "file:data/grok_apikey.txt", From 552bd10e82c15c5fc0a9093ecb76bd4300e3f14f Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 18 Jan 2026 16:12:36 +0900 Subject: [PATCH 2/3] Enhance Outlook test to use AI for email reply suggestions Updated the 'outlook_open_outlook_with_chatgpt' test to search emails by sender or recipient, collect email data, and generate a prompt for AI-based reply suggestions using OpenAI via the language-inference-engine. Improved logging, increased result count, and added full body previews for context. --- testloader.js | 62 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/testloader.js b/testloader.js index f121a0c..b48787f 100644 --- a/testloader.js +++ b/testloader.js @@ -1369,10 +1369,19 @@ var test_implements = { }, "outlook_open_outlook_with_chatgpt": function () { - var keyword = "test"; - var maxCount = 1; + // Process: Microsoft Outlook -> OpenAI -> Get Response + var Office = require("lib/msoffice"); + var LIE = require("lib/language-inference-engine"); + + var prompt_texts = []; + + var keyword = "example.com"; + var maxCount = 10; + var previewLen = 160; - console.log("Running an end-to-end Outlook automation test."); + console.log("Searching mails by sender OR recipient contains: '" + keyword + "'."); + console.log("This test uses Restrict (Sender/To/CC/BCC) + Recipients verification."); + console.log("Body preview length: " + previewLen); var Office = require("lib/msoffice"); @@ -1380,24 +1389,43 @@ var test_implements = { outlook.open(); outlook.selectFolder(Office.Outlook.Folders.Inbox); - console.log("Searching mails by subject contains: '" + keyword + "'."); - var results = outlook.searchSubjectContains(keyword); + var results = outlook.searchBySenderOrRecipientContains(keyword); + console.log("Printing search results. (max " + maxCount + ")"); - var found = false; - results.forEach(function (m) { - found = true; - console.log("Subject: " + String(m.getSubject())); - console.log("From: " + String(m.getSenderEmailAddress())); - console.log("Body preview:"); - console.log(String(m.getBody() || "").substr(0, 200)); + results.forEach(function (m, i) { + var body = String(m.getBody() || ""); + var preview = body.replace(/\r/g, "").replace(/\n+/g, " ").substr(0, previewLen); + + var text = "#" + String(i) + + " | From: " + String(m.getSenderEmailAddress()) + + " | To: " + String(m.mail.To || "") + + " | Subject: " + String(m.getSubject()) + + " | Received: " + String(m.getReceivedTime()); + + console.log(text); + console.log(" Body: " + preview); + + // 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 }, maxCount); - console.log(found ? - "End-to-end test executed successfully." : - "No matching mail found; end-to-end test could not complete."); - outlook.close(); - console.log("End-to-end Outlook test completed."); + + // build a AI prompt text + var instruction_text = "This is an email exchange between the buyer and me, and I would appreciate it if you could help me write the most appropriate reply."; + prompt_texts.push(instruction_text); + + // complete the prompt text + var prompt_text_completed = prompt_texts.join("\r\n"); + + //console.log(prompt_text_completed); // print all prompt text + + // get a response from AI + var response_text = LIE.create().setProvider("openai").inference(prompt_text_completed, 0).join(' '); + + console.log(response_text); } }; From 4086d6bd27084068fcad5efd4fca91fe0dba9868 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sun, 18 Jan 2026 16:20:15 +0900 Subject: [PATCH 3/3] 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();