mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
👤 feat: Enhance Agent Versioning to Track User Updates (#7523)
* feat: Enhance agent update functionality to track user updates - Updated `updateAgent` function to accept an `updatingUserId` parameter for tracking who made changes. - Modified agent versioning to include `updatedBy` field for better audit trails. - Adjusted related functions and tests to ensure proper handling of user updates and version history. - Enhanced tests to verify correct tracking of `updatedBy` during agent updates and restorations. * fix: Refactor import tests for improved readability and consistency - Adjusted formatting in `importChatGptConvo` test to enhance clarity. - Updated expected output string in `processAssistantMessage` test to use double quotes for consistency. - Modified processing time expectation in `processAssistantMessage` test to allow for CI environment variability.
This commit is contained in:
parent
ed9ab8842a
commit
cede5d120c
5 changed files with 172 additions and 22 deletions
|
|
@ -111,7 +111,7 @@ const getAgentHandler = async (req, res) => {
|
|||
const originalUrl = agent.avatar.filepath;
|
||||
agent.avatar.filepath = await refreshS3Url(agent.avatar);
|
||||
if (originalUrl !== agent.avatar.filepath) {
|
||||
await updateAgent({ id }, { avatar: agent.avatar });
|
||||
await updateAgent({ id }, { avatar: agent.avatar }, req.user.id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,9 @@ const updateAgentHandler = async (req, res) => {
|
|||
}
|
||||
|
||||
let updatedAgent =
|
||||
Object.keys(updateData).length > 0 ? await updateAgent({ id }, updateData) : existingAgent;
|
||||
Object.keys(updateData).length > 0
|
||||
? await updateAgent({ id }, updateData, req.user.id)
|
||||
: existingAgent;
|
||||
|
||||
if (projectIds || removeProjectIds) {
|
||||
updatedAgent = await updateAgentProjects({
|
||||
|
|
@ -405,7 +407,7 @@ const uploadAgentAvatarHandler = async (req, res) => {
|
|||
},
|
||||
};
|
||||
|
||||
promises.push(await updateAgent({ id: agent_id, author: req.user.id }, data));
|
||||
promises.push(await updateAgent({ id: agent_id, author: req.user.id }, data, req.user.id));
|
||||
|
||||
const resolved = await Promise.all(promises);
|
||||
res.status(201).json(resolved[0]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue