LibreChat/api/server/controllers/agents
Danny Avila 842b68fc32
🏗️ fix: Agents Token Spend Race Conditions, Add Auto-refill Tx, Add Relevant Tests (#6480)
* 🏗️ refactor: Improve spendTokens logic to handle zero completion tokens and enhance test coverage

* 🏗️ test: Add tests to ensure balance does not go below zero when spending tokens

* 🏗️ fix: Ensure proper continuation in AgentClient when handling errors

* fix: spend token race conditions

* 🏗️ test: Add test for handling multiple concurrent transactions with high balance

* fix: Handle Omni models prompt prefix handling for user messages with array content in OpenAIClient

* refactor: Update checkBalance import paths to use new balanceMethods module

* refactor: Update checkBalance imports and implement updateBalance function for atomic balance updates

* fix: import from replace method

* feat: Add createAutoRefillTransaction method to handle non-balance updating transactions

* refactor: Move auto-refill logic to balanceMethods and enhance checkBalance functionality

* feat: Implement logging for auto-refill transactions in balance checks

* refactor: Remove logRefill calls from multiple client and handler files

* refactor: Move balance checking and auto-refill logic to balanceMethods for improved structure

* refactor: Simplify balance check calls by removing unnecessary balanceRecord assignments

* fix: Prevent negative rawAmount in spendTokens when promptTokens is zero

* fix: Update balanceMethods to use Balance model for findOneAndUpdate

* chore: import order

* refactor: remove unused txMethods file to streamline codebase

* feat: enhance updateBalance and createAutoRefillTransaction methods to support additional parameters for improved balance management
2025-03-22 17:54:25 -04:00
..
callbacks.js 🔍 feat: Mistral OCR API / Upload Files as Text (#6274) 2025-03-10 17:23:46 -04:00
client.js 🏗️ fix: Agents Token Spend Race Conditions, Add Auto-refill Tx, Add Relevant Tests (#6480) 2025-03-22 17:54:25 -04:00
errors.js 🚧 chore: merge latest dev build to main repo (#3844) 2024-08-31 16:33:51 -04:00
llm.js 🚧 chore: merge latest dev build to main repo (#3844) 2024-08-31 16:33:51 -04:00
request.js 🔃 refactor: Parent Message ID Handling on Error, Update Translations, Bump Agents (#5833) 2025-02-12 16:49:32 -05:00
run.js 🏃‍♂️ refactor: Improve Agent Run Context & Misc. Changes (#6448) 2025-03-20 22:56:57 -04:00
v1.js 🔗 feat: Agent Chain (Mixture-of-Agents) (#6374) 2025-03-17 16:43:44 -04:00