Commit 392895da authored by Your Name's avatar Your Name

Fix: Add missing get_cached_model_path and get_model_cache_dir methods to MultiModelManager

- Added proxy methods to MultiModelManager class for cache module functions
- These methods are called by images.py sd.cpp fallback path
- Fixes AttributeError: 'MultiModelManager' object has no attribute 'get_cached_model_path'
parent ce75ec47
...@@ -782,19 +782,37 @@ class MultiModelManager: ...@@ -782,19 +782,37 @@ class MultiModelManager:
def get_currently_loaded_model_name(self) -> Optional[str]: def get_currently_loaded_model_name(self) -> Optional[str]:
""" """
Get the canonical name of the model currently loaded in VRAM. Get the canonical name of the model currently loaded in VRAM.
Returns the model key from self.models if any model is loaded, Returns the model key from self.models if any model is loaded,
or None if no models are loaded. or None if no models are loaded.
""" """
if not self.models: if not self.models:
return None return None
# If we have a tracked current model, return it # If we have a tracked current model, return it
if self.current_model_key and self.current_model_key in self.models: if self.current_model_key and self.current_model_key in self.models:
return self.current_model_key return self.current_model_key
# Otherwise return the first loaded model (there should only be one in ondemand mode) # Otherwise return the first loaded model (there should only be one in ondemand mode)
return list(self.models.keys())[0] if self.models else None return list(self.models.keys())[0] if self.models else None
def get_cached_model_path(self, url: str) -> Optional[str]:
"""
Check if a model URL is already cached.
This is a proxy method to the cache module function.
Returns the cached path if the model is cached, None otherwise.
"""
return get_cached_model_path(url)
def get_model_cache_dir(self) -> str:
"""
Get the model cache directory.
This is a proxy method to the cache module function.
Returns the path to the model cache directory.
"""
return get_model_cache_dir()
def unload_all_models(self): def unload_all_models(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment