checkpoint

This commit is contained in:
Will Miao
2025-03-17 19:58:17 +08:00
parent 1bfe12a288
commit 710857dd41
12 changed files with 470 additions and 407 deletions

53
static/js/utils/routes.js Normal file
View File

@@ -0,0 +1,53 @@
// API routes configuration
export const apiRoutes = {
// LoRA routes
loras: {
list: '/api/loras',
detail: (id) => `/api/loras/${id}`,
delete: (id) => `/api/loras/${id}`,
update: (id) => `/api/loras/${id}`,
civitai: (id) => `/api/loras/${id}/civitai`,
download: '/api/download-lora',
move: '/api/move-lora',
scan: '/api/scan-loras'
},
// Recipe routes
recipes: {
list: '/api/recipes',
detail: (id) => `/api/recipes/${id}`,
delete: (id) => `/api/recipes/${id}`,
update: (id) => `/api/recipes/${id}`,
analyze: '/api/analyze-recipe-image',
save: '/api/save-recipe'
},
// Checkpoint routes
checkpoints: {
list: '/api/checkpoints',
detail: (id) => `/api/checkpoints/${id}`,
delete: (id) => `/api/checkpoints/${id}`,
update: (id) => `/api/checkpoints/${id}`
},
// WebSocket routes
ws: {
fetchProgress: (protocol) => `${protocol}://${window.location.host}/ws/fetch-progress`
}
};
// Page routes
export const pageRoutes = {
loras: '/loras',
recipes: '/loras/recipes',
checkpoints: '/checkpoints'
};
// Helper function to get current page type
export function getCurrentPageType() {
const path = window.location.pathname;
if (path.includes('/loras/recipes')) return 'recipes';
if (path.includes('/checkpoints')) return 'checkpoints';
if (path.includes('/loras')) return 'loras';
return 'unknown';
}