diff --git a/src/antigravity_provider/router/web/server.py b/src/antigravity_provider/router/web/server.py index 5d473e1..5321228 100644 --- a/src/antigravity_provider/router/web/server.py +++ b/src/antigravity_provider/router/web/server.py @@ -78,7 +78,7 @@ def health_check(): def sanitize_snapshot(snap_dict: Any) -> Any: import re secret_patterns = [ - re.compile(r'(access_token|refresh_token|api_key|token|password|secret|key)=([^\s&,"]+)', re.IGNORECASE), + re.compile(r'((?:access_token|refresh_token|api_key|token|password|secret|key)=)([^\s&,"]+)', re.IGNORECASE), re.compile(r'(sk-[a-zA-Z0-9_\-]{8,})'), re.compile(r'(gho_[a-zA-Z0-9_\-]{8,})'), re.compile(r'(Bearer\s+)([a-zA-Z0-9_\-\.]{8,})', re.IGNORECASE), @@ -88,7 +88,7 @@ def sanitize_snapshot(snap_dict: Any) -> Any: res = val for pat in secret_patterns: if pat.groups == 2: - res = pat.sub(r'\1=***', res) + res = pat.sub(r'\g<1>***', res) elif pat.groups == 1: res = pat.sub(r'***', res) return res diff --git a/src/antigravity_provider/router/web/static/app.js b/src/antigravity_provider/router/web/static/app.js index 0c5337f..9258cb0 100644 --- a/src/antigravity_provider/router/web/static/app.js +++ b/src/antigravity_provider/router/web/static/app.js @@ -777,15 +777,20 @@ function renderAnalyticsView() { // KPI 4: Tokens (Honesty rule: null means N/D, never 0) const tokensEl = document.getElementById('analytics-tokens-total'); const tokensSubEl = document.getElementById('analytics-tokens-sub'); + const hasTokens = global.total_tokens !== null && global.total_tokens !== undefined; if (tokensEl) { - if (global.total_tokens !== null && global.total_tokens !== undefined) { + if (hasTokens) { tokensEl.textContent = global.total_tokens.toLocaleString('ru-RU'); } else { tokensEl.textContent = 'Н/Д'; } } if (tokensSubEl) { - tokensSubEl.textContent = 'Н/Д: провайдеры не отдают данные о токенах'; + if (hasTokens) { + tokensSubEl.textContent = 'Учитывается провайдером'; + } else { + tokensSubEl.textContent = 'Н/Д: провайдеры не отдают данные о токенах'; + } } // Providers Table