Add route to list model types (#4846)

* Add list models route

* Better readable model types list
This commit is contained in:
Tom 2024-09-17 09:22:05 +01:00 committed by GitHub
parent 254838f23c
commit 7183fd1665
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -221,6 +221,12 @@ class PromptServer():
def get_embeddings(self):
embeddings = folder_paths.get_filename_list("embeddings")
return web.json_response(list(map(lambda a: os.path.splitext(a)[0], embeddings)))
@routes.get("/models")
def list_model_types(request):
model_types = list(folder_paths.folder_names_and_paths.keys())
return web.json_response(model_types)
@routes.get("/models/{folder}")
async def get_models(request):