@realtimex/email-automator 2.3.6 → 2.3.7
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/README.md +11 -1
- package/api/server.ts +2 -2
- package/api/src/services/intelligence.ts +5 -11
- package/dist/api/server.js +2 -2
- package/dist/api/src/services/intelligence.js +3 -8
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -60,7 +60,17 @@ npx @realtimex/email-automator-setup
|
|
|
60
60
|
npx @realtimex/email-automator-deploy
|
|
61
61
|
|
|
62
62
|
# Start Email Automator
|
|
63
|
-
npx @realtimex/email-automator
|
|
63
|
+
npx @realtimex/email-automator --port 3004
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Option 1b: Global Install
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Install globally
|
|
70
|
+
npm install -g @realtimex/email-automator
|
|
71
|
+
|
|
72
|
+
# Then run directly
|
|
73
|
+
email-automator --port 3004
|
|
64
74
|
```
|
|
65
75
|
|
|
66
76
|
### Option 2: Clone and Install
|
package/api/server.ts
CHANGED
|
@@ -69,8 +69,8 @@ app.use('/api', routes);
|
|
|
69
69
|
|
|
70
70
|
// Robust resolution for static assets (dist folder)
|
|
71
71
|
function getDistPath() {
|
|
72
|
-
// 1. Check environment variable override
|
|
73
|
-
if (process.env.ELECTRON_STATIC_PATH && existsSync(process.env.ELECTRON_STATIC_PATH)) {
|
|
72
|
+
// 1. Check environment variable override (must contain index.html)
|
|
73
|
+
if (process.env.ELECTRON_STATIC_PATH && existsSync(join(process.env.ELECTRON_STATIC_PATH, 'index.html'))) {
|
|
74
74
|
return process.env.ELECTRON_STATIC_PATH;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import Instructor from '@instructor-ai/instructor';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import { config } from '../config/index.js';
|
|
5
4
|
import { createLogger } from '../utils/logger.js';
|
|
@@ -48,7 +47,7 @@ export interface EmailContext {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
export class IntelligenceService {
|
|
51
|
-
private client:
|
|
50
|
+
private client: OpenAI | null = null;
|
|
52
51
|
private model: string;
|
|
53
52
|
private isConfigured: boolean = false;
|
|
54
53
|
|
|
@@ -67,16 +66,11 @@ export class IntelligenceService {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
try {
|
|
70
|
-
|
|
69
|
+
this.client = new OpenAI({
|
|
71
70
|
apiKey: apiKey || 'not-needed-for-local', // Placeholder for local LLMs
|
|
72
71
|
baseURL: baseUrl,
|
|
73
72
|
});
|
|
74
73
|
|
|
75
|
-
this.client = Instructor({
|
|
76
|
-
client: oai,
|
|
77
|
-
mode: 'MD_JSON',
|
|
78
|
-
});
|
|
79
|
-
|
|
80
74
|
this.isConfigured = true;
|
|
81
75
|
logger.info('Intelligence service initialized', { model: this.model, baseUrl: baseUrl || 'default' });
|
|
82
76
|
} catch (error) {
|
|
@@ -163,7 +157,7 @@ REQUIRED JSON STRUCTURE:
|
|
|
163
157
|
let rawResponse = '';
|
|
164
158
|
try {
|
|
165
159
|
// Using raw completion call to handle garbage characters and strip tokens manually
|
|
166
|
-
const response = await this.client
|
|
160
|
+
const response = await this.client!.chat.completions.create({
|
|
167
161
|
model: this.model,
|
|
168
162
|
messages: [
|
|
169
163
|
{ role: 'system', content: systemPrompt },
|
|
@@ -223,7 +217,7 @@ REQUIRED JSON STRUCTURE:
|
|
|
223
217
|
}
|
|
224
218
|
|
|
225
219
|
try {
|
|
226
|
-
const response = await this.client
|
|
220
|
+
const response = await this.client!.chat.completions.create({
|
|
227
221
|
model: this.model,
|
|
228
222
|
messages: [
|
|
229
223
|
{
|
|
@@ -257,7 +251,7 @@ Please write a reply.`,
|
|
|
257
251
|
}
|
|
258
252
|
|
|
259
253
|
try {
|
|
260
|
-
await this.client
|
|
254
|
+
await this.client!.chat.completions.create({
|
|
261
255
|
model: this.model,
|
|
262
256
|
messages: [{ role: 'user', content: 'Say "Connection Successful"' }],
|
|
263
257
|
max_tokens: 5,
|
package/dist/api/server.js
CHANGED
|
@@ -58,8 +58,8 @@ app.use('/api', apiRateLimit);
|
|
|
58
58
|
app.use('/api', routes);
|
|
59
59
|
// Robust resolution for static assets (dist folder)
|
|
60
60
|
function getDistPath() {
|
|
61
|
-
// 1. Check environment variable override
|
|
62
|
-
if (process.env.ELECTRON_STATIC_PATH && existsSync(process.env.ELECTRON_STATIC_PATH)) {
|
|
61
|
+
// 1. Check environment variable override (must contain index.html)
|
|
62
|
+
if (process.env.ELECTRON_STATIC_PATH && existsSync(join(process.env.ELECTRON_STATIC_PATH, 'index.html'))) {
|
|
63
63
|
return process.env.ELECTRON_STATIC_PATH;
|
|
64
64
|
}
|
|
65
65
|
// 2. Try to find dist relative to packageRoot (from config)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import Instructor from '@instructor-ai/instructor';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import { config } from '../config/index.js';
|
|
5
4
|
import { createLogger } from '../utils/logger.js';
|
|
@@ -26,7 +25,7 @@ export const EmailAnalysisSchema = z.object({
|
|
|
26
25
|
.describe('Action items mentioned in the email'),
|
|
27
26
|
});
|
|
28
27
|
export class IntelligenceService {
|
|
29
|
-
client;
|
|
28
|
+
client = null;
|
|
30
29
|
model;
|
|
31
30
|
isConfigured = false;
|
|
32
31
|
constructor(overrides) {
|
|
@@ -41,14 +40,10 @@ export class IntelligenceService {
|
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
try {
|
|
44
|
-
|
|
43
|
+
this.client = new OpenAI({
|
|
45
44
|
apiKey: apiKey || 'not-needed-for-local', // Placeholder for local LLMs
|
|
46
45
|
baseURL: baseUrl,
|
|
47
46
|
});
|
|
48
|
-
this.client = Instructor({
|
|
49
|
-
client: oai,
|
|
50
|
-
mode: 'MD_JSON',
|
|
51
|
-
});
|
|
52
47
|
this.isConfigured = true;
|
|
53
48
|
logger.info('Intelligence service initialized', { model: this.model, baseUrl: baseUrl || 'default' });
|
|
54
49
|
}
|
|
@@ -134,7 +129,7 @@ REQUIRED JSON STRUCTURE:
|
|
|
134
129
|
let rawResponse = '';
|
|
135
130
|
try {
|
|
136
131
|
// Using raw completion call to handle garbage characters and strip tokens manually
|
|
137
|
-
const response = await this.client.
|
|
132
|
+
const response = await this.client.chat.completions.create({
|
|
138
133
|
model: this.model,
|
|
139
134
|
messages: [
|
|
140
135
|
{ role: 'system', content: systemPrompt },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realtimex/email-automator",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/api/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@azure/msal-node": "^3.8.5",
|
|
72
|
-
"@instructor-ai/instructor": "^1.7.0",
|
|
73
72
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
74
73
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
75
74
|
"@radix-ui/react-label": "^2.1.8",
|