mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔄 fix: Handle Legacy Agent Version Creation (#7718)
* Simplify version creation logic in updateAgent function * Add comprehensive tests for agent functionality including version history, action metadata generation, and loading agents - Introduced tests for generating consistent hashes for action metadata. - Implemented tests for loading agents with various scenarios including null and non-existent IDs. - Added edge case tests for agent creation, updates, and error handling. - Ensured proper handling of ephemeral agents and their associated functionalities. * Enhance tests for Agent model functionality - Updated test structure for Agent resource file operations, improving organization and readability. - Added comprehensive tests for handling concurrent file additions and removals, ensuring data integrity. - Implemented edge case tests for agent creation and resource file management, including scenarios with non-existent agents. - Enhanced error handling in tests to cover various failure scenarios, ensuring robustness in agent operations. * optimize tests
This commit is contained in:
parent
1806b70418
commit
32bab33499
2 changed files with 2259 additions and 907 deletions
|
|
@ -301,10 +301,7 @@ const updateAgent = async (searchParameter, updateData, options = {}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldCreateVersion =
|
const shouldCreateVersion =
|
||||||
forceVersion ||
|
forceVersion || Object.keys(directUpdates).length > 0 || $push || $pull || $addToSet;
|
||||||
(versions &&
|
|
||||||
versions.length > 0 &&
|
|
||||||
(Object.keys(directUpdates).length > 0 || $push || $pull || $addToSet));
|
|
||||||
|
|
||||||
if (shouldCreateVersion) {
|
if (shouldCreateVersion) {
|
||||||
const duplicateVersion = isDuplicateVersion(updateData, versionData, versions, actionsHash);
|
const duplicateVersion = isDuplicateVersion(updateData, versionData, versions, actionsHash);
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue