👤 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:
matt burnett 2025-05-23 20:47:14 -04:00 committed by GitHub
parent ed9ab8842a
commit cede5d120c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 172 additions and 22 deletions

View file

@ -107,7 +107,7 @@ router.post('/:agent_id', async (req, res) => {
.filter((tool) => !(tool && (tool.includes(domain) || tool.includes(action_id))))
.concat(functions.map((tool) => `${tool.function.name}${actionDelimiter}${domain}`));
const updatedAgent = await updateAgent(agentQuery, { tools, actions });
const updatedAgent = await updateAgent(agentQuery, { tools, actions }, req.user.id);
// Only update user field for new actions
const actionUpdateData = { metadata, agent_id };
@ -172,7 +172,7 @@ router.delete('/:agent_id/:action_id', async (req, res) => {
const updatedTools = tools.filter((tool) => !(tool && tool.includes(domain)));
await updateAgent(agentQuery, { tools: updatedTools, actions: updatedActions });
await updateAgent(agentQuery, { tools: updatedTools, actions: updatedActions }, req.user.id);
// If admin, can delete any action, otherwise only user's actions
const actionQuery = admin ? { action_id } : { action_id, user: req.user.id };
await deleteAction(actionQuery);