adds token consumption stats to infopage

This commit is contained in:
nai-degen
2023-08-30 20:40:40 -05:00
parent bed275a195
commit 2c0a659b2d
7 changed files with 90 additions and 20 deletions
+3 -3
View File
@@ -411,11 +411,11 @@ function handleOpenAIRateLimitError(
const incrementUsage: ProxyResHandlerWithBody = async (_proxyRes, req) => {
if (isCompletionRequest(req)) {
keyPool.incrementPrompt(req.key!);
const model = req.body.model;
const tokensUsed = req.promptTokens! + req.outputTokens!;
keyPool.incrementUsage(req.key!, model, tokensUsed);
if (req.user) {
incrementPromptCount(req.user.token);
const model = req.body.model;
const tokensUsed = req.promptTokens! + req.outputTokens!;
incrementTokenCount(req.user.token, model, tokensUsed);
}
}
-2
View File
@@ -60,8 +60,6 @@ function getModelsResponse() {
const allowed = new Set<ModelFamily>(config.allowedModelFamilies);
available = new Set([...available].filter((x) => allowed.has(x)));
console.log(available);
const models = knownModels
.map((id) => ({
id,