Skip to content

Commit 5d3a605

Browse files
author
Shaurya Singh
committed
fix: Use gpt-4o-mini (50x cheaper) and fix email from address to use verified domain
1 parent 36e8ed0 commit 5d3a605

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/ai/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function generateText(
2929
const client = getOpenAIClient();
3030

3131
const {
32-
model = 'gpt-4-turbo-preview',
32+
model = 'gpt-4o-mini',
3333
temperature = 0.7,
3434
maxTokens = 4000,
3535
} = options;

src/analysis/pipeline.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ async function sendJobNotifications(
123123
jobId: string
124124
): Promise<void> {
125125
try {
126+
console.log(`📬 Checking notifications for job ${jobId}, repo ${repoId}, user ${userId}`);
127+
126128
// Get repo settings
127129
const settingsResult = await db.query(
128130
`SELECT rs.*, r.full_name
@@ -132,16 +134,23 @@ async function sendJobNotifications(
132134
[repoId]
133135
);
134136

135-
if (settingsResult.rows.length === 0) return;
137+
if (settingsResult.rows.length === 0) {
138+
console.log('⚠️ No repo_settings found for repo:', repoId);
139+
return;
140+
}
136141

137142
const settings = settingsResult.rows[0];
143+
console.log(`📬 Settings found: notify_email=${settings.notify_email}, schedule=${settings.schedule}`);
138144

139145
// Get user email
140146
const userResult = await db.query('SELECT email FROM users WHERE id = $1', [userId]);
141147
const userEmail = userResult.rows[0]?.email;
148+
console.log(`📬 User email: ${userEmail || 'NOT FOUND'}`);
142149

143150
// Send email notification
144151
if (settings.notify_email && userEmail) {
152+
console.log(`📧 Email notifications enabled, preparing to send to ${userEmail}...`);
153+
145154
// Fetch the maintainer_brief output for this job
146155
const briefResult = await db.query(
147156
`SELECT content_markdown FROM analysis_outputs
@@ -150,6 +159,7 @@ async function sendJobNotifications(
150159
);
151160

152161
const maintainerBrief = briefResult.rows[0]?.content_markdown || '';
162+
console.log(`📧 Maintainer brief content length: ${maintainerBrief.length} chars`);
153163

154164
// Build rich email with extracted content
155165
const briefData: WeeklyBriefData = {
@@ -167,10 +177,15 @@ async function sendJobNotifications(
167177
schedule: settings.schedule || 'weekly',
168178
};
169179

180+
console.log(`📧 Email data prepared: TL;DR items=${briefData.tldr.length}, Risky=${briefData.riskyChanges.length}, Actions=${briefData.suggestedActions.length}`);
181+
170182
const { subject, html } = buildWeeklyBriefEmail(briefData);
183+
console.log(`📧 Email built, subject: "${subject}", HTML length: ${html.length} chars`);
171184

172185
await sendHtmlEmail(userEmail, subject, html);
173186
console.log(`📧 Rich email notification sent to ${userEmail} for ${settings.full_name}`);
187+
} else {
188+
console.log(`📧 Skipping email: notify_email=${settings.notify_email}, userEmail=${userEmail || 'NOT SET'}`);
174189
}
175190

176191
// Send Slack notification (basic for now)

src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const configSchema = z.object({
3939

4040
// Email (Resend)
4141
RESEND_API_KEY: z.string().optional(),
42-
FROM_EMAIL: z.string().default('RepoMind <onboarding@resend.dev>'),
42+
FROM_EMAIL: z.string().default('RepoMind <[email protected].dev>'),
4343

4444
// Rate Limiting
4545
RATE_LIMIT_MAX: z.string().transform(Number).default('100'),

0 commit comments

Comments
 (0)