#3b Langzeit-Erinnerungen: - Store: memories-Tabelle + add/get/delete_memory (pro Nutzer) - API: GET/POST/DELETE /api/me/memories - chat.py injiziert Nutzer-Erinnerungen als System-Kontext ins LLM (sessionunabhaengig) - ?debug zeigt memories_len #4 Echtzeit (erster Increment): - WS /ws/chat: dauerhafter Kanal, Event-Folge ack -> semantic -> audio (binaer) -> done - Auth (Token-Query), Session-Gedaechtnis und Erinnerungen wie bei POST /api/chat - Fehler als error-Event (422/403/502) - Tests: 38 gruen (Erinnerungs-CRUD/Injektion, WebSocket-Streaming/Auth) - Doku aktualisiert (README, BEDIENUNGSANLEITUNG, Architektur) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
100 lines
2.3 KiB
Python
100 lines
2.3 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
|
|
|
|
|
|
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 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
|
|
|