mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-26 15:38:52 -03:00
Refactor API routes and enhance recipe and filter management
- Removed the handle_get_recipes method from ApiRoutes to streamline the API structure. - Updated RecipeRoutes to include logging for recipe retrieval requests and improved filter management. - Consolidated filter management logic in FilterManager to support both recipes and loras, enhancing code reusability. - Deleted obsolete LoraSearchManager and RecipeSearchManager classes to simplify the search functionality. - Improved infinite scroll implementation for both recipes and loras, ensuring consistent loading behavior across pages.
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
from aiohttp import web
|
||||
from typing import Dict
|
||||
import tempfile
|
||||
import json
|
||||
import aiohttp
|
||||
import asyncio
|
||||
from ..utils.exif_utils import ExifUtils
|
||||
from ..utils.recipe_parsers import RecipeParserFactory
|
||||
@@ -70,6 +68,7 @@ class RecipeRoutes:
|
||||
async def get_recipes(self, request: web.Request) -> web.Response:
|
||||
"""API endpoint for getting paginated recipes"""
|
||||
try:
|
||||
logger.info(f"get_recipes, Request: {request}")
|
||||
# Get query parameters with defaults
|
||||
page = int(request.query.get('page', '1'))
|
||||
page_size = int(request.query.get('page_size', '20'))
|
||||
@@ -100,7 +99,8 @@ class RecipeRoutes:
|
||||
'lora_name': search_lora_name,
|
||||
'lora_model': search_lora_model
|
||||
}
|
||||
|
||||
|
||||
logger.info(f"get_recipes, Filters: {filters}, Search Options: {search_options}")
|
||||
# Get paginated data
|
||||
result = await self.recipe_scanner.get_paginated_data(
|
||||
page=page,
|
||||
@@ -136,7 +136,7 @@ class RecipeRoutes:
|
||||
"""Get detailed information about a specific recipe"""
|
||||
try:
|
||||
recipe_id = request.match_info['recipe_id']
|
||||
|
||||
|
||||
# Get all recipes from cache
|
||||
cache = await self.recipe_scanner.get_cached_data()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user