feat(logos): Provider-Kette, lokaler Cache und Markenfarben
- simple-icons als kompakter Index im Repository (3.459 Marken, 2 MB gzip),
erzeugt von scripts/vendor_simple_icons.py bzw. `make vendor-icons`
- logo.dev und Brandfetch als optionale Adapter, ohne Schlüssel übersprungen
- Favicon-Fallback und generierter Buchstaben-Avatar als Garantie
- Bei eindeutigem Offline-Treffer unterbleiben Anfragen nach außen komplett
- Cache im Dateisystem nach SHA-256, Auslieferung nur über /api/logos/{id}
mit immutable-Header und ETag
- Markenfarbe aus SVG-Fills bzw. per k-Means (k=4) über 64x64 Pixel, dazu eine
aufgehellte Variante mit mindestens 4,5:1 Kontrast auf dunklem Grund
- Kandidatensuche mit Vorauswahl, Auswahl, Upload und Zurücksetzen
- Bildtyp wird nur noch am Inhalt bestimmt, nicht an der gemeldeten Kopfzeile
- 60 neue Tests, insgesamt 208 grün
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014e7t8UpmoVNMtWivY5LiSH
This commit is contained in:
@@ -45,3 +45,30 @@ class MerchantOut(ApiModel):
|
||||
logo_source: LogoSource | None
|
||||
logo_status: LogoStatus
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class LogoCandidateOut(ApiModel):
|
||||
"""Ein zur Auswahl stehendes Logo. Die Datei liegt bereits im lokalen Cache."""
|
||||
|
||||
candidate_id: int = Field(description="ID für /api/logos/{id} und für die Auswahl.")
|
||||
source: LogoSource
|
||||
title: str
|
||||
score: float = Field(
|
||||
ge=0, le=1, description="Trefferwahrscheinlichkeit; der höchste Wert ist vorausgewählt."
|
||||
)
|
||||
mime: str
|
||||
width: int | None = None
|
||||
height: int | None = None
|
||||
brand_color: str | None = None
|
||||
is_preselected: bool = Field(description="Genau ein Kandidat ist vorausgewählt.")
|
||||
|
||||
|
||||
class LogoSearchOut(ApiModel):
|
||||
"""Ergebnis der Logosuche."""
|
||||
|
||||
merchant_id: int
|
||||
candidates: list[LogoCandidateOut]
|
||||
|
||||
|
||||
class LogoSelectRequest(InputModel):
|
||||
candidate_id: int = Field(description="ID aus der Kandidatenliste.")
|
||||
|
||||
Reference in New Issue
Block a user