diff options
| author | Dhravya Shah <[email protected]> | 2024-07-27 11:46:46 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-07-27 11:46:46 -0500 |
| commit | e5f26d894a02cdc09cd3cbec9efb572ca04004e4 (patch) | |
| tree | ba1dce3b6e2a151cfcd831afe8022215527b3e40 /apps/web | |
| parent | Merge pull request #175 from aryankeluskar/main (diff) | |
| parent | fix tweets and sources (diff) | |
| download | supermemory-e5f26d894a02cdc09cd3cbec9efb572ca04004e4.tar.xz supermemory-e5f26d894a02cdc09cd3cbec9efb572ca04004e4.zip | |
Merge pull request #181 from supermemoryai/kush/fix-threads
fix tweets and sources
Diffstat (limited to 'apps/web')
| -rw-r--r-- | apps/web/app/actions/doers.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/web/app/actions/doers.ts b/apps/web/app/actions/doers.ts index ff0ed5d9..de042cec 100644 --- a/apps/web/app/actions/doers.ts +++ b/apps/web/app/actions/doers.ts @@ -236,7 +236,6 @@ export const createMemory = async (input: { try { const cf_thread_endpoint = process.env.THREAD_CF_WORKER; const authKey = process.env.THREAD_CF_AUTH; - const threadRequest = await fetch(cf_thread_endpoint, { method: "POST", headers: { @@ -253,6 +252,12 @@ export const createMemory = async (input: { } thread = await threadRequest.text(); + if (thread.trim().length === 2) { + console.log("Thread is an empty array"); + throw new Error( + "[THREAD FETCHING SERVICE] Got no content form thread worker", + ); + } } catch (e) { console.log("[THREAD FETCHING SERVICE] Failed to fetch the thread", e); errorOccurred = true; @@ -263,7 +268,7 @@ export const createMemory = async (input: { pageContent = tweetToMd(tweet); console.log("THis ishte page content!!", pageContent); //@ts-ignore - vectorData = errorOccurred ? pageContent : thread; + vectorData = errorOccurred ? JSON.stringify(pageContent) : thread; metadata = { baseUrl: input.content, description: tweet.text.slice(0, 200), |