summaryrefslogtreecommitdiff
path: root/Omni/Agent/Worker.hs
diff options
context:
space:
mode:
authorOmni Worker <bot@omni.agent>2025-11-22 05:42:48 -0500
committerOmni Worker <bot@omni.agent>2025-11-22 05:42:48 -0500
commit99175426feca3fda9117f20884b2294cee1c1bab (patch)
tree6655371e148a378d9608fdc6b121484cba051702 /Omni/Agent/Worker.hs
parente97d41858c67ca7b019493be2b436e32b8069118 (diff)
fix: divide amp credits by 100 to display dollars
Amp-Thread-ID: https://ampcode.com/threads/T-5a2ca80d-5cba-409f-a262-6b5c652c257d Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Omni/Agent/Worker.hs')
-rw-r--r--Omni/Agent/Worker.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index 7afc849..3504765 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -262,11 +262,11 @@ parseAndUpdate line = do
_ -> pure ()
-- Extract cost from usage-ledger:event
- -- Pattern: {"totalCredits": 1.54, "message": "usage-ledger:event", ...}
- -- We use totalCredits to be robust against missed lines and restarts.
+ -- Pattern: {"totalCredits": 154.0, "message": "usage-ledger:event", ...}
+ -- The credits are in cents, so we divide by 100 to get dollars.
case KM.lookup "totalCredits" obj of
Just (Aeson.Number n) ->
- let total = Scientific.toRealFloat n
+ let total = Scientific.toRealFloat n / 100.0
in AgentLog.update (\s -> s {AgentLog.statusCredits = total})
_ -> pure ()