feat: Anfrage-Log mit Tokens, Dauer, Engine und Instanz, Aufbewahrung, Key-Recht metrics (Schema 2, #1050)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 09:02:43 +01:00
parent 0cb8ca3fc5
commit b4a3957f8a
6 changed files with 153 additions and 6 deletions

View File

@ -11,12 +11,16 @@ use crate::{Store, db};
pub struct Rights {
/// Erlaubte Modell-Namen; `*` erlaubt alle.
pub models: Vec<String>,
/// Darf `GET /gateway/v1/metrics` lesen. Ältere Keys ohne dieses Feld: nein.
#[serde(default)]
pub metrics: bool,
}
impl Default for Rights {
fn default() -> Self {
Self {
models: vec!["*".to_string()],
metrics: false,
}
}
}
@ -192,6 +196,7 @@ mod tests {
fn rechte_pruefen_modellnamen() {
let r = Rights {
models: vec!["bonsai".to_string()],
metrics: false,
};
assert!(r.allows("bonsai"));
assert!(!r.allows("anderes"));