From 3cd3b4c854207cf877bc8dda7c38a37ef9961a96 Mon Sep 17 00:00:00 2001 From: San Date: Tue, 14 Nov 2023 16:04:22 +0800 Subject: [PATCH] test api from gpts --- routes.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/routes.py b/routes.py index 028d7b3..c74a8f5 100644 --- a/routes.py +++ b/routes.py @@ -142,6 +142,13 @@ async def get_webhook(request): @server.PromptServer.instance.routes.post("/input_file") async def post_input_file(request): - post = await request.json() - uuid = post.get("uuid") - return web.json_response({'uuid': uuid}) \ No newline at end of file + post = await request.read() + + output_dir = os.path.join(folder_paths.base_path, "input") + os.makedirs(output_dir, exist_ok=True) + + filename = os.path.join(output_dir, "imagefromai.png") + with open(filename, "wb") as f: + f.write(post) + + return web.json_response({}) \ No newline at end of file