Refactor API endpoints to use '/api/lm/' prefix

- Updated all relevant routes in `stats_routes.py` and `update_routes.py` to include the new '/api/lm/' prefix for consistency.
- Modified API endpoint configurations in `apiConfig.js` to reflect the new structure, ensuring all CRUD and bulk operations are correctly routed.
- Adjusted fetch calls in various components and managers to utilize the updated API paths, including recipe, model, and example image operations.
- Ensured all instances of the old API paths were replaced with the new '/api/lm/' prefix across the codebase for uniformity and to prevent broken links.
This commit is contained in:
Will Miao
2025-09-18 14:50:40 +08:00
parent ded17c1479
commit bdc86ddf15
40 changed files with 225 additions and 225 deletions

View File

@@ -48,53 +48,53 @@ class BaseModelRoutes(ABC):
prefix: URL prefix (e.g., 'loras', 'checkpoints') prefix: URL prefix (e.g., 'loras', 'checkpoints')
""" """
# Common model management routes # Common model management routes
app.router.add_get(f'/api/{prefix}/list', self.get_models) app.router.add_get(f'/api/lm/{prefix}/list', self.get_models)
app.router.add_post(f'/api/{prefix}/delete', self.delete_model) app.router.add_post(f'/api/lm/{prefix}/delete', self.delete_model)
app.router.add_post(f'/api/{prefix}/exclude', self.exclude_model) app.router.add_post(f'/api/lm/{prefix}/exclude', self.exclude_model)
app.router.add_post(f'/api/{prefix}/fetch-civitai', self.fetch_civitai) app.router.add_post(f'/api/lm/{prefix}/fetch-civitai', self.fetch_civitai)
app.router.add_post(f'/api/{prefix}/fetch-all-civitai', self.fetch_all_civitai) app.router.add_post(f'/api/lm/{prefix}/fetch-all-civitai', self.fetch_all_civitai)
app.router.add_post(f'/api/{prefix}/relink-civitai', self.relink_civitai) app.router.add_post(f'/api/lm/{prefix}/relink-civitai', self.relink_civitai)
app.router.add_post(f'/api/{prefix}/replace-preview', self.replace_preview) app.router.add_post(f'/api/lm/{prefix}/replace-preview', self.replace_preview)
app.router.add_post(f'/api/{prefix}/save-metadata', self.save_metadata) app.router.add_post(f'/api/lm/{prefix}/save-metadata', self.save_metadata)
app.router.add_post(f'/api/{prefix}/add-tags', self.add_tags) app.router.add_post(f'/api/lm/{prefix}/add-tags', self.add_tags)
app.router.add_post(f'/api/{prefix}/rename', self.rename_model) app.router.add_post(f'/api/lm/{prefix}/rename', self.rename_model)
app.router.add_post(f'/api/{prefix}/bulk-delete', self.bulk_delete_models) app.router.add_post(f'/api/lm/{prefix}/bulk-delete', self.bulk_delete_models)
app.router.add_post(f'/api/{prefix}/verify-duplicates', self.verify_duplicates) app.router.add_post(f'/api/lm/{prefix}/verify-duplicates', self.verify_duplicates)
app.router.add_post(f'/api/{prefix}/move_model', self.move_model) app.router.add_post(f'/api/lm/{prefix}/move_model', self.move_model)
app.router.add_post(f'/api/{prefix}/move_models_bulk', self.move_models_bulk) app.router.add_post(f'/api/lm/{prefix}/move_models_bulk', self.move_models_bulk)
app.router.add_get(f'/api/{prefix}/auto-organize', self.auto_organize_models) app.router.add_get(f'/api/lm/{prefix}/auto-organize', self.auto_organize_models)
app.router.add_post(f'/api/{prefix}/auto-organize', self.auto_organize_models) app.router.add_post(f'/api/lm/{prefix}/auto-organize', self.auto_organize_models)
app.router.add_get(f'/api/{prefix}/auto-organize-progress', self.get_auto_organize_progress) app.router.add_get(f'/api/lm/{prefix}/auto-organize-progress', self.get_auto_organize_progress)
# Common query routes # Common query routes
app.router.add_get(f'/api/{prefix}/top-tags', self.get_top_tags) app.router.add_get(f'/api/lm/{prefix}/top-tags', self.get_top_tags)
app.router.add_get(f'/api/{prefix}/base-models', self.get_base_models) app.router.add_get(f'/api/lm/{prefix}/base-models', self.get_base_models)
app.router.add_get(f'/api/{prefix}/scan', self.scan_models) app.router.add_get(f'/api/lm/{prefix}/scan', self.scan_models)
app.router.add_get(f'/api/{prefix}/roots', self.get_model_roots) app.router.add_get(f'/api/lm/{prefix}/roots', self.get_model_roots)
app.router.add_get(f'/api/{prefix}/folders', self.get_folders) app.router.add_get(f'/api/lm/{prefix}/folders', self.get_folders)
app.router.add_get(f'/api/{prefix}/folder-tree', self.get_folder_tree) app.router.add_get(f'/api/lm/{prefix}/folder-tree', self.get_folder_tree)
app.router.add_get(f'/api/{prefix}/unified-folder-tree', self.get_unified_folder_tree) app.router.add_get(f'/api/lm/{prefix}/unified-folder-tree', self.get_unified_folder_tree)
app.router.add_get(f'/api/{prefix}/find-duplicates', self.find_duplicate_models) app.router.add_get(f'/api/lm/{prefix}/find-duplicates', self.find_duplicate_models)
app.router.add_get(f'/api/{prefix}/find-filename-conflicts', self.find_filename_conflicts) app.router.add_get(f'/api/lm/{prefix}/find-filename-conflicts', self.find_filename_conflicts)
app.router.add_get(f'/api/{prefix}/get-notes', self.get_model_notes) app.router.add_get(f'/api/lm/{prefix}/get-notes', self.get_model_notes)
app.router.add_get(f'/api/{prefix}/preview-url', self.get_model_preview_url) app.router.add_get(f'/api/lm/{prefix}/preview-url', self.get_model_preview_url)
app.router.add_get(f'/api/{prefix}/civitai-url', self.get_model_civitai_url) app.router.add_get(f'/api/lm/{prefix}/civitai-url', self.get_model_civitai_url)
app.router.add_get(f'/api/{prefix}/metadata', self.get_model_metadata) app.router.add_get(f'/api/lm/{prefix}/metadata', self.get_model_metadata)
app.router.add_get(f'/api/{prefix}/model-description', self.get_model_description) app.router.add_get(f'/api/lm/{prefix}/model-description', self.get_model_description)
# Autocomplete route # Autocomplete route
app.router.add_get(f'/api/{prefix}/relative-paths', self.get_relative_paths) app.router.add_get(f'/api/lm/{prefix}/relative-paths', self.get_relative_paths)
# Common CivitAI integration # Common CivitAI integration
app.router.add_get(f'/api/{prefix}/civitai/versions/{{model_id}}', self.get_civitai_versions) app.router.add_get(f'/api/lm/{prefix}/civitai/versions/{{model_id}}', self.get_civitai_versions)
app.router.add_get(f'/api/{prefix}/civitai/model/version/{{modelVersionId}}', self.get_civitai_model_by_version) app.router.add_get(f'/api/lm/{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) app.router.add_get(f'/api/lm/{prefix}/civitai/model/hash/{{hash}}', self.get_civitai_model_by_hash)
# Common Download management # Common Download management
app.router.add_post(f'/api/download-model', self.download_model) app.router.add_post(f'/api/lm/download-model', self.download_model)
app.router.add_get(f'/api/download-model-get', self.download_model_get) app.router.add_get(f'/api/lm/download-model-get', self.download_model_get)
app.router.add_get(f'/api/cancel-download-get', self.cancel_download_get) app.router.add_get(f'/api/lm/cancel-download-get', self.cancel_download_get)
app.router.add_get(f'/api/download-progress/{{download_id}}', self.get_download_progress) app.router.add_get(f'/api/lm/download-progress/{{download_id}}', self.get_download_progress)
# Add generic page route # Add generic page route
app.router.add_get(f'/{prefix}', self.handle_models_page) app.router.add_get(f'/{prefix}', self.handle_models_page)

View File

@@ -37,11 +37,11 @@ class CheckpointRoutes(BaseModelRoutes):
def setup_specific_routes(self, app: web.Application, prefix: str): def setup_specific_routes(self, app: web.Application, prefix: str):
"""Setup Checkpoint-specific routes""" """Setup Checkpoint-specific routes"""
# Checkpoint info by name # Checkpoint info by name
app.router.add_get(f'/api/{prefix}/info/{{name}}', self.get_checkpoint_info) app.router.add_get(f'/api/lm/{prefix}/info/{{name}}', self.get_checkpoint_info)
# Checkpoint roots and Unet roots # Checkpoint roots and Unet roots
app.router.add_get(f'/api/{prefix}/checkpoints_roots', self.get_checkpoints_roots) app.router.add_get(f'/api/lm/{prefix}/checkpoints_roots', self.get_checkpoints_roots)
app.router.add_get(f'/api/{prefix}/unet_roots', self.get_unet_roots) app.router.add_get(f'/api/lm/{prefix}/unet_roots', self.get_unet_roots)
def _validate_civitai_model_type(self, model_type: str) -> bool: def _validate_civitai_model_type(self, model_type: str) -> bool:
"""Validate CivitAI model type for Checkpoint""" """Validate CivitAI model type for Checkpoint"""

View File

@@ -36,7 +36,7 @@ class EmbeddingRoutes(BaseModelRoutes):
def setup_specific_routes(self, app: web.Application, prefix: str): def setup_specific_routes(self, app: web.Application, prefix: str):
"""Setup Embedding-specific routes""" """Setup Embedding-specific routes"""
# Embedding info by name # Embedding info by name
app.router.add_get(f'/api/{prefix}/info/{{name}}', self.get_embedding_info) app.router.add_get(f'/api/lm/{prefix}/info/{{name}}', self.get_embedding_info)
def _validate_civitai_model_type(self, model_type: str) -> bool: def _validate_civitai_model_type(self, model_type: str) -> bool:
"""Validate CivitAI model type for Embedding""" """Validate CivitAI model type for Embedding"""

View File

@@ -12,16 +12,16 @@ class ExampleImagesRoutes:
@staticmethod @staticmethod
def setup_routes(app): def setup_routes(app):
"""Register example images routes""" """Register example images routes"""
app.router.add_post('/api/download-example-images', ExampleImagesRoutes.download_example_images) app.router.add_post('/api/lm/download-example-images', ExampleImagesRoutes.download_example_images)
app.router.add_post('/api/import-example-images', ExampleImagesRoutes.import_example_images) app.router.add_post('/api/lm/import-example-images', ExampleImagesRoutes.import_example_images)
app.router.add_get('/api/example-images-status', ExampleImagesRoutes.get_example_images_status) app.router.add_get('/api/lm/example-images-status', ExampleImagesRoutes.get_example_images_status)
app.router.add_post('/api/pause-example-images', ExampleImagesRoutes.pause_example_images) app.router.add_post('/api/lm/pause-example-images', ExampleImagesRoutes.pause_example_images)
app.router.add_post('/api/resume-example-images', ExampleImagesRoutes.resume_example_images) app.router.add_post('/api/lm/resume-example-images', ExampleImagesRoutes.resume_example_images)
app.router.add_post('/api/open-example-images-folder', ExampleImagesRoutes.open_example_images_folder) app.router.add_post('/api/lm/open-example-images-folder', ExampleImagesRoutes.open_example_images_folder)
app.router.add_get('/api/example-image-files', ExampleImagesRoutes.get_example_image_files) app.router.add_get('/api/lm/example-image-files', ExampleImagesRoutes.get_example_image_files)
app.router.add_get('/api/has-example-images', ExampleImagesRoutes.has_example_images) app.router.add_get('/api/lm/has-example-images', ExampleImagesRoutes.has_example_images)
app.router.add_post('/api/delete-example-image', ExampleImagesRoutes.delete_example_image) app.router.add_post('/api/lm/delete-example-image', ExampleImagesRoutes.delete_example_image)
app.router.add_post('/api/force-download-example-images', ExampleImagesRoutes.force_download_example_images) app.router.add_post('/api/lm/force-download-example-images', ExampleImagesRoutes.force_download_example_images)
@staticmethod @staticmethod
async def download_example_images(request): async def download_example_images(request):

View File

@@ -40,12 +40,12 @@ class LoraRoutes(BaseModelRoutes):
def setup_specific_routes(self, app: web.Application, prefix: str): def setup_specific_routes(self, app: web.Application, prefix: str):
"""Setup LoRA-specific routes""" """Setup LoRA-specific routes"""
# LoRA-specific query routes # LoRA-specific query routes
app.router.add_get(f'/api/{prefix}/letter-counts', self.get_letter_counts) app.router.add_get(f'/api/lm/{prefix}/letter-counts', self.get_letter_counts)
app.router.add_get(f'/api/{prefix}/get-trigger-words', self.get_lora_trigger_words) app.router.add_get(f'/api/lm/{prefix}/get-trigger-words', self.get_lora_trigger_words)
app.router.add_get(f'/api/{prefix}/usage-tips-by-path', self.get_lora_usage_tips_by_path) app.router.add_get(f'/api/lm/{prefix}/usage-tips-by-path', self.get_lora_usage_tips_by_path)
# ComfyUI integration # ComfyUI integration
app.router.add_post(f'/api/{prefix}/get_trigger_words', self.get_trigger_words) app.router.add_post(f'/api/lm/{prefix}/get_trigger_words', self.get_trigger_words)
def _parse_specific_params(self, request: web.Request) -> Dict: def _parse_specific_params(self, request: web.Request) -> Dict:
"""Parse LoRA-specific parameters""" """Parse LoRA-specific parameters"""

View File

@@ -91,37 +91,37 @@ class MiscRoutes:
app.router.add_get('/api/lm/settings', MiscRoutes.get_settings) app.router.add_get('/api/lm/settings', MiscRoutes.get_settings)
app.router.add_post('/api/lm/settings', MiscRoutes.update_settings) app.router.add_post('/api/lm/settings', MiscRoutes.update_settings)
app.router.add_get('/api/health-check', lambda request: web.json_response({'status': 'ok'})) app.router.add_get('/api/lm/health-check', lambda request: web.json_response({'status': 'ok'}))
app.router.add_post('/api/open-file-location', MiscRoutes.open_file_location) app.router.add_post('/api/lm/open-file-location', MiscRoutes.open_file_location)
# Usage stats routes # Usage stats routes
app.router.add_post('/api/update-usage-stats', MiscRoutes.update_usage_stats) app.router.add_post('/api/lm/update-usage-stats', MiscRoutes.update_usage_stats)
app.router.add_get('/api/get-usage-stats', MiscRoutes.get_usage_stats) app.router.add_get('/api/lm/get-usage-stats', MiscRoutes.get_usage_stats)
# Lora code update endpoint # Lora code update endpoint
app.router.add_post('/api/update-lora-code', MiscRoutes.update_lora_code) app.router.add_post('/api/lm/update-lora-code', MiscRoutes.update_lora_code)
# Add new route for getting trained words # Add new route for getting trained words
app.router.add_get('/api/trained-words', MiscRoutes.get_trained_words) app.router.add_get('/api/lm/trained-words', MiscRoutes.get_trained_words)
# Add new route for getting model example files # Add new route for getting model example files
app.router.add_get('/api/model-example-files', MiscRoutes.get_model_example_files) app.router.add_get('/api/lm/model-example-files', MiscRoutes.get_model_example_files)
# Node registry endpoints # Node registry endpoints
app.router.add_post('/api/register-nodes', MiscRoutes.register_nodes) app.router.add_post('/api/lm/register-nodes', MiscRoutes.register_nodes)
app.router.add_get('/api/get-registry', MiscRoutes.get_registry) app.router.add_get('/api/lm/get-registry', MiscRoutes.get_registry)
# Add new route for checking if a model exists in the library # Add new route for checking if a model exists in the library
app.router.add_get('/api/check-model-exists', MiscRoutes.check_model_exists) app.router.add_get('/api/lm/check-model-exists', MiscRoutes.check_model_exists)
# Add routes for metadata archive database management # Add routes for metadata archive database management
app.router.add_post('/api/download-metadata-archive', MiscRoutes.download_metadata_archive) app.router.add_post('/api/lm/download-metadata-archive', MiscRoutes.download_metadata_archive)
app.router.add_post('/api/remove-metadata-archive', MiscRoutes.remove_metadata_archive) app.router.add_post('/api/lm/remove-metadata-archive', MiscRoutes.remove_metadata_archive)
app.router.add_get('/api/metadata-archive-status', MiscRoutes.get_metadata_archive_status) app.router.add_get('/api/lm/metadata-archive-status', MiscRoutes.get_metadata_archive_status)
# Add route for checking model versions in library # Add route for checking model versions in library
app.router.add_get('/api/model-versions-status', MiscRoutes.get_model_versions_status) app.router.add_get('/api/lm/model-versions-status', MiscRoutes.get_model_versions_status)
@staticmethod @staticmethod
async def get_settings(request): async def get_settings(request):

View File

@@ -61,46 +61,46 @@ class RecipeRoutes:
routes = cls() routes = cls()
app.router.add_get('/loras/recipes', routes.handle_recipes_page) app.router.add_get('/loras/recipes', routes.handle_recipes_page)
app.router.add_get('/api/recipes', routes.get_recipes) app.router.add_get('/api/lm/recipes', routes.get_recipes)
app.router.add_get('/api/recipe/{recipe_id}', routes.get_recipe_detail) app.router.add_get('/api/lm/recipe/{recipe_id}', routes.get_recipe_detail)
app.router.add_post('/api/recipes/analyze-image', routes.analyze_recipe_image) app.router.add_post('/api/lm/recipes/analyze-image', routes.analyze_recipe_image)
app.router.add_post('/api/recipes/analyze-local-image', routes.analyze_local_image) app.router.add_post('/api/lm/recipes/analyze-local-image', routes.analyze_local_image)
app.router.add_post('/api/recipes/save', routes.save_recipe) app.router.add_post('/api/lm/recipes/save', routes.save_recipe)
app.router.add_delete('/api/recipe/{recipe_id}', routes.delete_recipe) app.router.add_delete('/api/lm/recipe/{recipe_id}', routes.delete_recipe)
# Add new filter-related endpoints # Add new filter-related endpoints
app.router.add_get('/api/recipes/top-tags', routes.get_top_tags) app.router.add_get('/api/lm/recipes/top-tags', routes.get_top_tags)
app.router.add_get('/api/recipes/base-models', routes.get_base_models) app.router.add_get('/api/lm/recipes/base-models', routes.get_base_models)
# Add new sharing endpoints # Add new sharing endpoints
app.router.add_get('/api/recipe/{recipe_id}/share', routes.share_recipe) app.router.add_get('/api/lm/recipe/{recipe_id}/share', routes.share_recipe)
app.router.add_get('/api/recipe/{recipe_id}/share/download', routes.download_shared_recipe) app.router.add_get('/api/lm/recipe/{recipe_id}/share/download', routes.download_shared_recipe)
# Add new endpoint for getting recipe syntax # Add new endpoint for getting recipe syntax
app.router.add_get('/api/recipe/{recipe_id}/syntax', routes.get_recipe_syntax) app.router.add_get('/api/lm/recipe/{recipe_id}/syntax', routes.get_recipe_syntax)
# Add new endpoint for updating recipe metadata (name, tags and source_path) # Add new endpoint for updating recipe metadata (name, tags and source_path)
app.router.add_put('/api/recipe/{recipe_id}/update', routes.update_recipe) app.router.add_put('/api/lm/recipe/{recipe_id}/update', routes.update_recipe)
# Add new endpoint for reconnecting deleted LoRAs # Add new endpoint for reconnecting deleted LoRAs
app.router.add_post('/api/recipe/lora/reconnect', routes.reconnect_lora) app.router.add_post('/api/lm/recipe/lora/reconnect', routes.reconnect_lora)
# Add new endpoint for finding duplicate recipes # Add new endpoint for finding duplicate recipes
app.router.add_get('/api/recipes/find-duplicates', routes.find_duplicates) app.router.add_get('/api/lm/recipes/find-duplicates', routes.find_duplicates)
# Add new endpoint for bulk deletion of recipes # Add new endpoint for bulk deletion of recipes
app.router.add_post('/api/recipes/bulk-delete', routes.bulk_delete) app.router.add_post('/api/lm/recipes/bulk-delete', routes.bulk_delete)
# Start cache initialization # Start cache initialization
app.on_startup.append(routes._init_cache) app.on_startup.append(routes._init_cache)
app.router.add_post('/api/recipes/save-from-widget', routes.save_recipe_from_widget) app.router.add_post('/api/lm/recipes/save-from-widget', routes.save_recipe_from_widget)
# Add route to get recipes for a specific Lora # Add route to get recipes for a specific Lora
app.router.add_get('/api/recipes/for-lora', routes.get_recipes_for_lora) app.router.add_get('/api/lm/recipes/for-lora', routes.get_recipes_for_lora)
# Add new endpoint for scanning and rebuilding the recipe cache # Add new endpoint for scanning and rebuilding the recipe cache
app.router.add_get('/api/recipes/scan', routes.scan_recipes) app.router.add_get('/api/lm/recipes/scan', routes.scan_recipes)
async def _init_cache(self, app): async def _init_cache(self, app):
"""Initialize cache on startup""" """Initialize cache on startup"""

View File

@@ -507,12 +507,12 @@ class StatsRoutes:
app.router.add_get('/statistics', self.handle_stats_page) app.router.add_get('/statistics', self.handle_stats_page)
# Register API routes # Register API routes
app.router.add_get('/api/stats/collection-overview', self.get_collection_overview) app.router.add_get('/api/lm/stats/collection-overview', self.get_collection_overview)
app.router.add_get('/api/stats/usage-analytics', self.get_usage_analytics) app.router.add_get('/api/lm/stats/usage-analytics', self.get_usage_analytics)
app.router.add_get('/api/stats/base-model-distribution', self.get_base_model_distribution) app.router.add_get('/api/lm/stats/base-model-distribution', self.get_base_model_distribution)
app.router.add_get('/api/stats/tag-analytics', self.get_tag_analytics) app.router.add_get('/api/lm/stats/tag-analytics', self.get_tag_analytics)
app.router.add_get('/api/stats/storage-analytics', self.get_storage_analytics) app.router.add_get('/api/lm/stats/storage-analytics', self.get_storage_analytics)
app.router.add_get('/api/stats/insights', self.get_insights) app.router.add_get('/api/lm/stats/insights', self.get_insights)
async def _on_startup(self, app): async def _on_startup(self, app):
"""Initialize services when the app starts""" """Initialize services when the app starts"""

View File

@@ -17,9 +17,9 @@ class UpdateRoutes:
@staticmethod @staticmethod
def setup_routes(app): def setup_routes(app):
"""Register update check routes""" """Register update check routes"""
app.router.add_get('/api/check-updates', UpdateRoutes.check_updates) app.router.add_get('/api/lm/check-updates', UpdateRoutes.check_updates)
app.router.add_get('/api/version-info', UpdateRoutes.get_version_info) app.router.add_get('/api/lm/version-info', UpdateRoutes.get_version_info)
app.router.add_post('/api/perform-update', UpdateRoutes.perform_update) app.router.add_post('/api/lm/perform-update', UpdateRoutes.perform_update)
@staticmethod @staticmethod
async def check_updates(request): async def check_updates(request):

View File

@@ -55,48 +55,48 @@ export function getApiEndpoints(modelType) {
return { return {
// Base CRUD operations // Base CRUD operations
list: `/api/${modelType}/list`, list: `/api/lm/${modelType}/list`,
delete: `/api/${modelType}/delete`, delete: `/api/lm/${modelType}/delete`,
exclude: `/api/${modelType}/exclude`, exclude: `/api/lm/${modelType}/exclude`,
rename: `/api/${modelType}/rename`, rename: `/api/lm/${modelType}/rename`,
save: `/api/${modelType}/save-metadata`, save: `/api/lm/${modelType}/save-metadata`,
// Bulk operations // Bulk operations
bulkDelete: `/api/${modelType}/bulk-delete`, bulkDelete: `/api/lm/${modelType}/bulk-delete`,
// Tag operations // Tag operations
addTags: `/api/${modelType}/add-tags`, addTags: `/api/lm/${modelType}/add-tags`,
// Move operations (now common for all model types that support move) // Move operations (now common for all model types that support move)
moveModel: `/api/${modelType}/move_model`, moveModel: `/api/lm/${modelType}/move_model`,
moveBulk: `/api/${modelType}/move_models_bulk`, moveBulk: `/api/lm/${modelType}/move_models_bulk`,
// CivitAI integration // CivitAI integration
fetchCivitai: `/api/${modelType}/fetch-civitai`, fetchCivitai: `/api/lm/${modelType}/fetch-civitai`,
fetchAllCivitai: `/api/${modelType}/fetch-all-civitai`, fetchAllCivitai: `/api/lm/${modelType}/fetch-all-civitai`,
relinkCivitai: `/api/${modelType}/relink-civitai`, relinkCivitai: `/api/lm/${modelType}/relink-civitai`,
civitaiVersions: `/api/${modelType}/civitai/versions`, civitaiVersions: `/api/lm/${modelType}/civitai/versions`,
// Preview management // Preview management
replacePreview: `/api/${modelType}/replace-preview`, replacePreview: `/api/lm/${modelType}/replace-preview`,
// Query operations // Query operations
scan: `/api/${modelType}/scan`, scan: `/api/lm/${modelType}/scan`,
topTags: `/api/${modelType}/top-tags`, topTags: `/api/lm/${modelType}/top-tags`,
baseModels: `/api/${modelType}/base-models`, baseModels: `/api/lm/${modelType}/base-models`,
roots: `/api/${modelType}/roots`, roots: `/api/lm/${modelType}/roots`,
folders: `/api/${modelType}/folders`, folders: `/api/lm/${modelType}/folders`,
folderTree: `/api/${modelType}/folder-tree`, folderTree: `/api/lm/${modelType}/folder-tree`,
unifiedFolderTree: `/api/${modelType}/unified-folder-tree`, unifiedFolderTree: `/api/lm/${modelType}/unified-folder-tree`,
duplicates: `/api/${modelType}/find-duplicates`, duplicates: `/api/lm/${modelType}/find-duplicates`,
conflicts: `/api/${modelType}/find-filename-conflicts`, conflicts: `/api/lm/${modelType}/find-filename-conflicts`,
verify: `/api/${modelType}/verify-duplicates`, verify: `/api/lm/${modelType}/verify-duplicates`,
metadata: `/api/${modelType}/metadata`, metadata: `/api/lm/${modelType}/metadata`,
modelDescription: `/api/${modelType}/model-description`, modelDescription: `/api/lm/${modelType}/model-description`,
// Auto-organize operations // Auto-organize operations
autoOrganize: `/api/${modelType}/auto-organize`, autoOrganize: `/api/lm/${modelType}/auto-organize`,
autoOrganizeProgress: `/api/${modelType}/auto-organize-progress`, autoOrganizeProgress: `/api/lm/${modelType}/auto-organize-progress`,
// Model-specific endpoints (will be merged with specific configs) // Model-specific endpoints (will be merged with specific configs)
specific: {} specific: {}
@@ -108,24 +108,24 @@ export function getApiEndpoints(modelType) {
*/ */
export const MODEL_SPECIFIC_ENDPOINTS = { export const MODEL_SPECIFIC_ENDPOINTS = {
[MODEL_TYPES.LORA]: { [MODEL_TYPES.LORA]: {
letterCounts: `/api/${MODEL_TYPES.LORA}/letter-counts`, letterCounts: `/api/lm/${MODEL_TYPES.LORA}/letter-counts`,
notes: `/api/${MODEL_TYPES.LORA}/get-notes`, notes: `/api/lm/${MODEL_TYPES.LORA}/get-notes`,
triggerWords: `/api/${MODEL_TYPES.LORA}/get-trigger-words`, triggerWords: `/api/lm/${MODEL_TYPES.LORA}/get-trigger-words`,
previewUrl: `/api/${MODEL_TYPES.LORA}/preview-url`, previewUrl: `/api/lm/${MODEL_TYPES.LORA}/preview-url`,
civitaiUrl: `/api/${MODEL_TYPES.LORA}/civitai-url`, civitaiUrl: `/api/lm/${MODEL_TYPES.LORA}/civitai-url`,
metadata: `/api/${MODEL_TYPES.LORA}/metadata`, metadata: `/api/lm/${MODEL_TYPES.LORA}/metadata`,
getTriggerWordsPost: `/api/${MODEL_TYPES.LORA}/get_trigger_words`, getTriggerWordsPost: `/api/lm/${MODEL_TYPES.LORA}/get_trigger_words`,
civitaiModelByVersion: `/api/${MODEL_TYPES.LORA}/civitai/model/version`, civitaiModelByVersion: `/api/lm/${MODEL_TYPES.LORA}/civitai/model/version`,
civitaiModelByHash: `/api/${MODEL_TYPES.LORA}/civitai/model/hash`, civitaiModelByHash: `/api/lm/${MODEL_TYPES.LORA}/civitai/model/hash`,
}, },
[MODEL_TYPES.CHECKPOINT]: { [MODEL_TYPES.CHECKPOINT]: {
info: `/api/${MODEL_TYPES.CHECKPOINT}/info`, info: `/api/lm/${MODEL_TYPES.CHECKPOINT}/info`,
checkpoints_roots: `/api/${MODEL_TYPES.CHECKPOINT}/checkpoints_roots`, checkpoints_roots: `/api/lm/${MODEL_TYPES.CHECKPOINT}/checkpoints_roots`,
unet_roots: `/api/${MODEL_TYPES.CHECKPOINT}/unet_roots`, unet_roots: `/api/lm/${MODEL_TYPES.CHECKPOINT}/unet_roots`,
metadata: `/api/${MODEL_TYPES.CHECKPOINT}/metadata`, metadata: `/api/lm/${MODEL_TYPES.CHECKPOINT}/metadata`,
}, },
[MODEL_TYPES.EMBEDDING]: { [MODEL_TYPES.EMBEDDING]: {
metadata: `/api/${MODEL_TYPES.EMBEDDING}/metadata`, metadata: `/api/lm/${MODEL_TYPES.EMBEDDING}/metadata`,
} }
}; };
@@ -173,11 +173,11 @@ export function getCurrentModelType(explicitType = null) {
// Download API endpoints (shared across all model types) // Download API endpoints (shared across all model types)
export const DOWNLOAD_ENDPOINTS = { export const DOWNLOAD_ENDPOINTS = {
download: '/api/download-model', download: '/api/lm/download-model',
downloadGet: '/api/download-model-get', downloadGet: '/api/lm/download-model-get',
cancelGet: '/api/cancel-download-get', cancelGet: '/api/lm/cancel-download-get',
progress: '/api/download-progress', progress: '/api/lm/download-progress',
exampleImages: '/api/force-download-example-images' // New endpoint for downloading example images exampleImages: '/api/lm/force-download-example-images' // New endpoint for downloading example images
}; };
// WebSocket endpoints // WebSocket endpoints

View File

@@ -21,7 +21,7 @@ export async function fetchRecipesPage(page = 1, pageSize = 100) {
// If we have a specific recipe ID to load // If we have a specific recipe ID to load
if (pageState.customFilter?.active && pageState.customFilter?.recipeId) { if (pageState.customFilter?.active && pageState.customFilter?.recipeId) {
// Special case: load specific recipe // Special case: load specific recipe
const response = await fetch(`/api/recipe/${pageState.customFilter.recipeId}`); const response = await fetch(`/api/lm/recipe/${pageState.customFilter.recipeId}`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to load recipe: ${response.statusText}`); throw new Error(`Failed to load recipe: ${response.statusText}`);
@@ -72,7 +72,7 @@ export async function fetchRecipesPage(page = 1, pageSize = 100) {
} }
// Fetch recipes // Fetch recipes
const response = await fetch(`/api/recipes?${params.toString()}`); const response = await fetch(`/api/lm/recipes?${params.toString()}`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to load recipes: ${response.statusText}`); throw new Error(`Failed to load recipes: ${response.statusText}`);
@@ -207,7 +207,7 @@ export async function refreshRecipes() {
state.loadingManager.showSimpleLoading('Refreshing recipes...'); state.loadingManager.showSimpleLoading('Refreshing recipes...');
// Call the API endpoint to rebuild the recipe cache // Call the API endpoint to rebuild the recipe cache
const response = await fetch('/api/recipes/scan'); const response = await fetch('/api/lm/recipes/scan');
if (!response.ok) { if (!response.ok) {
const data = await response.json(); const data = await response.json();
@@ -274,7 +274,7 @@ export async function updateRecipeMetadata(filePath, updates) {
const basename = filePath.split('/').pop().split('\\').pop(); const basename = filePath.split('/').pop().split('\\').pop();
const recipeId = basename.substring(0, basename.lastIndexOf('.')); const recipeId = basename.substring(0, basename.lastIndexOf('.'));
const response = await fetch(`/api/recipe/${recipeId}/update`, { const response = await fetch(`/api/lm/recipe/${recipeId}/update`, {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -125,8 +125,8 @@ export const ModelContextMenuMixin = {
state.loadingManager.showSimpleLoading('Re-linking to Civitai...'); state.loadingManager.showSimpleLoading('Re-linking to Civitai...');
const endpoint = this.modelType === 'checkpoint' ? const endpoint = this.modelType === 'checkpoint' ?
'/api/checkpoints/relink-civitai' : '/api/lm/checkpoints/relink-civitai' :
'/api/loras/relink-civitai'; '/api/lm/loras/relink-civitai';
const response = await fetch(endpoint, { const response = await fetch(endpoint, {
method: 'POST', method: 'POST',

View File

@@ -103,7 +103,7 @@ export class RecipeContextMenu extends BaseContextMenu {
return; return;
} }
fetch(`/api/recipe/${recipeId}/syntax`) fetch(`/api/lm/recipe/${recipeId}/syntax`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.success && data.syntax) { if (data.success && data.syntax) {
@@ -126,7 +126,7 @@ export class RecipeContextMenu extends BaseContextMenu {
return; return;
} }
fetch(`/api/recipe/${recipeId}/syntax`) fetch(`/api/lm/recipe/${recipeId}/syntax`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.success && data.syntax) { if (data.success && data.syntax) {
@@ -149,7 +149,7 @@ export class RecipeContextMenu extends BaseContextMenu {
} }
// First get the recipe details to access its LoRAs // First get the recipe details to access its LoRAs
fetch(`/api/recipe/${recipeId}`) fetch(`/api/lm/recipe/${recipeId}`)
.then(response => response.json()) .then(response => response.json())
.then(recipe => { .then(recipe => {
// Clear any previous filters first // Clear any previous filters first
@@ -189,7 +189,7 @@ export class RecipeContextMenu extends BaseContextMenu {
try { try {
// First get the recipe details // First get the recipe details
const response = await fetch(`/api/recipe/${recipeId}`); const response = await fetch(`/api/lm/recipe/${recipeId}`);
const recipe = await response.json(); const recipe = await response.json();
// Get missing LoRAs // Get missing LoRAs
@@ -209,9 +209,9 @@ export class RecipeContextMenu extends BaseContextMenu {
// Determine which endpoint to use based on available data // Determine which endpoint to use based on available data
if (lora.modelVersionId) { if (lora.modelVersionId) {
endpoint = `/api/loras/civitai/model/version/${lora.modelVersionId}`; endpoint = `/api/lm/loras/civitai/model/version/${lora.modelVersionId}`;
} else if (lora.hash) { } else if (lora.hash) {
endpoint = `/api/loras/civitai/model/hash/${lora.hash}`; endpoint = `/api/lm/loras/civitai/model/hash/${lora.hash}`;
} else { } else {
console.error("Missing both hash and modelVersionId for lora:", lora); console.error("Missing both hash and modelVersionId for lora:", lora);
return null; return null;

View File

@@ -13,7 +13,7 @@ export class DuplicatesManager {
async findDuplicates() { async findDuplicates() {
try { try {
const response = await fetch('/api/recipes/find-duplicates'); const response = await fetch('/api/lm/recipes/find-duplicates');
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to find duplicates'); throw new Error('Failed to find duplicates');
} }
@@ -354,7 +354,7 @@ export class DuplicatesManager {
const recipeIds = Array.from(this.selectedForDeletion); const recipeIds = Array.from(this.selectedForDeletion);
// Call API to bulk delete // Call API to bulk delete
const response = await fetch('/api/recipes/bulk-delete', { const response = await fetch('/api/lm/recipes/bulk-delete', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -48,7 +48,7 @@ export class ModelDuplicatesManager {
// Method to check for duplicates count using existing endpoint // Method to check for duplicates count using existing endpoint
async checkDuplicatesCount() { async checkDuplicatesCount() {
try { try {
const endpoint = `/api/${this.modelType}/find-duplicates`; const endpoint = `/api/lm/${this.modelType}/find-duplicates`;
const response = await fetch(endpoint); const response = await fetch(endpoint);
if (!response.ok) { if (!response.ok) {
@@ -104,7 +104,7 @@ export class ModelDuplicatesManager {
async findDuplicates() { async findDuplicates() {
try { try {
// Determine API endpoint based on model type // Determine API endpoint based on model type
const endpoint = `/api/${this.modelType}/find-duplicates`; const endpoint = `/api/lm/${this.modelType}/find-duplicates`;
const response = await fetch(endpoint); const response = await fetch(endpoint);
if (!response.ok) { if (!response.ok) {
@@ -623,7 +623,7 @@ export class ModelDuplicatesManager {
const filePaths = Array.from(this.selectedForDeletion); const filePaths = Array.from(this.selectedForDeletion);
// Call API to bulk delete // Call API to bulk delete
const response = await fetch(`/api/${this.modelType}/bulk-delete`, { const response = await fetch(`/api/lm/${this.modelType}/bulk-delete`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -648,7 +648,7 @@ export class ModelDuplicatesManager {
// Check if there are still duplicates // Check if there are still duplicates
try { try {
const endpoint = `/api/${this.modelType}/find-duplicates`; const endpoint = `/api/lm/${this.modelType}/find-duplicates`;
const dupResponse = await fetch(endpoint); const dupResponse = await fetch(endpoint);
if (!dupResponse.ok) { if (!dupResponse.ok) {
@@ -756,7 +756,7 @@ export class ModelDuplicatesManager {
const filePaths = group.models.map(model => model.file_path); const filePaths = group.models.map(model => model.file_path);
// Make API request to verify hashes // Make API request to verify hashes
const response = await fetch(`/api/${this.modelType}/verify-duplicates`, { const response = await fetch(`/api/lm/${this.modelType}/verify-duplicates`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -203,7 +203,7 @@ class RecipeCard {
return; return;
} }
fetch(`/api/recipe/${recipeId}/syntax`) fetch(`/api/lm/recipe/${recipeId}/syntax`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.success && data.syntax) { if (data.success && data.syntax) {
@@ -299,7 +299,7 @@ class RecipeCard {
deleteBtn.disabled = true; deleteBtn.disabled = true;
// Call API to delete the recipe // Call API to delete the recipe
fetch(`/api/recipe/${recipeId}`, { fetch(`/api/lm/recipe/${recipeId}`, {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -341,7 +341,7 @@ class RecipeCard {
showToast('toast.recipes.preparingForSharing', {}, 'info'); showToast('toast.recipes.preparingForSharing', {}, 'info');
// Call the API to process the image with metadata // Call the API to process the image with metadata
fetch(`/api/recipe/${recipeId}/share`) fetch(`/api/lm/recipe/${recipeId}/share`)
.then(response => { .then(response => {
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to prepare recipe for sharing'); throw new Error('Failed to prepare recipe for sharing');

View File

@@ -784,7 +784,7 @@ class RecipeModal {
try { try {
// Fetch recipe syntax from backend // Fetch recipe syntax from backend
const response = await fetch(`/api/recipe/${this.recipeId}/syntax`); const response = await fetch(`/api/lm/recipe/${this.recipeId}/syntax`);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to get recipe syntax: ${response.statusText}`); throw new Error(`Failed to get recipe syntax: ${response.statusText}`);
@@ -830,9 +830,9 @@ class RecipeModal {
// Determine which endpoint to use based on available data // Determine which endpoint to use based on available data
if (lora.modelVersionId) { if (lora.modelVersionId) {
endpoint = `/api/loras/civitai/model/version/${lora.modelVersionId}`; endpoint = `/api/lm/loras/civitai/model/version/${lora.modelVersionId}`;
} else if (lora.hash) { } else if (lora.hash) {
endpoint = `/api/loras/civitai/model/hash/${lora.hash}`; endpoint = `/api/lm/loras/civitai/model/hash/${lora.hash}`;
} else { } else {
console.error("Missing both hash and modelVersionId for lora:", lora); console.error("Missing both hash and modelVersionId for lora:", lora);
return null; return null;
@@ -1003,7 +1003,7 @@ class RecipeModal {
state.loadingManager.showSimpleLoading('Reconnecting LoRA...'); state.loadingManager.showSimpleLoading('Reconnecting LoRA...');
// Call API to reconnect the LoRA // Call API to reconnect the LoRA
const response = await fetch('/api/recipe/lora/reconnect', { const response = await fetch('/api/lm/recipe/lora/reconnect', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -46,7 +46,7 @@ export class AlphabetBar {
*/ */
async fetchLetterCounts() { async fetchLetterCounts() {
try { try {
const response = await fetch('/api/loras/letter-counts'); const response = await fetch('/api/lm/loras/letter-counts');
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch letter counts: ${response.statusText}`); throw new Error(`Failed to fetch letter counts: ${response.statusText}`);

View File

@@ -169,7 +169,7 @@ class InitializationManager {
*/ */
pollProgress() { pollProgress() {
const checkProgress = () => { const checkProgress = () => {
fetch('/api/init-status') fetch('/api/lm/init-status')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
this.handleProgressUpdate(data); this.handleProgressUpdate(data);

View File

@@ -186,7 +186,7 @@ async function handleExampleImagesAccess(card, modelType) {
const modelHash = card.dataset.sha256; const modelHash = card.dataset.sha256;
try { try {
const response = await fetch(`/api/has-example-images?model_hash=${modelHash}`); const response = await fetch(`/api/lm/has-example-images?model_hash=${modelHash}`);
const data = await response.json(); const data = await response.json();
if (data.has_images) { if (data.has_images) {

View File

@@ -460,7 +460,7 @@ async function saveNotes(filePath) {
*/ */
async function openFileLocation(filePath) { async function openFileLocation(filePath) {
try { try {
const resp = await fetch('/api/open-file-location', { const resp = await fetch('/api/lm/open-file-location', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ 'file_path': filePath }) body: JSON.stringify({ 'file_path': filePath })

View File

@@ -22,7 +22,7 @@ export function loadRecipesForLora(loraName, sha256) {
`; `;
// Fetch recipes that use this Lora by hash // Fetch recipes that use this Lora by hash
fetch(`/api/recipes/for-lora?hash=${encodeURIComponent(sha256.toLowerCase())}`) fetch(`/api/lm/recipes/for-lora?hash=${encodeURIComponent(sha256.toLowerCase())}`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (!data.success) { if (!data.success) {
@@ -166,7 +166,7 @@ function copyRecipeSyntax(recipeId) {
return; return;
} }
fetch(`/api/recipe/${recipeId}/syntax`) fetch(`/api/lm/recipe/${recipeId}/syntax`)
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if (data.success && data.syntax) { if (data.success && data.syntax) {

View File

@@ -14,7 +14,7 @@ import { getModelApiClient } from '../../api/modelApiFactory.js';
*/ */
async function fetchTrainedWords(filePath) { async function fetchTrainedWords(filePath) {
try { try {
const response = await fetch(`/api/trained-words?file_path=${encodeURIComponent(filePath)}`); const response = await fetch(`/api/lm/trained-words?file_path=${encodeURIComponent(filePath)}`);
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {

View File

@@ -408,7 +408,7 @@ export function initMediaControlHandlers(container) {
try { try {
// Call the API to delete the custom example // Call the API to delete the custom example
const response = await fetch('/api/delete-example-image', { const response = await fetch('/api/lm/delete-example-image', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -29,7 +29,7 @@ export async function loadExampleImages(images, modelHash) {
let localFiles = []; let localFiles = [];
try { try {
const endpoint = '/api/example-image-files'; const endpoint = '/api/lm/example-image-files';
const params = `model_hash=${modelHash}`; const params = `model_hash=${modelHash}`;
const response = await fetch(`${endpoint}?${params}`); const response = await fetch(`${endpoint}?${params}`);
@@ -374,7 +374,7 @@ async function handleImportFiles(files, modelHash, importContainer) {
}); });
// Call API to import files // Call API to import files
const response = await fetch('/api/import-example-images', { const response = await fetch('/api/lm/import-example-images', {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
@@ -386,7 +386,7 @@ async function handleImportFiles(files, modelHash, importContainer) {
} }
// Get updated local files // Get updated local files
const updatedFilesResponse = await fetch(`/api/example-image-files?model_hash=${modelHash}`); const updatedFilesResponse = await fetch(`/api/lm/example-image-files?model_hash=${modelHash}`);
const updatedFilesResult = await updatedFilesResponse.json(); const updatedFilesResult = await updatedFilesResponse.json();
if (!updatedFilesResult.success) { if (!updatedFilesResult.success) {

View File

@@ -172,7 +172,7 @@ export class ExampleImagesManager {
async checkDownloadStatus() { async checkDownloadStatus() {
try { try {
const response = await fetch('/api/example-images-status'); const response = await fetch('/api/lm/example-images-status');
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {
@@ -236,7 +236,7 @@ export class ExampleImagesManager {
const optimize = state.global.settings.optimizeExampleImages; const optimize = state.global.settings.optimizeExampleImages;
const response = await fetch('/api/download-example-images', { const response = await fetch('/api/lm/download-example-images', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -278,7 +278,7 @@ export class ExampleImagesManager {
} }
try { try {
const response = await fetch('/api/pause-example-images', { const response = await fetch('/api/lm/pause-example-images', {
method: 'POST' method: 'POST'
}); });
@@ -314,7 +314,7 @@ export class ExampleImagesManager {
} }
try { try {
const response = await fetch('/api/resume-example-images', { const response = await fetch('/api/lm/resume-example-images', {
method: 'POST' method: 'POST'
}); });
@@ -358,7 +358,7 @@ export class ExampleImagesManager {
async updateProgress() { async updateProgress() {
try { try {
const response = await fetch('/api/example-images-status'); const response = await fetch('/api/lm/example-images-status');
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {
@@ -727,7 +727,7 @@ export class ExampleImagesManager {
const outputDir = document.getElementById('exampleImagesPath').value; const outputDir = document.getElementById('exampleImagesPath').value;
const optimize = state.global.settings.optimizeExampleImages; const optimize = state.global.settings.optimizeExampleImages;
const response = await fetch('/api/download-example-images', { const response = await fetch('/api/lm/download-example-images', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -66,7 +66,7 @@ export class FilterManager {
tagsContainer.innerHTML = '<div class="tags-loading">Loading tags...</div>'; tagsContainer.innerHTML = '<div class="tags-loading">Loading tags...</div>';
// Determine the API endpoint based on the page type // Determine the API endpoint based on the page type
const tagsEndpoint = `/api/${this.currentPage}/top-tags?limit=20`; const tagsEndpoint = `/api/lm/${this.currentPage}/top-tags?limit=20`;
const response = await fetch(tagsEndpoint); const response = await fetch(tagsEndpoint);
if (!response.ok) throw new Error('Failed to fetch tags'); if (!response.ok) throw new Error('Failed to fetch tags');
@@ -134,7 +134,7 @@ export class FilterManager {
if (!baseModelTagsContainer) return; if (!baseModelTagsContainer) return;
// Set the API endpoint based on current page // Set the API endpoint based on current page
const apiEndpoint = `/api/${this.currentPage}/base-models`; const apiEndpoint = `/api/lm/${this.currentPage}/base-models`;
// Fetch base models // Fetch base models
fetch(apiEndpoint) fetch(apiEndpoint)

View File

@@ -429,7 +429,7 @@ export class SettingsManager {
if (!defaultLoraRootSelect) return; if (!defaultLoraRootSelect) return;
// Fetch lora roots // Fetch lora roots
const response = await fetch('/api/loras/roots'); const response = await fetch('/api/lm/loras/roots');
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to fetch LoRA roots'); throw new Error('Failed to fetch LoRA roots');
} }
@@ -468,7 +468,7 @@ export class SettingsManager {
if (!defaultCheckpointRootSelect) return; if (!defaultCheckpointRootSelect) return;
// Fetch checkpoint roots // Fetch checkpoint roots
const response = await fetch('/api/checkpoints/roots'); const response = await fetch('/api/lm/checkpoints/roots');
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to fetch checkpoint roots'); throw new Error('Failed to fetch checkpoint roots');
} }
@@ -507,7 +507,7 @@ export class SettingsManager {
if (!defaultEmbeddingRootSelect) return; if (!defaultEmbeddingRootSelect) return;
// Fetch embedding roots // Fetch embedding roots
const response = await fetch('/api/embeddings/roots'); const response = await fetch('/api/lm/embeddings/roots');
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to fetch embedding roots'); throw new Error('Failed to fetch embedding roots');
} }
@@ -1023,7 +1023,7 @@ export class SettingsManager {
async updateMetadataArchiveStatus() { async updateMetadataArchiveStatus() {
try { try {
const response = await fetch('/api/metadata-archive-status'); const response = await fetch('/api/lm/metadata-archive-status');
const data = await response.json(); const data = await response.json();
const statusContainer = document.getElementById('metadataArchiveStatus'); const statusContainer = document.getElementById('metadataArchiveStatus');
@@ -1152,7 +1152,7 @@ export class SettingsManager {
// Wait for WebSocket to be ready // Wait for WebSocket to be ready
await wsReady; await wsReady;
const response = await fetch(`/api/download-metadata-archive?download_id=${encodeURIComponent(actualDownloadId)}`, { const response = await fetch(`/api/lm/download-metadata-archive?download_id=${encodeURIComponent(actualDownloadId)}`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -1215,7 +1215,7 @@ export class SettingsManager {
removeBtn.textContent = translate('settings.metadataArchive.removingButton'); removeBtn.textContent = translate('settings.metadataArchive.removingButton');
} }
const response = await fetch('/api/remove-metadata-archive', { const response = await fetch('/api/lm/remove-metadata-archive', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -97,7 +97,7 @@ export class UpdateService {
try { try {
// Call backend API to check for updates with nightly flag // Call backend API to check for updates with nightly flag
const response = await fetch(`/api/check-updates?nightly=${this.nightlyMode}`); const response = await fetch(`/api/lm/check-updates?nightly=${this.nightlyMode}`);
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {
@@ -280,7 +280,7 @@ export class UpdateService {
// Update progress // Update progress
this.updateProgress(10, translate('update.updateProgress.preparing')); this.updateProgress(10, translate('update.updateProgress.preparing'));
const response = await fetch('/api/perform-update', { const response = await fetch('/api/lm/perform-update', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -444,7 +444,7 @@ export class UpdateService {
async checkVersionInfo() { async checkVersionInfo() {
try { try {
// Call API to get current version info // Call API to get current version info
const response = await fetch('/api/version-info'); const response = await fetch('/api/lm/version-info');
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {

View File

@@ -68,7 +68,7 @@ export class DownloadManager {
formData.append('metadata', JSON.stringify(completeMetadata)); formData.append('metadata', JSON.stringify(completeMetadata));
// Send save request // Send save request
const response = await fetch('/api/recipes/save', { const response = await fetch('/api/lm/recipes/save', {
method: 'POST', method: 'POST',
body: formData body: formData
}); });

View File

@@ -100,7 +100,7 @@ export class FolderBrowser {
} }
// Fetch LoRA roots // Fetch LoRA roots
const rootsResponse = await fetch('/api/loras/roots'); const rootsResponse = await fetch('/api/lm/loras/roots');
if (!rootsResponse.ok) { if (!rootsResponse.ok) {
throw new Error(`Failed to fetch LoRA roots: ${rootsResponse.status}`); throw new Error(`Failed to fetch LoRA roots: ${rootsResponse.status}`);
} }
@@ -120,7 +120,7 @@ export class FolderBrowser {
} }
// Fetch folders // Fetch folders
const foldersResponse = await fetch('/api/loras/folders'); const foldersResponse = await fetch('/api/lm/loras/folders');
if (!foldersResponse.ok) { if (!foldersResponse.ok) {
throw new Error(`Failed to fetch folders: ${foldersResponse.status}`); throw new Error(`Failed to fetch folders: ${foldersResponse.status}`);
} }

View File

@@ -62,7 +62,7 @@ export class ImageProcessor {
async analyzeImageFromUrl(url) { async analyzeImageFromUrl(url) {
try { try {
// Call the API with URL data // Call the API with URL data
const response = await fetch('/api/recipes/analyze-image', { const response = await fetch('/api/lm/recipes/analyze-image', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -110,7 +110,7 @@ export class ImageProcessor {
async analyzeImageFromLocalPath(path) { async analyzeImageFromLocalPath(path) {
try { try {
// Call the API with local path data // Call the API with local path data
const response = await fetch('/api/recipes/analyze-local-image', { const response = await fetch('/api/lm/recipes/analyze-local-image', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -169,7 +169,7 @@ export class ImageProcessor {
formData.append('image', this.importManager.recipeImage); formData.append('image', this.importManager.recipeImage);
// Upload image for analysis // Upload image for analysis
const response = await fetch('/api/recipes/analyze-image', { const response = await fetch('/api/lm/recipes/analyze-image', {
method: 'POST', method: 'POST',
body: formData body: formData
}); });

View File

@@ -65,12 +65,12 @@ class StatisticsManager {
storageAnalytics, storageAnalytics,
insights insights
] = await Promise.all([ ] = await Promise.all([
this.fetchData('/api/stats/collection-overview'), this.fetchData('/api/lm/stats/collection-overview'),
this.fetchData('/api/stats/usage-analytics'), this.fetchData('/api/lm/stats/usage-analytics'),
this.fetchData('/api/stats/base-model-distribution'), this.fetchData('/api/lm/stats/base-model-distribution'),
this.fetchData('/api/stats/tag-analytics'), this.fetchData('/api/lm/stats/tag-analytics'),
this.fetchData('/api/stats/storage-analytics'), this.fetchData('/api/lm/stats/storage-analytics'),
this.fetchData('/api/stats/insights') this.fetchData('/api/lm/stats/insights')
]); ]);
this.data = { this.data = {

View File

@@ -370,7 +370,7 @@ export function copyLoraSyntax(card) {
export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntaxType = 'lora') { export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntaxType = 'lora') {
try { try {
// Get registry information from the new endpoint // Get registry information from the new endpoint
const registryResponse = await fetch('/api/get-registry'); const registryResponse = await fetch('/api/lm/get-registry');
const registryData = await registryResponse.json(); const registryData = await registryResponse.json();
if (!registryData.success) { if (!registryData.success) {
@@ -417,7 +417,7 @@ export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntax
async function sendToSpecificNode(nodeIds, loraSyntax, replaceMode, syntaxType) { async function sendToSpecificNode(nodeIds, loraSyntax, replaceMode, syntaxType) {
try { try {
// Call the backend API to update the lora code // Call the backend API to update the lora code
const response = await fetch('/api/update-lora-code', { const response = await fetch('/api/lm/update-lora-code', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
@@ -676,7 +676,7 @@ initializeMouseTracking();
*/ */
export async function openExampleImagesFolder(modelHash) { export async function openExampleImagesFolder(modelHash) {
try { try {
const response = await fetch('/api/open-example-images-folder', { const response = await fetch('/api/lm/open-example-images-folder', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'

View File

@@ -156,7 +156,7 @@ class AutoComplete {
async search(term = '') { async search(term = '') {
try { try {
this.currentSearchTerm = term; this.currentSearchTerm = term;
const response = await api.fetchApi(`/${this.modelType}/relative-paths?search=${encodeURIComponent(term)}&limit=${this.options.maxItems}`); const response = await api.fetchApi(`/lm/${this.modelType}/relative-paths?search=${encodeURIComponent(term)}&limit=${this.options.maxItems}`);
const data = await response.json(); const data = await response.json();
if (data.success && data.relative_paths && data.relative_paths.length > 0) { if (data.success && data.relative_paths && data.relative_paths.length > 0) {
@@ -383,7 +383,7 @@ class AutoComplete {
// Get usage tips and extract strength // Get usage tips and extract strength
let strength = 1.0; // Default strength let strength = 1.0; // Default strength
try { try {
const response = await api.fetchApi(`/loras/usage-tips-by-path?relative_path=${encodeURIComponent(relativePath)}`); const response = await api.fetchApi(`/lm/loras/usage-tips-by-path?relative_path=${encodeURIComponent(relativePath)}`);
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
if (data.success && data.usage_tips) { if (data.success && data.usage_tips) {

View File

@@ -269,7 +269,7 @@ export class PreviewTooltip {
this.currentLora = loraName; this.currentLora = loraName;
// Get preview URL // Get preview URL
const response = await api.fetchApi(`/loras/preview-url?name=${encodeURIComponent(loraName)}`, { const response = await api.fetchApi(`/lm/loras/preview-url?name=${encodeURIComponent(loraName)}`, {
method: 'GET' method: 'GET'
}); });

View File

@@ -491,7 +491,7 @@ export function createContextMenu(x, y, loraName, widget, previewTooltip, render
try { try {
// Get Civitai URL from API // Get Civitai URL from API
const response = await api.fetchApi(`/loras/civitai-url?name=${encodeURIComponent(loraName)}`, { const response = await api.fetchApi(`/lm/loras/civitai-url?name=${encodeURIComponent(loraName)}`, {
method: 'GET' method: 'GET'
}); });
@@ -547,7 +547,7 @@ export function createContextMenu(x, y, loraName, widget, previewTooltip, render
try { try {
// Get notes from API // Get notes from API
const response = await api.fetchApi(`/loras/get-notes?name=${encodeURIComponent(loraName)}`, { const response = await api.fetchApi(`/lm/loras/get-notes?name=${encodeURIComponent(loraName)}`, {
method: 'GET' method: 'GET'
}); });
@@ -584,7 +584,7 @@ export function createContextMenu(x, y, loraName, widget, previewTooltip, render
try { try {
// Get trigger words from API // Get trigger words from API
const response = await api.fetchApi(`/loras/get-trigger-words?name=${encodeURIComponent(loraName)}`, { const response = await api.fetchApi(`/lm/loras/get-trigger-words?name=${encodeURIComponent(loraName)}`, {
method: 'GET' method: 'GET'
}); });

View File

@@ -70,7 +70,7 @@ export async function saveRecipeDirectly() {
} }
// Send the request to the backend API // Send the request to the backend API
const response = await fetch('/api/recipes/save-from-widget', { const response = await fetch('/api/lm/recipes/save-from-widget', {
method: 'POST' method: 'POST'
}); });

View File

@@ -107,7 +107,7 @@ const initializeWidgets = () => {
// Fetch version info from the API // Fetch version info from the API
const fetchVersionInfo = async () => { const fetchVersionInfo = async () => {
try { try {
const response = await fetch('/api/version-info'); const response = await fetch('/api/lm/version-info');
const data = await response.json(); const data = await response.json();
if (data.success) { if (data.success) {

View File

@@ -38,7 +38,7 @@ app.registerExtension({
async updateUsageStats(promptId) { async updateUsageStats(promptId) {
try { try {
// Call backend endpoint with the prompt_id // Call backend endpoint with the prompt_id
const response = await fetch(`/api/update-usage-stats`, { const response = await fetch(`/api/lm/update-usage-stats`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@@ -79,7 +79,7 @@ app.registerExtension({
} }
} }
const response = await fetch('/api/register-nodes', { const response = await fetch('/api/lm/register-nodes', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@@ -158,7 +158,7 @@ app.registerExtension({
try { try {
// Search for current relative path // Search for current relative path
const response = await api.fetchApi(`/${modelType}/relative-paths?search=${encodeURIComponent(fileName)}&limit=2`); const response = await api.fetchApi(`/lm/${modelType}/relative-paths?search=${encodeURIComponent(fileName)}&limit=2`);
const data = await response.json(); const data = await response.json();
if (!data.success || !data.relative_paths || data.relative_paths.length === 0) { if (!data.success || !data.relative_paths || data.relative_paths.length === 0) {