fix colection create api (#766)

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-01-23 09:01:24 +08:00
committed by GitHub
parent aab6ee51eb
commit 379673cae1
143 changed files with 40737 additions and 274 deletions

View File

@@ -10,8 +10,10 @@ export const checkDatasetLimit = async ({
freeSize?: number;
insertLen?: number;
}) => {
const { maxSize } = await getTeamDatasetValidSub({ teamId, freeSize });
const usedSize = await getVectorCountByTeamId(teamId);
const [{ maxSize }, usedSize] = await Promise.all([
getTeamDatasetValidSub({ teamId, freeSize }),
getVectorCountByTeamId(teamId)
]);
if (usedSize + insertLen >= maxSize) {
return Promise.reject(`数据库容量不足,无法继续添加。可以在账号页面进行扩容。`);