mirror of
https://github.com/arc53/DocsGPT
synced 2024-11-17 21:26:26 +00:00
fix: skip logging to db during tests
This commit is contained in:
parent
77991896b4
commit
1b61337b75
@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from pymongo import MongoClient
|
||||
from datetime import datetime
|
||||
from application.core.settings import settings
|
||||
@ -9,6 +10,8 @@ usage_collection = db["token_usage"]
|
||||
|
||||
|
||||
def update_token_usage(api_key, token_usage):
|
||||
if "pytest" in sys.modules:
|
||||
return
|
||||
usage_data = {
|
||||
"api_key": api_key,
|
||||
"prompt_tokens": token_usage["prompt_tokens"],
|
||||
|
Loading…
Reference in New Issue
Block a user