diff options
| author | Dhravya Shah <[email protected]> | 2024-08-05 18:41:55 -0700 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2024-08-05 18:41:55 -0700 |
| commit | 6286b376faa6f9e2f68db7c31a58f5d7076353a9 (patch) | |
| tree | f4c119e873b1e6b0db9a410c3d27356c85a3b210 | |
| parent | Merge branch 'main' of github.com:supermemoryai/supermemory (diff) | |
| download | supermemory-6286b376faa6f9e2f68db7c31a58f5d7076353a9.tar.xz supermemory-6286b376faa6f9e2f68db7c31a58f5d7076353a9.zip | |
optional chaining
| -rw-r--r-- | apps/cf-ai-backend/src/utils/chunkTweet.ts | 4 |
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") |