Skip to content

Commit

Permalink
Don't run AI rules on cold emails
Browse files Browse the repository at this point in the history
  • Loading branch information
elie222 committed Dec 30, 2024
1 parent a00d8e6 commit 65bf338
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/web/app/api/ai/cold-email/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export async function runColdEmailBlocker(options: {
const response = await isColdEmail(options);
if (response.isColdEmail)
await blockColdEmail({ ...options, aiReason: response.aiReason || null });
return response;
}

async function blockColdEmail(options: {
Expand Down
7 changes: 6 additions & 1 deletion apps/web/app/api/google/webhook/process-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ async function processHistoryItem(
snippet: message.snippet,
});

await runColdEmailBlocker({
const response = await runColdEmailBlocker({
hasPreviousEmail,
email: {
from: message.headers.from,
Expand All @@ -386,6 +386,11 @@ async function processHistoryItem(
gmail,
user,
});

if (response.isColdEmail) {
logger.info("Skipping. Cold email detected.");
return;
}
}

// categorize a sender if we haven't already
Expand Down

0 comments on commit 65bf338

Please sign in to comment.