Skip to content

Commit

Permalink
add internal /folder_paths route (comfyanonymous#4980)
Browse files Browse the repository at this point in the history
returns a json maps of folder paths
  • Loading branch information
mcmonkey4eva authored Sep 19, 2024
1 parent 68bb885 commit 3326bdf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api_server/routes/internal/internal_routes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from aiohttp import web
from typing import Optional
from folder_paths import models_dir, user_directory, output_directory
from folder_paths import models_dir, user_directory, output_directory, folder_names_and_paths
from api_server.services.file_service import FileService
import app.logger

Expand Down Expand Up @@ -36,6 +36,13 @@ async def list_files(request):
async def get_logs(request):
return web.json_response(app.logger.get_logs())

@self.routes.get('/folder_paths')
async def get_folder_paths(request):
response = {}
for key in folder_names_and_paths:
response[key] = folder_names_and_paths[key][0]
return web.json_response(response)

def get_app(self):
if self._app is None:
self._app = web.Application()
Expand Down

0 comments on commit 3326bdf

Please sign in to comment.