Commit 9c58e36
committed
vscode-extension: v0.5.1 — fix negative savings on dashboard
Mirror of upstream PR #36 (fix/savings-includes-media-cost). The
"Saved vs Opus" panel hero would show negative dollar amounts as
soon as a user spent meaningfully on ImageGen / VideoGen, e.g.
$-8.79
You spent $20.4896 instead of $11.70
Root cause: getStatsSummary() compared an Opus-token baseline (chat
only — image/video log inputTokens=0/outputTokens=0) against
totalCostUsd (chat + media combined), so once media spend exceeded
the chat-vs-Opus delta the difference flipped negative.
Fix: split byModel into chatOnlyCost (rows with tokens) and mediaCost
(rows without). opusCost on the display side now equals
opusChatCost + mediaCost so "you spent X instead of Y" stays
apples-to-apples; saved = max(0, opusChatCost - chatOnlyCost) is
the chat-side delta only and is clamped non-negative.
Bumps vscode-extension to 0.5.1; updates README changelog.1 parent e4b0988 commit 9c58e36
6 files changed
Lines changed: 57 additions & 14 deletions
File tree
- src
- panel
- stats
- vscode-extension
- out
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
687 | | - | |
688 | | - | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
689 | 694 | | |
690 | 695 | | |
691 | 696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
260 | 264 | | |
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
267 | | - | |
268 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
269 | 288 | | |
270 | 289 | | |
271 | | - | |
272 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
273 | 299 | | |
274 | 300 | | |
275 | 301 | | |
| |||
285 | 311 | | |
286 | 312 | | |
287 | 313 | | |
288 | | - | |
| 314 | + | |
289 | 315 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147707 | 147707 | | |
147708 | 147708 | | |
147709 | 147709 | | |
147710 | | - | |
147711 | | - | |
| 147710 | + | |
| 147711 | + | |
| 147712 | + | |
| 147713 | + | |
| 147714 | + | |
| 147715 | + | |
| 147716 | + | |
| 147717 | + | |
| 147718 | + | |
| 147719 | + | |
| 147720 | + | |
147712 | 147721 | | |
147713 | 147722 | | |
147714 | 147723 | | |
| |||
147721 | 147730 | | |
147722 | 147731 | | |
147723 | 147732 | | |
147724 | | - | |
| 147733 | + | |
147725 | 147734 | | |
147726 | 147735 | | |
147727 | 147736 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
0 commit comments