diff --git a/static/js/components/shared/ModelDescription.js b/static/js/components/shared/ModelDescription.js index a7275c20..05acc224 100644 --- a/static/js/components/shared/ModelDescription.js +++ b/static/js/components/shared/ModelDescription.js @@ -61,12 +61,6 @@ export async function loadModelDescription(modelId, filePath) { // Determine API endpoint based on file path or context let apiEndpoint = `/api/lora-model-description?model_id=${modelId}&file_path=${encodeURIComponent(filePath)}`; - // If this is a checkpoint (can be determined from file path or other context) - if (filePath.includes('.safetensors') || filePath.includes('.ckpt')) { - // For now, use the same endpoint - can be updated later if checkpoint-specific endpoint is needed - apiEndpoint = `/api/lora-model-description?model_id=${modelId}&file_path=${encodeURIComponent(filePath)}`; - } - // Try to get model description from API const response = await fetch(apiEndpoint); diff --git a/static/js/components/shared/ModelMetadata.js b/static/js/components/shared/ModelMetadata.js index 273d7df3..d6cdf1f4 100644 --- a/static/js/components/shared/ModelMetadata.js +++ b/static/js/components/shared/ModelMetadata.js @@ -114,9 +114,7 @@ export function setupModelNameEditing(filePath) { // Get the file path from the dataset const filePath = this.dataset.filePath; - // Determine model type based on file extension - const isCheckpoint = filePath.includes('.safetensors') || filePath.includes('.ckpt'); - const saveFunction = isCheckpoint ? saveCheckpointMetadata : saveLoraMetadata; + const saveFunction = state.currentPageType === 'checkpoints' ? saveCheckpointMetadata : saveLoraMetadata; await saveFunction(filePath, { model_name: newModelName }); @@ -297,9 +295,7 @@ async function saveBaseModel(filePath, originalValue) { } try { - // Determine model type based on file extension - const isCheckpoint = filePath.includes('.safetensors') || filePath.includes('.ckpt'); - const saveFunction = isCheckpoint ? saveCheckpointMetadata : saveLoraMetadata; + const saveFunction = state.currentPageType === 'checkpoints' ? saveCheckpointMetadata : saveLoraMetadata; await saveFunction(filePath, { base_model: newBaseModel }); @@ -421,19 +417,10 @@ export function setupFileNameEditing(filePath) { // Get the file path from the dataset const filePath = this.dataset.filePath; - // Determine model type and use appropriate rename function - const isCheckpoint = filePath.includes('.safetensors') || filePath.includes('.ckpt'); let result; - if (isCheckpoint) { - // Use checkpoint rename function if it exists, otherwise fallback to generic approach - if (typeof renameCheckpointFile === 'function') { - result = await renameCheckpointFile(filePath, newFileName); - } else { - // Fallback: use checkpoint metadata save function - await saveCheckpointMetadata(filePath, { file_name: newFileName }); - result = { success: true }; - } + if (state.currentPageType === 'checkpoints') { + result = await renameCheckpointFile(filePath, newFileName); } else { // Use LoRA rename function result = await renameLoraFile(filePath, newFileName); diff --git a/static/js/components/shared/ModelModal.js b/static/js/components/shared/ModelModal.js index 6951f281..e27c8e8c 100644 --- a/static/js/components/shared/ModelModal.js +++ b/static/js/components/shared/ModelModal.js @@ -150,12 +150,9 @@ export function showModelModal(model, modelType) { ${typeSpecificContent}