diff options
| author | Kush Thaker <[email protected]> | 2024-07-27 22:11:10 +0530 |
|---|---|---|
| committer | Kush Thaker <[email protected]> | 2024-07-27 22:11:10 +0530 |
| commit | e8b623333def214e0ed55609f6c0b80deae17f48 (patch) | |
| tree | 63e4c845d65e7b34d9d578f7c00ba56c82dad5d0 /apps/web | |
| parent | Merge pull request #140 from supermemoryai/kush/experimental-thread (diff) | |
| download | supermemory-kush/fix-threads.tar.xz supermemory-kush/fix-threads.zip | |
fix tweets and sourceskush/fix-threads
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 da2bfb5f..eaaaafbd 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), |