aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhravya Shah <[email protected]>2024-08-05 18:41:55 -0700
committerDhravya Shah <[email protected]>2024-08-05 18:41:55 -0700
commit6286b376faa6f9e2f68db7c31a58f5d7076353a9 (patch)
treef4c119e873b1e6b0db9a410c3d27356c85a3b210
parentMerge branch 'main' of github.com:supermemoryai/supermemory (diff)
downloadsupermemory-6286b376faa6f9e2f68db7c31a58f5d7076353a9.tar.xz
supermemory-6286b376faa6f9e2f68db7c31a58f5d7076353a9.zip
optional chaining
-rw-r--r--apps/cf-ai-backend/src/utils/chunkTweet.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/cf-ai-backend/src/utils/chunkTweet.ts b/apps/cf-ai-backend/src/utils/chunkTweet.ts
index d9c59f24..0d0bc896 100644
--- a/apps/cf-ai-backend/src/utils/chunkTweet.ts
+++ b/apps/cf-ai-backend/src/utils/chunkTweet.ts
@@ -39,7 +39,9 @@ export function chunkThread(threadText: string): TweetChunks {
const chunkedTweet = chunkText(parsedTweet.text, 1536);
const metadata: Metadata = {
tweetId: parsedTweet.id_str,
- tweetLinks: parsedTweet.entities.urls.map((url: any) => url.expanded_url),
+ tweetLinks: parsedTweet.entities?.urls.map(
+ (url: any) => url.expanded_url,
+ ),
tweetVids:
parsedTweet.extended_entities?.media
.filter((media: any) => media.type === "video")