Feat/billing enhancement (#2239)

Co-authored-by: takatost <takatost@gmail.com>
This commit is contained in:
Garfield Dai
2024-01-26 18:26:15 +08:00
committed by GitHub
parent 2fc0dcc10a
commit bb5d5fc683
8 changed files with 43 additions and 41 deletions

View File

@@ -33,6 +33,11 @@ def handle(sender, **kwargs):
if quota_unit:
if quota_unit == QuotaUnit.TOKENS:
used_quota = message.message_tokens + message.answer_tokens
elif quota_unit == QuotaUnit.CREDITS:
used_quota = 1
if 'gpt-4' in model_config.model:
used_quota = 20
else:
used_quota = 1