From 0692ab04546055d505ee0bf2fcfb8d53a55f0a0d Mon Sep 17 00:00:00 2001
From: Hongbo Wu
Date: Fri, 3 May 2024 14:39:12 +0800
Subject: [PATCH] add chapters to the digest email
---
packages/api/src/jobs/ai/create_digest.ts | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/packages/api/src/jobs/ai/create_digest.ts b/packages/api/src/jobs/ai/create_digest.ts
index 3a289b5a2..98ee0488f 100644
--- a/packages/api/src/jobs/ai/create_digest.ts
+++ b/packages/api/src/jobs/ai/create_digest.ts
@@ -564,10 +564,24 @@ const sendPushNotification = async (userId: string, digest: Digest) => {
const sendEmail = async (user: User, digest: Digest) => {
const title = digest.title ?? 'Omnivore digest'
+ const chapters = digest.chapters ?? []
const html = `
- ${title}
+ ${title}
- Transcript
+ Chapters
+
+ ${chapters
+ .map(
+ (chapter) => `
+ -
+ ${chapter.title}
+
+ `
+ )
+ .join('')}
+
+
+ Transcript
${digest.content ?? 'Transcript not available'}
`