mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fix incorrect use of a singleton list (#3914)
## What type of PR is this? (check all applicable) - [x] Refactor - [ ] Feature - [ ] Bug Fix - [ ] Optimization - [ ] Documentation Update - [ ] Community Node Submission ## Description `search_for_models` is explicitly typed as taking a singular `Path` but was given a list because some later function in the stack expects a list. Fixed that to be compatible with the paths. This is the only use of that function. The `list()` call is unrelated but removes a type warning since it's supposed to return a list, not a set. I can revert it if requested. This was found through pylance type errors. Go types!
This commit is contained in:
commit
2b65e40896
@ -298,7 +298,7 @@ async def search_for_models(
|
|||||||
)->List[pathlib.Path]:
|
)->List[pathlib.Path]:
|
||||||
if not search_path.is_dir():
|
if not search_path.is_dir():
|
||||||
raise HTTPException(status_code=404, detail=f"The search path '{search_path}' does not exist or is not directory")
|
raise HTTPException(status_code=404, detail=f"The search path '{search_path}' does not exist or is not directory")
|
||||||
return ApiDependencies.invoker.services.model_manager.search_for_models([search_path])
|
return ApiDependencies.invoker.services.model_manager.search_for_models(search_path)
|
||||||
|
|
||||||
@models_router.get(
|
@models_router.get(
|
||||||
"/ckpt_confs",
|
"/ckpt_confs",
|
||||||
|
@ -600,7 +600,7 @@ class ModelManagerService(ModelManagerServiceBase):
|
|||||||
"""
|
"""
|
||||||
Return list of all models found in the designated directory.
|
Return list of all models found in the designated directory.
|
||||||
"""
|
"""
|
||||||
search = FindModels(directory,self.logger)
|
search = FindModels([directory], self.logger)
|
||||||
return search.list_models()
|
return search.list_models()
|
||||||
|
|
||||||
def sync_to_config(self):
|
def sync_to_config(self):
|
||||||
|
@ -98,6 +98,6 @@ class FindModels(ModelSearch):
|
|||||||
|
|
||||||
def list_models(self) -> List[Path]:
|
def list_models(self) -> List[Path]:
|
||||||
self.search()
|
self.search()
|
||||||
return self.models_found
|
return list(self.models_found)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user