Add cache management feature: implement clear cache API and modal confirmation

This commit is contained in:
Will Miao
2025-05-29 14:36:13 +08:00
parent afb012029f
commit ddf132bd78
5 changed files with 136 additions and 2 deletions

View File

@@ -39,6 +39,21 @@
</div>
</div>
<!-- Cache Clear Confirmation Modal -->
<div id="clearCacheModal" class="modal delete-modal">
<div class="modal-content delete-modal-content">
<h2>Clear Cache Files</h2>
<p class="delete-message">Are you sure you want to clear all cache files?</p>
<div class="delete-model-info">
<p>This will remove all cached model data. The system will need to rebuild the cache on next startup, which may take some time depending on your model collection size.</p>
</div>
<div class="modal-actions">
<button class="cancel-btn" onclick="modalManager.closeModal('clearCacheModal')">Cancel</button>
<button class="delete-btn" onclick="settingsManager.executeClearCache()">Clear Cache</button>
</div>
</div>
</div>
<!-- Settings Modal -->
<div id="settingsModal" class="modal">
<div class="modal-content settings-modal">
@@ -183,6 +198,29 @@
</div>
</div>
<!-- Add Cache Management Section -->
<div class="settings-section">
<h3>Cache Management</h3>
<div class="setting-item">
<div class="setting-row">
<div class="setting-info">
<label>Clear Cache Files</label>
</div>
<div class="setting-control">
<button id="clearCacheBtn" class="secondary-btn" onclick="settingsManager.confirmClearCache()">
<i class="fas fa-trash"></i>
<span>Clear Cache</span>
</button>
</div>
</div>
<div class="input-help">
Removes cached model data. System will rebuild cache on next startup or when triggered manually.
<span class="warning-text">May cause temporary performance impact during rebuild.</span>
</div>
</div>
</div>
<!-- Add Example Images Settings Section -->
<div class="settings-section">
<h3>Example Images</h3>