feat(admin): Phase 3 — Laufzeit-Konfiguration ohne Server-Neustart
Neue Tabelle config_overrides in SQLite; RuntimeSettings-Wrapper liest
überschreibbare Felder mit 30s TTL-Cache aus der DB und fällt auf
.env-Werte zurück. dependencies.py und quota.py nutzen runtime_settings
als Default statt des statischen Settings-Singletons.
16 Felder überschreibbar: STT/LLM/TTS-Provider, LLM-Modelle, Stimmen,
Systemprompt, Temperatur, Tageskontingent, Normalisierung u.a.
Backend: GET/PUT/DELETE /api/admin/config/{key}
Admin-UI: neuer Tab "⚙ Einstellungen" mit Inline-Edit und Reset.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
296138ac1e
commit
5d022aaf63
7 changed files with 285 additions and 9 deletions
|
|
@ -4,7 +4,6 @@ Limit aus Settings (`daily_request_limit`), pro Nutzer ueber `prefs.daily_reques
|
|||
ueberschreibbar. 0 bedeutet unbegrenzt.
|
||||
"""
|
||||
|
||||
from app.config import settings, Settings
|
||||
from app.metrics import metrics
|
||||
|
||||
|
||||
|
|
@ -15,7 +14,10 @@ class QuotaExceededError(Exception):
|
|||
super().__init__(f"Daily request limit reached ({count}/{limit})")
|
||||
|
||||
|
||||
def effective_limit(user, cfg: Settings = settings) -> int:
|
||||
def effective_limit(user, cfg=None) -> int:
|
||||
if cfg is None:
|
||||
from app.runtime_config import runtime_settings
|
||||
cfg = runtime_settings
|
||||
pref = user.prefs.get("daily_request_limit") if user and user.prefs else None
|
||||
if pref is not None:
|
||||
try:
|
||||
|
|
@ -25,7 +27,7 @@ def effective_limit(user, cfg: Settings = settings) -> int:
|
|||
return cfg.daily_request_limit
|
||||
|
||||
|
||||
def enforce_quota(user, store, cfg: Settings = settings) -> None:
|
||||
def enforce_quota(user, store, cfg=None) -> None:
|
||||
"""Wirft QuotaExceededError, wenn das Tageslimit erreicht ist."""
|
||||
limit = effective_limit(user, cfg)
|
||||
if limit and limit > 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue