Skip to content

🧑‍💻 fix: Agents Config Defaults and Avatar Uploads Across File Strategies #7814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 10, 2025

Conversation

danny-avila
Copy link
Owner

Summary

I improved the Agents endpoint configuration handling by ensuring proper defaults are always applied and enhanced avatar file processing for unique storage and correctness across all supported storage backends.

  • Refactored Agents endpoint configuration: moved agentsConfigSetup to a unified, TS-based implementation, and ensured that default values are reliably set via schema and passed down from the app configuration.
  • Updated agentsEndpointSchema to provide defaults for disableBuilder and capabilities, ensuring robust fallback even if custom config is absent.
  • Enhanced test coverage for Agents config setup to assert correct default and custom config behaviors in various scenarios.
  • Fixed avatar file processing in all storage backends (Local, S3, Firebase, Azure): avatar files are now named uniquely per agent ID (for agents) or per timestamp (for users), preventing accidental overwrites.
  • Prevented user avatar field from being overwritten when uploading agent avatars by passing through agent IDs and explicitly guarding update logic.
  • Sanitized file paths in the Local file deletion handler to defend against invalid or potentially unsafe paths.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

I ran existing and new unit tests for AppService covering agents config defaults/custom cases. I manually uploaded avatars for both users and agents in all supported file strategies (Local, S3, Firebase, Azure) and confirmed that each file is uniquely stored and the correct records are updated in the database. For file deletion, I attempted to delete files with query params and invalid path scenarios to validate error handling.

Test Configuration:

  • Local storage: uploading and deleting both user and agent avatars
  • S3, Firebase, Azure: uploading agent avatars with/without agent IDs, user avatars, verifying DB update behavior
  • Ran AppService.spec.js and new tests for agents endpoint coverage

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila danny-avila changed the title 🧑‍💻 fix: Agents Config Defaults and Avatar Processing Across File Strategies 🧑‍💻 fix: Agents Config Defaults and Avatar Uploads Across File Strategies Jun 10, 2025
@danny-avila danny-avila merged commit a57224c into dev Jun 10, 2025
7 checks passed
@danny-avila danny-avila deleted the fix/minor-issues-2025-06-10 branch June 10, 2025 13:53
jmaddington pushed a commit to jmaddington/LibreChat that referenced this pull request Jun 17, 2025
…gies (danny-avila#7814)

* fix: avatar processing across storage services, uniqueness by agent ID, prevent overwriting user avatar

* fix: sanitize file paths in deleteLocalFile function to prevent invalid path errors

* fix: correct spelling of 'agentsEndpointSchema' in agents.js and config.ts

* fix: default app.locals agents configuration setup and add agent endpoint schema default
rhonyabdullah pushed a commit to rhonyabdullah/LibreChat that referenced this pull request Jun 27, 2025
…gies (danny-avila#7814)

* fix: avatar processing across storage services, uniqueness by agent ID, prevent overwriting user avatar

* fix: sanitize file paths in deleteLocalFile function to prevent invalid path errors

* fix: correct spelling of 'agentsEndpointSchema' in agents.js and config.ts

* fix: default app.locals agents configuration setup and add agent endpoint schema default
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Aug 4, 2025
…gies (danny-avila#7814)

* fix: avatar processing across storage services, uniqueness by agent ID, prevent overwriting user avatar

* fix: sanitize file paths in deleteLocalFile function to prevent invalid path errors

* fix: correct spelling of 'agentsEndpointSchema' in agents.js and config.ts

* fix: default app.locals agents configuration setup and add agent endpoint schema default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant