checkpoint

This commit is contained in:
Will Miao
2025-03-14 21:10:24 +08:00
parent 426e84cfa3
commit 5e4d2c7760
5 changed files with 664 additions and 693 deletions

View File

@@ -40,6 +40,7 @@ class ApiRoutes:
app.router.add_post('/api/fetch-all-civitai', routes.fetch_all_civitai)
app.router.add_get('/ws/fetch-progress', ws_manager.handle_connection)
app.router.add_get('/api/lora-roots', routes.get_lora_roots)
app.router.add_get('/api/folders', routes.get_folders)
app.router.add_get('/api/civitai/versions/{model_id}', routes.get_civitai_versions)
app.router.add_post('/api/download-lora', routes.download_lora)
app.router.add_post('/api/settings', routes.update_settings)
@@ -520,6 +521,13 @@ class ApiRoutes:
return web.json_response({
'roots': config.loras_roots
})
async def get_folders(self, request: web.Request) -> web.Response:
"""Get all folders in the cache"""
cache = await self.scanner.get_cached_data()
return web.json_response({
'folders': cache.folders
})
async def get_civitai_versions(self, request: web.Request) -> web.Response:
"""Get available versions for a Civitai model with local availability info"""

View File

@@ -180,7 +180,6 @@ class RecipeRoutes:
# Extract metadata from the image using ExifUtils
user_comment = ExifUtils.extract_user_comment(temp_path)
print(f"User comment: {user_comment}", file=sys.stderr)
# If no metadata found, return a more specific error
if not user_comment:
@@ -191,7 +190,6 @@ class RecipeRoutes:
# Parse the recipe metadata
metadata = ExifUtils.parse_recipe_metadata(user_comment)
print(f"Metadata: {metadata}", file=sys.stderr)
# Look for Civitai resources in the metadata
civitai_resources = metadata.get('loras', [])
@@ -220,7 +218,6 @@ class RecipeRoutes:
# Get additional info from Civitai
civitai_info = await self.civitai_client.get_model_version_info(model_version_id)
print(f"Civitai info: {civitai_info}", file=sys.stderr)
# Check if this LoRA exists locally by SHA256 hash
exists_locally = False