correctly flags trial keys during startup even if over quota

This commit is contained in:
nai-degen 2023-07-20 23:06:37 -05:00
parent aa5380d2ef
commit 77c2309b52
1 changed files with 6 additions and 0 deletions

View File

@ -202,6 +202,12 @@ export class OpenAIKeyChecker {
GET_SUBSCRIPTION_URL,
{ headers: { Authorization: `Bearer ${key.key}` } }
);
// See note above about updating the key's `lastChecked` timestamp.
const keyFromPool = this.keys.find((k) => k.hash === key.hash)!;
this.updateKey(key.hash, {
isTrial: !data.has_payment_method,
lastChecked: keyFromPool.lastChecked,
});
return data;
}