- Nutzerverwaltung zeigt beim Anlegen/„Link erneuern" jetzt den vollen
Ein-Klick-Link (location.origin/?k=<token>) statt nur des Tokens.
- Neuer Admin-Schalter pro Nutzer (DB-Spalte users.is_admin + Migration).
is_admin_user() honoriert das Flag ODER ADMIN_USERS (SSO). Dadurch zeigt
/me den Admin-Button anhand des Flags — Grundlage für den nginx-Cutover.
- admin.py: PUT /admin/users/{id}/admin; list_users liefert is_admin.
Migration live verifiziert (Spalte vorhanden, bestehende Admins via
ADMIN_USERS weiterhin korrekt). app.js v=45. 219 passed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
120 lines
2.9 KiB
Python
120 lines
2.9 KiB
Python
from typing import Literal
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class EndpointCapabilities(BaseModel):
|
|
id: str
|
|
kind: str
|
|
direction: Literal["input", "output"]
|
|
sample_rate: int = 16000
|
|
channels: int = 1
|
|
latency_class: Literal["low", "medium", "high"] = "medium"
|
|
supports_aec: bool = False
|
|
supports_barge_in: bool = False
|
|
networked: bool = False
|
|
bluetooth: bool = False
|
|
mobile: bool = False
|
|
default: bool = False
|
|
|
|
|
|
class AudioChunk(BaseModel):
|
|
data: bytes
|
|
sample_rate: int = 16000
|
|
channels: int = 1
|
|
format: str = "wav"
|
|
timestamp_ms: int = 0
|
|
|
|
|
|
class PipelineTrace(BaseModel):
|
|
raw_transcript: str | None = None
|
|
cleaned_transcript: str | None = None
|
|
semantic_response: str | None = None
|
|
spoken_response: str | None = None
|
|
tts_ready_text: str | None = None
|
|
|
|
|
|
class SpeakRequest(BaseModel):
|
|
text: str = Field(min_length=1)
|
|
voice: str | None = None
|
|
language: str | None = None
|
|
output_endpoint: str | None = None
|
|
tts_provider: str | None = None
|
|
|
|
|
|
class ChatRequest(BaseModel):
|
|
text: str = Field(min_length=1)
|
|
input_endpoint: str | None = None
|
|
output_endpoint: str | None = None
|
|
language: str | None = None
|
|
voice: str | None = None
|
|
stt_provider: str | None = None
|
|
llm_provider: str | None = None
|
|
tts_provider: str | None = None
|
|
text_only: bool | None = None # True -> kein Server-Audio (Geräte-TTS spricht selbst)
|
|
|
|
|
|
class SessionRouteRequest(BaseModel):
|
|
input_endpoint: str | None = None
|
|
output_endpoint: str | None = None
|
|
stt_provider: str | None = None
|
|
llm_provider: str | None = None
|
|
tts_provider: str | None = None
|
|
language: str | None = None
|
|
|
|
|
|
class RouteInfo(BaseModel):
|
|
input_endpoint: str
|
|
output_endpoint: str
|
|
stt_provider: str
|
|
llm_provider: str
|
|
tts_provider: str
|
|
language: str
|
|
|
|
|
|
class UserCreate(BaseModel):
|
|
display_name: str = Field(min_length=1)
|
|
|
|
|
|
class UserCreated(BaseModel):
|
|
user_id: str
|
|
display_name: str
|
|
token: str # nur bei Erstellung sichtbar
|
|
|
|
|
|
class UserUpdate(BaseModel):
|
|
display_name: str = Field(min_length=1)
|
|
|
|
|
|
class UserPrefs(BaseModel):
|
|
input_endpoint: str | None = None
|
|
output_endpoint: str | None = None
|
|
stt_provider: str | None = None
|
|
llm_provider: str | None = None
|
|
tts_provider: str | None = None
|
|
language: str | None = None
|
|
|
|
|
|
class MemoryCreate(BaseModel):
|
|
content: str = Field(min_length=1)
|
|
|
|
|
|
class MemoryOut(BaseModel):
|
|
id: int
|
|
content: str
|
|
created_at: str
|
|
|
|
|
|
|
|
class EmergencyRequest(BaseModel):
|
|
"""Vom Nutzer ausgelöster Notruf (Knopf). language für den Hinweistext."""
|
|
language: str | None = None
|
|
|
|
|
|
class AdminUserPrefsUpdate(BaseModel):
|
|
"""Admin setzt Nutzer-Einstellungen (z. B. erlaubte Sprachen, CSV: "de,en")."""
|
|
allowed_languages: str | None = None
|
|
|
|
|
|
class UserAdminUpdate(BaseModel):
|
|
"""Admin schaltet Admin-Rechte für einen Nutzer ein/aus."""
|
|
is_admin: bool
|