refactor: Update API endpoints to include 'loras' prefix for consistency

This commit is contained in:
Will Miao
2025-07-24 19:56:18 +08:00
parent f15c6f33f9
commit 692796db46
10 changed files with 21 additions and 21 deletions

View File

@@ -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}`);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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',