mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-07 08:26:15 +00:00
update Error messages and handling
This commit is contained in:
parent
e72a3693c1
commit
0f4453616d
2 changed files with 3 additions and 7 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue