exempts hosted agnai from rate limit

This commit is contained in:
nai-degen 2023-04-09 00:49:14 -05:00 committed by nai-degen
parent 41637aca1b
commit c4f8679bda
2 changed files with 9 additions and 1 deletions

View File

@ -19,7 +19,7 @@ function getInfoPageHtml(host: string) {
uptime: process.uptime(),
timestamp: Date.now(),
baseUrl: host,
kobold: host + "/proxy/kobold",
kobold: host, // kobold doesn't need the suffix
openai: host + "/proxy/openai",
proompts: keylist.reduce((acc, k) => acc + k.promptCount, 0),
...(config.modelRateLimit ? rateLimitInfo : {}),

View File

@ -63,6 +63,14 @@ export const ipLimiter = (req: Request, res: Response, next: NextFunction) => {
return;
}
// Exempt Agnai.chat from rate limiting since it's shared between a lot of
// users. Dunno how to prevent this from being abused without some sort of
// identifier sent from Agnaistic to identify specific users.
if (req.ip === "157.230.249.32") {
next();
return;
}
const { remaining, reset } = getStatus(req.ip);
res.set("X-RateLimit-Limit", config.modelRateLimit.toString());
res.set("X-RateLimit-Remaining", remaining.toString());