feat(sidecars): surface storage location and cover excluded models in migration

After migrating to centralized sidecar storage users had no indication
where their files went, and portable-mode installs silently placed the
sidecar root inside the plugin folder where a reinstall or git clean
would delete it.

- Migration now also covers models excluded from the library view and
  returns the resolved sidecar root in its result payload
- get_settings exposes the resolved sidecar root, whether it is the
  default, and whether it lives inside the installation folder
- New POST /api/lm/sidecars/open-location endpoint opens (or copies)
  the sidecar storage folder
- Settings UI always shows the effective storage path with an
  open-folder button, and warns when the root is inside the
  installation folder (portable-mode hazard)
- Migration confirmation shows the destination; on completion a result
  dialog summarizes moved/skipped/conflict counts with the storage
  location and an open-folder action
- Ignore /sidecars/ at the repository root so portable-mode sidecars
  are never committed

Refs #1045
This commit is contained in:
Will Miao
2026-09-26 23:08:29 +08:00
parent 62c144d80a
commit 7aee964448
25 changed files with 817 additions and 34 deletions
@@ -103,6 +103,7 @@
<div class="modal-content delete-modal-content">
<h2 data-role="title"></h2>
<p class="delete-message" data-role="message"></p>
<p class="delete-message sidecar-migration-destination" data-role="destination" style="display: none;"></p>
<div class="modal-actions">
<button class="cancel-btn" data-action="cancel-sidecar-migration">{{ t('common.actions.cancel') }}</button>
<button class="primary-btn" data-action="confirm-sidecar-migration"></button>
@@ -110,6 +111,22 @@
</div>
</div>
<!-- Sidecar Migration Result Modal
Self-managed by SettingsManager: shown after a migration run with the
outcome counters and the storage location; closing it reloads the page
so cards pick up the new paths. -->
<div id="sidecarMigrationResultModal" class="modal delete-modal">
<div class="modal-content delete-modal-content">
<h2 data-role="title"></h2>
<p class="delete-message" data-role="message"></p>
<p class="delete-message sidecar-migration-destination" data-role="destination" style="display: none;"></p>
<div class="modal-actions">
<button class="secondary-btn" data-action="open-sidecar-location" style="display: none;">{{ t('settings.sidecarStorage.openFolderButton') }}</button>
<button class="primary-btn" data-action="close-sidecar-result">{{ t('common.actions.close') }}</button>
</div>
</div>
</div>
<!-- Sidebar Folder Delete Confirmation Modal -->
<!-- Shared by two states: 'confirm' (model-free folder) and 'blocked' (the
subtree still holds models, so a cascade delete is refused). -->
@@ -359,6 +359,23 @@
</div>
</div>
</div>
<div class="setting-row">
<div class="setting-info">
<div class="input-help sidecar-storage-location">
{{ t('settings.sidecarStorage.effectivePathLabel') }}
<code id="sidecarStorageResolvedPath" class="backup-location-path"></code>
</div>
<div class="input-help sidecar-storage-repo-warning" id="sidecarStorageRepoWarning" style="display: none;">
<i class="fas fa-exclamation-triangle"></i>
{{ t('settings.sidecarStorage.repoWarning') }}
</div>
</div>
<div class="setting-control">
<button type="button" class="secondary-btn" id="sidecarStorageOpenBtn" onclick="settingsManager.openSidecarStorageLocation()">
{{ t('settings.sidecarStorage.openFolderButton') }}
</button>
</div>
</div>
</div>
<div class="setting-item">