From 0f4453616d9ba684fb53c359cf775718f4ba938b Mon Sep 17 00:00:00 2001 From: Kush Thaker Date: Wed, 10 Jul 2024 00:10:28 +0530 Subject: [PATCH] update Error messages and handling --- apps/cf-ai-backend/src/index.ts | 2 +- apps/web/app/actions/doers.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/apps/cf-ai-backend/src/index.ts b/apps/cf-ai-backend/src/index.ts index a434d5b5..0844c22e 100644 --- a/apps/cf-ai-backend/src/index.ts +++ b/apps/cf-ai-backend/src/index.ts @@ -66,7 +66,7 @@ app.post("/api/add", zValidator("json", vectorObj), async (c) => { console.log(body.spaces); const chunks = chunkText(body.pageContent, 1536); if (chunks.length > 20) { - return c.json({ status: "error", message: "no chunks over 20" }); + return c.json({ status: "error", message: "We are unable to process documents this size just yet, try something smaller" }); } const chunkedInput = await batchCreateChunksAndEmbeddings({ store, diff --git a/apps/web/app/actions/doers.ts b/apps/web/app/actions/doers.ts index 6ce8c230..fcbab0f8 100644 --- a/apps/web/app/actions/doers.ts +++ b/apps/web/app/actions/doers.ts @@ -270,15 +270,11 @@ export const createMemory = async (input: { try { if (response.status !== "ok") { - if ( - response.status === "error" && - response.message === "no chunks over 20" - ) { + if (response.status === "error") { return { success: false, data: 0, - error: - "We are unable to process documents this size just yet, try something smaller", + error: response.message, }; } else { return {