Hallo! Ich habe gerade meinen wöchentlichen Überblick erhalten und musste ihn dreimal lesen, bevor ich verstand, dass die Kommas durch Punkte ersetzt wurden, amerikanisch… Wenn es möglich wäre, zu einem mit dem SI kohärenten Zustand zurückzukehren, wäre das super!
Hallo @GBoulvin ,
Danke für das Feedback, gut beobachtet!
Die KI erstellt die wöchentliche Zusammenfassung basierend auf den Daten deines Hauses, und Gladys sendet sie ihr im JSON-Format. In JSON werden Zahlen jedoch immer mit einem Punkt geschrieben. Die Anweisungen an die KI verlangten nicht, die Zahlen in das Format deiner Sprache umzuwandeln, also hat sie sie einfach so, wie sie waren, kopiert – auf Amerikanisch
Dein Screenshot zeigt auch ein zweites Problem: Gladys rundet die Werte nicht, bevor sie sie sendet, daher die „92.168 kWh“ und „28.7603 Euro“. Niemand braucht die Kosten auf den hundertstel Cent!
Ich werde beide Punkte korrigieren:
Gladys wird die Verbräuche und Kosten runden, bevor sie sie an die KI sendet.
Die KI wird angewiesen, die Zahlen nach den Konventionen deiner Sprache zu schreiben: Komma in Französisch, Spanisch und Deutsch, Punkt in Englisch.
Ich habe ein GitHub-Issue eröffnet, um die Korrektur zu verfolgen: #3355
Ich halte dich hier auf dem Laufenden, sobald es verfügbar ist
Hallo zusammen!
Dieses Thema ist nun in Entwicklung .
Ein Pull Request wurde erstellt, um die Zahlen im wöchentlichen KI-Zusammenfassung in der Sprache des Benutzers zu schreiben und aufzurunden:
master ← fix/weekly-digest-number-format
opened 09:06AM - 13 Nov 26 UTC
### Description
The AI weekly digest wrote numbers the American way even for Fr… ench-speaking users (`111.34 kWh`, `33.93 euros`), and some values were not rounded at all (`92.168 kWh`, `28.7603 euros` for the previous week).
**Root cause**
- `gateway.buildWeeklyDigestData.js` sent the raw sums of the daily buckets (`current_week_kwh`, `previous_week_kwh`, `current_week_cost`, `previous_week_cost`) with every decimal.
- `gateway.sendWeeklyDigest.js` sends that data as JSON, where numbers always use a period.
- `weeklyDigest.prompt.txt` said nothing about number formatting, so the AI copied the JSON numbers as they were and rounded only some of them.
**Fix**
- **Rounding before the AI**: the weekly kWh and cost totals are rounded to two decimals (`roundDigestValue`), and a missing total stays `null`. `92.168` → `92.17`, `28.7603` → `28.76`.
- **Decimal separator per admin**: each digest request now says which decimal separator the admin's language uses (`Decimal separator: ","` for fr / es / de, `"."` for en). `getDecimalSeparator` reads it from `Intl.NumberFormat` and falls back on a period for an unknown language.
- **Prompt**: a new "Numbers" section tells the AI that the JSON always uses a period and must not be copied as is. It also says to use the separator given in the request (with examples), never to write more decimals than the payload has, and to write costs with two decimals.
No living spec in `docs/specs/` covers the digest payload or prompt (`ai-type.md` only covers routing, and `energy-contracts.md` §8.3 only covers the main-meter lookup), so no spec update was needed.
**Tests**
- `gateway.buildWeeklyDigestData.test.js`: unit tests for `roundDigestValue`; kWh and cost totals rounded in `fetchEnergyConsumptionForFeature` (current and previous week, using the forum values); a missing previous-week total stays `null`.
- `gateway.sendWeeklyDigest.test.js`: the exact user message for a French and an English admin; `getDecimalSeparator` for fr / es / de / en and for an invalid language.
### Related request
Forum: https://community.gladysassistant.com/t/resume-hebdomadaire-ou-sont-les-virgules/10819
Closes #3355
### Checklist
- [x] If a forum topic or GitHub issue exists, the description links it (`Forum: https://community.gladysassistant.com/t/...` or `Closes #...`)
- [x] Tests pass: `cd server && npm run coverage` (Codecov requires 100% coverage on changed lines) and Cypress (`npm run cypress:run`) if the UI changed
- Changed files: `gateway.sendWeeklyDigest.js` 100% on every metric. In `gateway.buildWeeklyDigestData.js` every changed line and branch is covered; the only uncovered branches are on lines this PR does not touch. No UI change, so Cypress was not run.
- In the agent's sandbox, 26 tests outside this area fail, the same 26 on an untouched `master`: backup / restore tests need the `sqlite3` CLI, which the sandbox lacks, and Gladys Plus API controller tests get a `405` from the sandbox HTTP proxy instead of their mocked responses.
- [x] Linter and prettier pass on both front and server (`npm run eslint`, `npm run prettier`): server only, no front change. ESLint reports 0 errors and no warnings in the changed files.
- [x] No undocumented breaking change
---
_Generated by [Claude Code](https://claude.ai/code/session_01MNjB3688t7fM4zbqhd2Rvn)_
Zögert nicht, dem PR zu folgen, es zu testen (optional, besonders bei kleinen Anfragen) und euer Feedback hier zu hinterlassen, falls nötig.