mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 06:59:03 +08:00
feat(v1/checkCredits): say "tokens" instead of "credits" if out of tokens (#1178)
* feat(v1/checkCredits): say "tokens" instead of "credits" if out of tokens * feat(v1/checkCredits): better instructions for upgrade
This commit is contained in:
parent
582bbf8da4
commit
1d9a0b9653
@ -48,8 +48,9 @@ function checkCreditsMiddleware(
|
|||||||
req.acuc = chunk;
|
req.acuc = chunk;
|
||||||
}
|
}
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
const currencyName = req.acuc.is_extract ? "tokens" : "credits"
|
||||||
logger.error(
|
logger.error(
|
||||||
`Insufficient credits: ${JSON.stringify({ team_id: req.auth.team_id, minimum, remainingCredits })}`,
|
`Insufficient ${currencyName}: ${JSON.stringify({ team_id: req.auth.team_id, minimum, remainingCredits })}`,
|
||||||
{
|
{
|
||||||
teamId: req.auth.team_id,
|
teamId: req.auth.team_id,
|
||||||
minimum,
|
minimum,
|
||||||
@ -62,7 +63,7 @@ function checkCreditsMiddleware(
|
|||||||
return res.status(402).json({
|
return res.status(402).json({
|
||||||
success: false,
|
success: false,
|
||||||
error:
|
error:
|
||||||
"Insufficient credits to perform this request. For more credits, you can upgrade your plan at https://firecrawl.dev/pricing or try changing the request limit to a lower value.",
|
"Insufficient " + currencyName + " to perform this request. For more " + currencyName + ", you can upgrade your plan at " + (currencyName === "credits" ? "https://firecrawl.dev/pricing or try changing the request limit to a lower value" : "https://www.firecrawl.dev/extract#pricing") + ".",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user