update Error messages and handling

This commit is contained in:
Kush Thaker 2024-07-10 00:10:28 +05:30
parent e72a3693c1
commit 0f4453616d
2 changed files with 3 additions and 7 deletions

View file

@ -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,

View file

@ -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 {