diff --git a/front/components/trackers/TrackerBuilder.tsx b/front/components/trackers/TrackerBuilder.tsx index 51db7e1fa8c5e..66ad88daa5a45 100644 --- a/front/components/trackers/TrackerBuilder.tsx +++ b/front/components/trackers/TrackerBuilder.tsx @@ -1,5 +1,6 @@ import { Button, + Checkbox, Chip, DropdownMenu, DropdownMenuContent, @@ -79,6 +80,7 @@ export const TrackerBuilder = ({ promptError: null, frequency: TRACKER_FREQUENCIES[0].value, frequencyError: null, + skipEmptyEmails: true, recipients: "", recipientsError: null, modelId: CLAUDE_3_5_SONNET_DEFAULT_MODEL_CONFIG.modelId, @@ -178,6 +180,7 @@ export const TrackerBuilder = ({ providerId: tracker.providerId, temperature: tracker.temperature, frequency: tracker.frequency, + skipEmptyEmails: tracker.skipEmptyEmails, recipients: tracker.recipients ? extractEmails(tracker.recipients) : [], maintainedDataSources: Object.values(tracker.maintainedDataSources).map( (ds) => dataSourceToPayload(ds, owner.sId) @@ -536,6 +539,31 @@ export const TrackerBuilder = ({ /> +
+
+
+
+
+
+ { + setTracker((t) => ({ + ...t, + skipEmptyEmails: !t.skipEmptyEmails, + })); + if (!edited) { + setEdited(true); + } + }} + /> +
+ Send the email only if there's suggested changes. +
+
+
+
{/* DataSource Configurations Settings */} diff --git a/front/lib/api/tracker.ts b/front/lib/api/tracker.ts index 4d7aa182c5f81..38627bf4f6c67 100644 --- a/front/lib/api/tracker.ts +++ b/front/lib/api/tracker.ts @@ -45,12 +45,14 @@ export const processTrackerNotification = async ({ // Send the tracker email(s). const generations = tracker.generations || []; - await sendTrackerEmail({ - name: tracker.name, - recipients: tracker.recipients, - generations, - localLogger, - }); + if (generations.length > 0 || !tracker.skipEmptyEmails) { + await sendTrackerEmail({ + name: tracker.name, + recipients: tracker.recipients, + generations, + localLogger, + }); + } // Consume the tracker & associated generations. await TrackerConfigurationResource.consumeGenerations({ @@ -108,7 +110,7 @@ const _sendTrackerDefaultEmail = async ({ subject: `[Dust] Tracker ${name} check complete: No updates required.`, body: `

Tracker: ${name}.

-

No changes detected in watched documents. All maintained documents are current

+

No changes detected in watched documents. All maintained documents are up to date.

`, }); }; diff --git a/front/lib/models/doc_tracker.ts b/front/lib/models/doc_tracker.ts index 21caf78da2ccc..0fb1e7e37a084 100644 --- a/front/lib/models/doc_tracker.ts +++ b/front/lib/models/doc_tracker.ts @@ -27,6 +27,7 @@ export class TrackerConfigurationModel extends SoftDeletableModel