Fix /embeddings route being broken.

This commit is contained in:
comfyanonymous 2023-03-19 11:29:03 -04:00
parent edfc4ca663
commit 3ff4c155c9
1 changed files with 2 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import os
import sys import sys
import asyncio import asyncio
import nodes import nodes
import folder_paths
import execution import execution
import uuid import uuid
import json import json
@ -75,10 +76,7 @@ class PromptServer():
@routes.get("/embeddings") @routes.get("/embeddings")
def get_embeddings(self): def get_embeddings(self):
models_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "models") embeddings = folder_paths.get_filename_list("embeddings")
embed_dir = os.path.join(models_dir, "embeddings")
embeddings = nodes.filter_files_extensions(nodes.recursive_search(embed_dir), nodes.supported_pt_extensions)
return web.json_response(list(map(lambda a: os.path.splitext(a)[0].lower(), embeddings))) return web.json_response(list(map(lambda a: os.path.splitext(a)[0].lower(), embeddings)))
@routes.get("/extensions") @routes.get("/extensions")