refactor(stt): unifie le jeton Ghostfolio — source client unique, appel côté serveur (#41)

Avant : jeton Ghostfolio en double (config client pour l'intent vocal + secret k8s pour
le contexte serveur). Désormais une SEULE source — la config client — transmise au
serveur, qui fait tous les appels Ghostfolio (un seul code, lecture seule).

Serveur :
- sources.py : cœur _ghostfolio_fetch(token) partagé ; ghostfolio_block (contexte) et
  ghostfolio_phrase (intent) acceptent un jeton par requête (priorité client > env).
- app.py : /v1/ask accepte `secrets` (jetons client) passés aux sources ; nouvel
  endpoint POST /v1/portfolio {token} → valeur du portefeuille.
- bump 0.4.0 → 0.5.0.

Client :
- api.py : ServerClient.secrets transmis dans /v1/ask ; méthode portfolio() → /v1/portfolio.
- cli.py : _make_client renseigne secrets["ghostfolio_token"] depuis [ghostfolio].
- ui/app.py : l'intent « combien ghostfolio » appelle client.portfolio (serveur).
- supprime portal/ghostfolio.py (client) — l'appel API vit côté serveur.
- config : [ghostfolio] = juste access_token (transmis au serveur).
- bump 0.12.0 → 0.13.0.

Le secret k8s STT_GHOSTFOLIO_TOKEN devient un simple fallback. Validé bout-en-bout
contre une instance serveur locale + Ghostfolio réel : « …vaut environ 16 520 EUR. »

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ALI YESILKAYA 2026-06-21 03:28:52 +02:00 committed by GitHub
parent ae4d5bd20e
commit e49b4fc3ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 121 additions and 113 deletions

View file

@ -174,13 +174,11 @@ DEFAULT_CONFIG: dict[str, Any] = {
"prometheus_url": "http://prometheus.lab.local",
"alertmanager_url": "http://alertmanager.lab.local",
},
# Ghostfolio — pour l'intention vocale « combien sur mon portefeuille ».
# access_token = « Security token » du compte (vide → l'assistant répond de le
# configurer). Lecture seule.
# Ghostfolio — jeton (« Security token » du compte). SOURCE UNIQUE du jeton :
# le client le transmet au serveur, qui fait l'appel API (intent « combien sur mon
# portefeuille » via /v1/portfolio + contexte Ghostfolio). Vide → indisponible.
"ghostfolio": {
"url": "http://ghostfolio.lab.local",
"access_token": "",
"timeout_sec": 6,
},
}