mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
chore: revert removal of unused vars for versioning
This commit is contained in:
parent
f8c8b89f4d
commit
95214c43c2
1 changed files with 10 additions and 3 deletions
|
|
@ -21,7 +21,7 @@ const { Agent } = require('~/db/models');
|
||||||
* @throws {Error} If the agent creation fails.
|
* @throws {Error} If the agent creation fails.
|
||||||
*/
|
*/
|
||||||
const createAgent = async (agentData) => {
|
const createAgent = async (agentData) => {
|
||||||
const { ...versionData } = agentData;
|
const { author: _author, ...versionData } = agentData;
|
||||||
const timestamp = new Date();
|
const timestamp = new Date();
|
||||||
const initialAgentData = {
|
const initialAgentData = {
|
||||||
...agentData,
|
...agentData,
|
||||||
|
|
@ -151,7 +151,7 @@ const isDuplicateVersion = (updateData, currentData, versions, actionsHash = nul
|
||||||
'actionsHash', // Exclude actionsHash from direct comparison
|
'actionsHash', // Exclude actionsHash from direct comparison
|
||||||
];
|
];
|
||||||
|
|
||||||
const { ...directUpdates } = updateData;
|
const { $push: _$push, $pull: _$pull, $addToSet: _$addToSet, ...directUpdates } = updateData;
|
||||||
|
|
||||||
if (Object.keys(directUpdates).length === 0 && !actionsHash) {
|
if (Object.keys(directUpdates).length === 0 && !actionsHash) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -246,7 +246,14 @@ const updateAgent = async (searchParameter, updateData, options = {}) => {
|
||||||
|
|
||||||
const currentAgent = await Agent.findOne(searchParameter);
|
const currentAgent = await Agent.findOne(searchParameter);
|
||||||
if (currentAgent) {
|
if (currentAgent) {
|
||||||
const { __v, _id, versions, ...versionData } = currentAgent.toObject();
|
const {
|
||||||
|
__v,
|
||||||
|
_id,
|
||||||
|
id: __id,
|
||||||
|
versions,
|
||||||
|
author: _author,
|
||||||
|
...versionData
|
||||||
|
} = currentAgent.toObject();
|
||||||
const { $push, $pull, $addToSet, ...directUpdates } = updateData;
|
const { $push, $pull, $addToSet, ...directUpdates } = updateData;
|
||||||
|
|
||||||
let actionsHash = null;
|
let actionsHash = null;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue