From 492d1135df2e863c240783f9acc5a093e5b751c3 Mon Sep 17 00:00:00 2001 From: Claude Dev Date: Thu, 26 Mar 2026 20:44:05 +0100 Subject: [PATCH] refactor: Token-Tracking mit source=globe fuer Split-Anzeige UNIQUE-Constraint um source-Spalte erweitert, Globe schreibt jetzt mit source=globe in token_usage_monthly. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/data_vlm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data_vlm.py b/src/data_vlm.py index 33dd6cc..cb8c82f 100644 --- a/src/data_vlm.py +++ b/src/data_vlm.py @@ -480,10 +480,10 @@ async def analyze_image( year_month = datetime.now(timezone.utc).strftime('%Y-%m') await db.execute(""" INSERT INTO token_usage_monthly - (organization_id, year_month, input_tokens, output_tokens, + (organization_id, year_month, source, input_tokens, output_tokens, cache_creation_tokens, cache_read_tokens, total_cost_usd, api_calls, refresh_count) - VALUES (?, ?, ?, ?, ?, ?, ?, 1, 1) - ON CONFLICT(organization_id, year_month) DO UPDATE SET + VALUES (?, ?, 'globe', ?, ?, ?, ?, ?, 1, 1) + ON CONFLICT(organization_id, year_month, source) DO UPDATE SET input_tokens = input_tokens + excluded.input_tokens, output_tokens = output_tokens + excluded.output_tokens, cache_creation_tokens = cache_creation_tokens + excluded.cache_creation_tokens,