feat: Credits-System — Token-Usage-Router, Budget-Verwaltung, Frontend-Übersicht
- Neuer Router /api/token-usage mit Overview, Org-Detail, Monatsstatistik - Budget-Felder (credits_total, cost_per_credit, token_budget_usd) bei Lizenz-Erstellung - Token-Nutzung Sub-Tab in Org-Detail mit Verbrauchsbalken und Monatstabelle - Dashboard Stat-Card für API-Kosten gesamt - CSS Dark-Theme Styling für Token-Komponenten
Dieser Commit ist enthalten in:
@@ -58,9 +58,11 @@ async def create_license(
|
||||
valid_until = (now + timedelta(days=365)).isoformat()
|
||||
|
||||
cursor = await db.execute(
|
||||
"""INSERT INTO licenses (organization_id, license_type, max_users, valid_from, valid_until, status)
|
||||
VALUES (?, ?, ?, ?, ?, 'active')""",
|
||||
(data.organization_id, data.license_type, data.max_users, valid_from, valid_until),
|
||||
"""INSERT INTO licenses (organization_id, license_type, max_users, valid_from, valid_until, status,
|
||||
token_budget_usd, credits_total, cost_per_credit, budget_warning_percent)
|
||||
VALUES (?, ?, ?, ?, ?, 'active', ?, ?, ?, ?)""",
|
||||
(data.organization_id, data.license_type, data.max_users, valid_from, valid_until,
|
||||
data.token_budget_usd, data.credits_total, data.cost_per_credit, data.budget_warning_percent),
|
||||
)
|
||||
await db.commit()
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren