🧮 feat: Improve structured token spending and testing; fix: Anthropic Cache Spend (#3766)

* chore: update jest and mongodb-memory-server dependencies

* fix: Anthropic edge case of increasing balance

* refactor: Update token calculations in Transaction model/spec

* refactor: `spendTokens` always record transactions, add Tx related tests

* feat: Add error handling for CHECK_BALANCE environment variable

* feat: Update import path for Balance model in Balance controller

* chore: remove logging

* refactor: Improve structured token spend logging in spendTokens.js

* ci: add unit tests for spend token

* ci: Improve structured token spend unit testing

* chore: improve logging phrase for no tx spent from balance
This commit is contained in:
Danny Avila 2024-08-24 04:36:08 -04:00 committed by GitHub
parent ea5140ff0f
commit d54458b3a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 850 additions and 82 deletions

View file

@ -1,4 +1,4 @@
const Balance = require('../../models/Balance');
const Balance = require('~/models/Balance');
async function balanceController(req, res) {
const { tokenCredits: balance = '' } =