From 6f9a31eba53f802e53110e538dcacad879ea2e16 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Tue, 18 Jun 2024 18:07:51 -0700 Subject: [PATCH] feat: tool cache dir --- backend/apps/webui/routers/tools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/apps/webui/routers/tools.py b/backend/apps/webui/routers/tools.py index b68ed32ee..49ddf4af0 100644 --- a/backend/apps/webui/routers/tools.py +++ b/backend/apps/webui/routers/tools.py @@ -15,8 +15,9 @@ from constants import ERROR_MESSAGES from importlib import util import os +from pathlib import Path -from config import DATA_DIR +from config import DATA_DIR, CACHE_DIR TOOLS_DIR = f"{DATA_DIR}/tools" @@ -79,6 +80,9 @@ async def create_new_toolkit( specs = get_tools_specs(TOOLS[form_data.id]) toolkit = Tools.insert_new_tool(user.id, form_data, specs) + tool_cache_dir = Path(CACHE_DIR) / "tools" / form_data.id + tool_cache_dir.mkdir(parents=True, exist_ok=True) + if toolkit: return toolkit else: