LibreChat/api/server/controllers/agents
Danny Avila 467df0f07a
🎭 feat: Override Custom Endpoint Schema with Specified Params Endpoint (#11788)
* 🔧 refactor: Simplify payload parsing and enhance getSaveOptions logic

- Removed unused bedrockInputSchema from payloadParser, streamlining the function.
- Updated payloadParser to handle optional chaining for model parameters.
- Enhanced getSaveOptions to ensure runOptions defaults to an empty object if parsing fails, improving robustness.
- Adjusted the assignment of maxContextTokens to use the instance variable for consistency.

* 🔧 fix: Update maxContextTokens assignment logic in initializeAgent function

- Enhanced the maxContextTokens assignment to allow for user-defined values, ensuring it defaults to a calculated value only when not provided or invalid. This change improves flexibility in agent initialization.

* 🧪 test: Add unit tests for initializeAgent function

- Introduced comprehensive unit tests for the initializeAgent function, focusing on maxContextTokens behavior.
- Tests cover scenarios for user-defined values, fallback calculations, and edge cases such as zero and negative values, enhancing overall test coverage and reliability of agent initialization logic.

* refactor: default params Endpoint Configuration Handling

- Integrated `getEndpointsConfig` to fetch endpoint configurations, allowing for dynamic handling of `defaultParamsEndpoint`.
- Updated `buildEndpointOption` to pass `defaultParamsEndpoint` to `parseCompactConvo`, ensuring correct parameter handling based on endpoint type.
- Added comprehensive unit tests for `buildDefaultConvo` and `cleanupPreset` to validate behavior with `defaultParamsEndpoint`, covering various scenarios and edge cases.
- Refactored related hooks and utility functions to support the new configuration structure, improving overall flexibility and maintainability.

* refactor: Centralize defaultParamsEndpoint retrieval

- Introduced `getDefaultParamsEndpoint` function to streamline the retrieval of `defaultParamsEndpoint` across various hooks and middleware.
- Updated multiple files to utilize the new function, enhancing code consistency and maintainability.
- Removed redundant logic for fetching `defaultParamsEndpoint`, simplifying the codebase.
2026-02-13 23:04:51 -05:00
..
__tests__ 📉 feat: Add Token Usage Tracking for Agents API Routes (#11600) 2026-02-01 21:36:51 -05:00
callbacks.js 🏁 fix: Resolve Content Aggregation Race Condition in Agent Event Handlers (#11757) 2026-02-12 15:42:22 -05:00
client.js 🎭 feat: Override Custom Endpoint Schema with Specified Params Endpoint (#11788) 2026-02-13 23:04:51 -05:00
client.test.js 🧩 fix: Missing Memory Agent Assignment for Matching IDs (#11514) 2026-01-25 12:08:52 -05:00
errors.js 🛜 refactor: Streamline App Config Usage (#9234) 2025-08-26 12:10:18 -04:00
openai.js 📉 feat: Add Token Usage Tracking for Agents API Routes (#11600) 2026-02-01 21:36:51 -05:00
recordCollectedUsage.spec.js 🪙 refactor: Collected Usage & Anthropic Prompt Caching (#11319) 2026-01-12 23:02:08 -05:00
request.js 🔄 refactor: Sequential Event Ordering in Redis Streaming Mode (#11650) 2026-02-05 17:57:33 +01:00
responses.js 📉 feat: Add Token Usage Tracking for Agents API Routes (#11600) 2026-02-01 21:36:51 -05:00
v1.js 🛸 feat: Remote Agent Access with External API Support (#11503) 2026-01-28 17:44:33 -05:00
v1.spec.js 🌅 fix: Agent Avatar S3 URL Refresh Pagination and Persistence (#11323) 2026-01-13 13:01:11 -05:00