diff --git a/py/routes/lora_routes.py b/py/routes/lora_routes.py index ac7dc4ed..f88d03ec 100644 --- a/py/routes/lora_routes.py +++ b/py/routes/lora_routes.py @@ -45,21 +45,21 @@ class LoraRoutes(BaseModelRoutes): app.router.add_get(f'/api/{prefix}/letter-counts', self.get_letter_counts) app.router.add_get(f'/api/{prefix}/get-notes', self.get_lora_notes) app.router.add_get(f'/api/{prefix}/get-trigger-words', self.get_lora_trigger_words) - app.router.add_get(f'/api/lora-preview-url', self.get_lora_preview_url) - app.router.add_get(f'/api/lora-civitai-url', self.get_lora_civitai_url) - app.router.add_get(f'/api/lora-model-description', self.get_lora_model_description) + app.router.add_get(f'/api/{prefix}/preview-url', self.get_lora_preview_url) + app.router.add_get(f'/api/{prefix}/civitai-url', self.get_lora_civitai_url) + app.router.add_get(f'/api/{prefix}/model-description', self.get_lora_model_description) # LoRA-specific management routes - app.router.add_post(f'/api/move_model', self.move_model) - app.router.add_post(f'/api/move_models_bulk', self.move_models_bulk) + app.router.add_post(f'/api/{prefix}/move_model', self.move_model) + app.router.add_post(f'/api/{prefix}/move_models_bulk', self.move_models_bulk) # CivitAI integration with LoRA-specific validation app.router.add_get(f'/api/{prefix}/civitai/versions/{{model_id}}', self.get_civitai_versions_lora) - app.router.add_get(f'/api/civitai/model/version/{{modelVersionId}}', self.get_civitai_model_by_version) - app.router.add_get(f'/api/civitai/model/hash/{{hash}}', self.get_civitai_model_by_hash) + app.router.add_get(f'/api/{prefix}/civitai/model/version/{{modelVersionId}}', self.get_civitai_model_by_version) + app.router.add_get(f'/api/{prefix}/civitai/model/hash/{{hash}}', self.get_civitai_model_by_hash) # ComfyUI integration - app.router.add_post(f'/loramanager/get_trigger_words', self.get_trigger_words) + app.router.add_post(f'/api/{prefix}/get_trigger_words', self.get_trigger_words) def _parse_specific_params(self, request: web.Request) -> Dict: """Parse LoRA-specific parameters""" diff --git a/static/js/api/loraApi.js b/static/js/api/loraApi.js index 9d5dd1bc..a7f0bccd 100644 --- a/static/js/api/loraApi.js +++ b/static/js/api/loraApi.js @@ -125,7 +125,7 @@ export async function refreshSingleLoraMetadata(filePath) { export async function fetchModelDescription(modelId, filePath) { try { - const response = await fetch(`/api/lora-model-description?model_id=${modelId}&file_path=${encodeURIComponent(filePath)}`); + const response = await fetch(`/api/loras/model-description?model_id=${modelId}&file_path=${encodeURIComponent(filePath)}`); if (!response.ok) { throw new Error(`Failed to fetch model description: ${response.statusText}`); diff --git a/static/js/components/ContextMenu/RecipeContextMenu.js b/static/js/components/ContextMenu/RecipeContextMenu.js index 63d5795a..f2862298 100644 --- a/static/js/components/ContextMenu/RecipeContextMenu.js +++ b/static/js/components/ContextMenu/RecipeContextMenu.js @@ -209,9 +209,9 @@ export class RecipeContextMenu extends BaseContextMenu { // Determine which endpoint to use based on available data if (lora.modelVersionId) { - endpoint = `/api/civitai/model/version/${lora.modelVersionId}`; + endpoint = `/api/loras/civitai/model/version/${lora.modelVersionId}`; } else if (lora.hash) { - endpoint = `/api/civitai/model/hash/${lora.hash}`; + endpoint = `/api/loras/civitai/model/hash/${lora.hash}`; } else { console.error("Missing both hash and modelVersionId for lora:", lora); return null; diff --git a/static/js/components/RecipeModal.js b/static/js/components/RecipeModal.js index ce98a11c..00ad0b0b 100644 --- a/static/js/components/RecipeModal.js +++ b/static/js/components/RecipeModal.js @@ -831,9 +831,9 @@ class RecipeModal { // Determine which endpoint to use based on available data if (lora.modelVersionId) { - endpoint = `/api/civitai/model/version/${lora.modelVersionId}`; + endpoint = `/api/loras/civitai/model/version/${lora.modelVersionId}`; } else if (lora.hash) { - endpoint = `/api/civitai/model/hash/${lora.hash}`; + endpoint = `/api/loras/civitai/model/hash/${lora.hash}`; } else { console.error("Missing both hash and modelVersionId for lora:", lora); return null; diff --git a/static/js/components/shared/ModelDescription.js b/static/js/components/shared/ModelDescription.js index 05acc224..64e78348 100644 --- a/static/js/components/shared/ModelDescription.js +++ b/static/js/components/shared/ModelDescription.js @@ -59,7 +59,7 @@ export async function loadModelDescription(modelId, filePath) { descriptionContainer.classList.add('hidden'); // Determine API endpoint based on file path or context - let apiEndpoint = `/api/lora-model-description?model_id=${modelId}&file_path=${encodeURIComponent(filePath)}`; + let apiEndpoint = `/api/loras/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/managers/MoveManager.js b/static/js/managers/MoveManager.js index e72c8274..50f735ae 100644 --- a/static/js/managers/MoveManager.js +++ b/static/js/managers/MoveManager.js @@ -219,7 +219,7 @@ class MoveManager { return; } - const response = await fetch('/api/move_model', { + const response = await fetch('/api/loras/move_model', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -257,7 +257,7 @@ class MoveManager { return; } - const response = await fetch('/api/move_models_bulk', { + const response = await fetch('/api/loras/move_models_bulk', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/web/comfyui/legacy_loras_widget.js b/web/comfyui/legacy_loras_widget.js index bec337da..bf2ba96f 100644 --- a/web/comfyui/legacy_loras_widget.js +++ b/web/comfyui/legacy_loras_widget.js @@ -147,7 +147,7 @@ export function addLorasWidget(node, name, opts, callback) { this.currentLora = loraName; // 获取预览URL - const response = await api.fetchApi(`/lora-preview-url?name=${encodeURIComponent(loraName)}`, { + const response = await api.fetchApi(`/loras/preview-url?name=${encodeURIComponent(loraName)}`, { method: 'GET' }); @@ -472,7 +472,7 @@ export function addLorasWidget(node, name, opts, callback) { try { // Get Civitai URL from API - const response = await api.fetchApi(`/lora-civitai-url?name=${encodeURIComponent(loraName)}`, { + const response = await api.fetchApi(`/loras/civitai-url?name=${encodeURIComponent(loraName)}`, { method: 'GET' }); diff --git a/web/comfyui/loras_widget_components.js b/web/comfyui/loras_widget_components.js index 54990d99..4a4448e0 100644 --- a/web/comfyui/loras_widget_components.js +++ b/web/comfyui/loras_widget_components.js @@ -165,7 +165,7 @@ export class PreviewTooltip { this.currentLora = loraName; // Get preview URL - const response = await api.fetchApi(`/lora-preview-url?name=${encodeURIComponent(loraName)}`, { + const response = await api.fetchApi(`/loras/preview-url?name=${encodeURIComponent(loraName)}`, { method: 'GET' }); diff --git a/web/comfyui/loras_widget_events.js b/web/comfyui/loras_widget_events.js index a876d0cd..0c1e56b4 100644 --- a/web/comfyui/loras_widget_events.js +++ b/web/comfyui/loras_widget_events.js @@ -265,7 +265,7 @@ export function createContextMenu(x, y, loraName, widget, previewTooltip, render try { // Get Civitai URL from API - const response = await api.fetchApi(`/lora-civitai-url?name=${encodeURIComponent(loraName)}`, { + const response = await api.fetchApi(`/loras/civitai-url?name=${encodeURIComponent(loraName)}`, { method: 'GET' }); diff --git a/web/comfyui/utils.js b/web/comfyui/utils.js index 54924103..5acf395a 100644 --- a/web/comfyui/utils.js +++ b/web/comfyui/utils.js @@ -174,7 +174,7 @@ export function collectActiveLorasFromChain(node, visited = new Set()) { export function updateConnectedTriggerWords(node, loraNames) { const connectedNodeIds = getConnectedTriggerToggleNodes(node); if (connectedNodeIds.length > 0) { - fetch("/loramanager/get_trigger_words", { + fetch("/api/loras/get_trigger_words", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({