From 4c009bf034bead865bdc64fb4746364008a241e7 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Sun, 21 Jan 2024 09:55:15 +0100 Subject: [PATCH] enh: better quota error (#3346) --- .../data_sources/[name]/documents/[documentId]/index.ts | 8 ++++++-- .../data_sources/[name]/documents/[documentId]/index.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts b/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts index 080444747fda..cdd4ab9e4938 100644 --- a/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts +++ b/front/pages/api/v1/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts @@ -222,7 +222,8 @@ async function handler( api_error: { type: "data_source_quota_error", message: - "Data sources are limited to 32 documents on our free plan. Contact team@dust.tt if you want to increase this limit.", + `Data sources are limited to ${plan.limits.dataSources.documents.count} ` + + `documents on your current plan. Contact team@dust.tt if you want to increase this limit.`, }, }); } @@ -238,7 +239,10 @@ async function handler( api_error: { type: "data_source_quota_error", message: - "Data sources document upload size is limited to 1MB. Contact team@dust.tt if you want to increase it.", + `Data sources document upload size is limited to ` + + `${plan.limits.dataSources.documents.sizeMb}MB on your current plan. ` + + `You are attempting to upload ${fullText.length} bytes. ` + + `Contact team@dust.tt if you want to increase it.`, }, }); } diff --git a/front/pages/api/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts b/front/pages/api/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts index 0889659b0424..3a9a601a15e4 100644 --- a/front/pages/api/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts +++ b/front/pages/api/w/[wId]/data_sources/[name]/documents/[documentId]/index.ts @@ -164,7 +164,8 @@ async function handler( api_error: { type: "data_source_quota_error", message: - "Data sources are limited to 32 documents on our free plan. Contact team@dust.tt if you want to increase this limit.", + `Data sources are limited to ${plan.limits.dataSources.documents.count} ` + + `documents on your current plan. Contact team@dust.tt if you want to increase this limit.`, }, }); } @@ -180,7 +181,10 @@ async function handler( api_error: { type: "data_source_quota_error", message: - "Data sources document upload size is limited to 1MB. Contact team@dust.tt if you want to increase it.", + `Data sources document upload size is limited to ` + + `${plan.limits.dataSources.documents.sizeMb}MB on your current plan. ` + + `You are attempting to upload ${fullText.length} bytes. ` + + `Contact team@dust.tt if you want to increase it.`, }, }); }