LibreChat/api/server/controllers
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
..
agents 🏗️ fix: Agents Token Spend Race Conditions, Add Auto-refill Tx, Add Relevant Tests (#6480) 2025-03-22 17:54:25 -04:00
assistants 🏗️ fix: Agents Token Spend Race Conditions, Add Auto-refill Tx, Add Relevant Tests (#6480) 2025-03-22 17:54:25 -04:00
auth 🔐 fix: Invalid Key Length in 2FA Encryption (#6432) 2025-03-20 16:46:11 -04:00
AskController.js 🔃 refactor: Parent Message ID Handling on Error, Update Translations, Bump Agents (#5833) 2025-02-12 16:49:32 -05:00
AuthController.js 🔒 feat: Two-Factor Authentication with Backup Codes & QR support (#5685) 2025-02-17 19:09:36 -05:00
Balance.js 🧮 feat: Improve structured token spending and testing; fix: Anthropic Cache Spend (#3766) 2024-08-24 04:36:08 -04:00
EditController.js 🔃 refactor: Parent Message ID Handling on Error, Update Translations, Bump Agents (#5833) 2025-02-12 16:49:32 -05:00
EndpointController.js refactor: Integrate Capabilities into Agent File Uploads and Tool Handling (#5048) 2024-12-19 13:04:48 -05:00
ErrorController.js 🛡️ : Security Enhancements (#1681) 2024-01-30 14:34:02 -05:00
ModelController.js 🚀 feat: Enhance Model Handling, Logging & xAI Agent Support (#6182) 2025-03-05 12:04:26 -05:00
OverrideController.js 💫 feat: Config File & Custom Endpoints (#1474) 2024-01-03 09:22:48 -05:00
PluginController.js 🎥 feat: YouTube Tool (#5582) 2025-01-31 19:11:04 -05:00
tools.js 🔍 feat: Mistral OCR API / Upload Files as Text (#6274) 2025-03-10 17:23:46 -04:00
TwoFactorController.js 🔐 fix: Invalid Key Length in 2FA Encryption (#6432) 2025-03-20 16:46:11 -04:00
UserController.js 🔒 feat: Two-Factor Authentication with Backup Codes & QR support (#5685) 2025-02-17 19:09:36 -05:00