Phase 1: Model Modal Split-View Redesign

- Implement new split-view overlay layout (left showcase, right metadata)
- Add keyboard navigation (↑↓ for model, ←→ for examples, ESC to close)
- Create Thumbnail Rail for quick example navigation
- Add image controls (view params, set preview, delete)
- Implement parameter panel with prompt display
- Add metadata panel with model info, tags, licenses
- Create tabs (Description/Versions/Recipes) with accordion content
- Integrate with existing ModelCard click handlers
- Add first-use keyboard hint overlay

New files:
- static/js/components/model-modal/*.js
- static/css/components/model-modal/*.css
- docs/plan/model-modal-redesign.md
This commit is contained in:
Will Miao
2026-02-06 19:24:49 +08:00
parent 1606a3ff46
commit 7bc63d7631
12 changed files with 2838 additions and 8 deletions

View File

@@ -22,6 +22,12 @@ import { loadRecipesForLora } from './RecipeTab.js';
import { translate } from '../../utils/i18nHelpers.js';
import { state } from '../../state/index.js';
// Import new ModelModal for split-view overlay (Phase 1)
import { modelModal as newModelModal } from '../model-modal/index.js';
// Feature flag: Use new split-view design
const USE_NEW_MODAL = true;
function getModalFilePath(fallback = '') {
const modalElement = document.getElementById('modelModal');
if (modalElement && modalElement.dataset && modalElement.dataset.filePath) {
@@ -238,6 +244,12 @@ function renderLicenseIcons(modelData) {
* @param {string} modelType - Type of model ('lora' or 'checkpoint')
*/
export async function showModelModal(model, modelType) {
// Use new split-view overlay design when feature flag is enabled
if (USE_NEW_MODAL) {
return newModelModal.show(model, modelType);
}
// Legacy implementation below (deprecated, kept for fallback)
const modalId = 'modelModal';
const modalTitle = model.model_name;
cleanupNavigationShortcuts();
@@ -1020,11 +1032,5 @@ async function openFileLocation(filePath) {
}
}
// Export the model modal API
const modelModal = {
show: showModelModal,
toggleShowcase,
scrollToTop
};
export { modelModal };
// Re-export for compatibility
export { toggleShowcase, scrollToTop };