simplify(compat): image_generation_tool — drop 2 re-export noqa blocks (13 names), repoint 2 callers + 2 tests to image_generation_catalog
This commit is contained in:
@@ -479,8 +479,8 @@ def _detect_active_provider_index(providers: list, config: dict, *, force_fresh:
|
||||
|
||||
|
||||
def _fal_model_catalog():
|
||||
"""Lazy-load the FAL model catalog from the tool module."""
|
||||
from tools.image_generation_tool import FAL_MODELS, DEFAULT_MODEL
|
||||
"""Lazy-load the FAL model catalog."""
|
||||
from tools.image_generation_catalog import FAL_MODELS, DEFAULT_MODEL
|
||||
return FAL_MODELS, DEFAULT_MODEL
|
||||
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ class FalImageGenProvider(StaticImageGenProvider):
|
||||
return False
|
||||
|
||||
def list_models(self) -> List[Dict[str, Any]]:
|
||||
import tools.image_generation_tool as _it
|
||||
return catalog_rows(_it.FAL_MODELS)
|
||||
from tools.image_generation_catalog import FAL_MODELS
|
||||
return catalog_rows(FAL_MODELS)
|
||||
|
||||
def default_model(self) -> Optional[str]:
|
||||
import tools.image_generation_tool as _it
|
||||
return _it.DEFAULT_MODEL
|
||||
from tools.image_generation_catalog import DEFAULT_MODEL
|
||||
return DEFAULT_MODEL
|
||||
|
||||
def capabilities(self) -> Dict[str, Any]:
|
||||
# Image-to-image depends on the selected model (``edit_endpoint``); upscale works for any.
|
||||
|
||||
@@ -35,13 +35,13 @@ class TestFalImageGenProviderSurface:
|
||||
|
||||
def test_default_model_matches_legacy(self):
|
||||
from plugins.image_gen.fal import FalImageGenProvider
|
||||
from tools.image_generation_tool import DEFAULT_MODEL
|
||||
from tools.image_generation_catalog import DEFAULT_MODEL
|
||||
|
||||
assert FalImageGenProvider().default_model() == DEFAULT_MODEL
|
||||
|
||||
def test_list_models_uses_legacy_catalog(self):
|
||||
from plugins.image_gen.fal import FalImageGenProvider
|
||||
from tools.image_generation_tool import FAL_MODELS
|
||||
from tools.image_generation_catalog import FAL_MODELS
|
||||
|
||||
provider = FalImageGenProvider()
|
||||
models = provider.list_models()
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestFalEditPayload:
|
||||
|
||||
|
||||
def test_text_only_model_has_no_edit_endpoint(self):
|
||||
from tools.image_generation_tool import FAL_MODELS
|
||||
from tools.image_generation_catalog import FAL_MODELS
|
||||
|
||||
# z-image/turbo is a pure text-to-image model — no edit endpoint.
|
||||
assert "edit_endpoint" not in FAL_MODELS["fal-ai/z-image/turbo"]
|
||||
|
||||
@@ -29,9 +29,8 @@ def _load_fal_client() -> Any:
|
||||
|
||||
|
||||
from tools.debug_helpers import DebugSession
|
||||
from tools.fal_common import ( # noqa: F401 — _normalize_fal_queue_url_format re-exported for tests
|
||||
_ManagedFalSyncClient, _extract_http_status, _normalize_fal_queue_url_format)
|
||||
from tools.image_generation_catalog import ( # noqa: F401 — re-exported (plugins/tests/tools_config)
|
||||
from tools.fal_common import _ManagedFalSyncClient, _extract_http_status, _normalize_fal_queue_url_format
|
||||
from tools.image_generation_catalog import (
|
||||
DEFAULT_ASPECT_RATIO, DEFAULT_MODEL, FAL_MODELS, UPSCALER_CREATIVITY, UPSCALER_DEFAULT_PROMPT,
|
||||
UPSCALER_FACTOR, UPSCALER_GUIDANCE_SCALE, UPSCALER_MODEL, UPSCALER_NEGATIVE_PROMPT,
|
||||
UPSCALER_NUM_INFERENCE_STEPS, UPSCALER_RESEMBLANCE, UPSCALER_SAFETY_CHECKER, VALID_ASPECT_RATIOS,
|
||||
|
||||
Reference in New Issue
Block a user