Skip to content

Feat/export yaml#88

Open
aarishali0 wants to merge 2 commits into
ClickHouse:mainfrom
aarishali0:feat/export-yaml
Open

Feat/export yaml#88
aarishali0 wants to merge 2 commits into
ClickHouse:mainfrom
aarishali0:feat/export-yaml

Conversation

@aarishali0

Copy link
Copy Markdown

Summary

Adds an Export YAML button to the configuration page header, next to the existing Import YAML button. Clicking it downloads the current configured overrides (falling back to the full resolved config if no overrides exist) as librechat.yaml — entirely client-side using js-yaml (already a dependency), with no extra server roundtrip.

Fixes applied after review:

  • Anchor appended to document.body before .click() and removed after — Firefox requires the element to be in the DOM to trigger a file download
  • URL.revokeObjectURL deferred with setTimeout so the browser reads the blob before it is revoked
  • Export button disabled while config data is still loading (consistent with the import button guard)
  • Added com_config_export_yaml i18n key

Change Type

  • New feature (non-breaking change which adds functionality)
  • Translation update

Testing

  1. Start the admin panel (bun run dev)
  2. Navigate to Configuration
  3. Click Export YAML — a librechat.yaml file should download containing the current configuration overrides
  4. If no overrides are set, the export falls back to the full resolved config
  5. Verify the button is disabled while the page is still loading
  6. Verify the download works in both Chrome and Firefox

Test Configuration:

  • Browsers: Chrome, Firefox

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • Local unit tests pass with my changes

Adds an Export YAML button next to the existing Import YAML button in
the configuration header. Clicking it downloads the current configured
overrides (or full config if no overrides exist) as librechat.yaml
using js-yaml on the client side — no server roundtrip needed.
- Append anchor to document.body before click and remove after (Firefox
  requires element in DOM to trigger file download)
- Defer URL.revokeObjectURL with setTimeout to avoid revocation before
  browser reads the blob
- Disable export button while config data is still loading
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit afe5b1d. Configure here.

a.click();
document.body.removeChild(a);
setTimeout(() => URL.revokeObjectURL(url), 100);
}, [dbOverrides, configValues]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope mode exports base config

High Severity

handleExport always serializes base dbOverrides or configValues, even when a role or group scope is selected. The UI and import path use scope-specific profile data in that mode, so the downloaded librechat.yaml can be the global admin config instead of the scope overrides shown on the page.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit afe5b1d. Configure here.

a.click();
document.body.removeChild(a);
setTimeout(() => URL.revokeObjectURL(url), 100);
}, [dbOverrides, configValues]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export ignores unsaved edits

Medium Severity

Export stays enabled when the form is dirty and writes only persisted dbOverrides or configValues, not in-memory editedValues. Import and reset are disabled while dirty, so a user can download YAML that omits pending changes they still see in the UI.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit afe5b1d. Configure here.

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.

2 participants