fixing token_queue, prepping chart view

This commit is contained in:
Alpha Nerd 2025-11-18 19:02:36 +01:00
parent baf5d98318
commit 541f2826e0
3 changed files with 137 additions and 8 deletions

14
db.py
View file

@ -132,3 +132,17 @@ class TokenDatabase:
'total_tokens': row[4],
'timestamp': row[5]
}
async def get_token_counts_for_model(self, model):
"""Get token counts for a specific model."""
async with aiosqlite.connect(self.db_path) as db:
async with db.execute('SELECT endpoint, model, input_tokens, output_tokens, total_tokens FROM token_counts WHERE model = ?', (model,)) as cursor:
async for row in cursor:
return {
'endpoint': row[0],
'model': row[1],
'input_tokens': row[2],
'output_tokens': row[3],
'total_tokens': row[4]
}
return None