diff --git a/Makefile b/Makefile index bff4b922..05b58031 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ check_project_arg: .PHONY: run_backend run_backend: check_project_arg ## Runs backend using the built dist. NEEDS arg: PROJECT_NAME - @set -a && . $(CURDIR)/.env && \ + @if [ -f $(CURDIR)/.env ]; then set -a && . $(CURDIR)/.env; fi && \ cd ${PROJECT_NAME} && \ poetry add $(CURDIR)/${BACKEND_DIR}/dist/*.whl && \ poetry install && \ diff --git a/backend/chatsky_ui/api/api_v1/endpoints/dff_services.py b/backend/chatsky_ui/api/api_v1/endpoints/dff_services.py index eb67ded6..5d643ff1 100644 --- a/backend/chatsky_ui/api/api_v1/endpoints/dff_services.py +++ b/backend/chatsky_ui/api/api_v1/endpoints/dff_services.py @@ -35,7 +35,7 @@ async def lint_snippet(snippet: CodeSnippet) -> Dict[str, str]: """ code_snippet = snippet.code.replace(r"\n", "\n") - imports = get_imports_from_file(settings.snippet2lint_path.parent / "conditions.py") + imports = get_imports_from_file(settings.conditions_path) code_snippet = "\n\n".join([imports, code_snippet]) async with aiofiles.open(settings.snippet2lint_path, "wt", encoding="UTF-8") as file: diff --git a/backend/chatsky_ui/services/index.py b/backend/chatsky_ui/services/index.py index 683ae9b3..05427c41 100644 --- a/backend/chatsky_ui/services/index.py +++ b/backend/chatsky_ui/services/index.py @@ -13,6 +13,7 @@ from omegaconf import OmegaConf from omegaconf.dictconfig import DictConfig +from chatsky_ui.core.config import settings from chatsky_ui.core.logger_config import get_logger from chatsky_ui.db.base import read_conf, read_logs, write_conf @@ -53,7 +54,7 @@ async def _load_index(self) -> None: async def _load_conditions(self) -> None: """Load conditions from disk.""" - path = self.path.parent / "conditions.py" + path = settings.conditions_path if path.exists(): self.conditions = await read_logs(path) self.logger.debug("Conditions loaded") @@ -62,7 +63,7 @@ async def _load_conditions(self) -> None: async def _load_responses(self) -> None: """Load responses from disk.""" - path = self.path.parent / "responses.py" + path = settings.responses_path if path.exists(): self.responses = await read_logs(path) self.logger.debug("Responses loaded") @@ -71,7 +72,7 @@ async def _load_responses(self) -> None: async def _load_services(self) -> None: """Load services from disk.""" - path = self.path.parent / "services.py" + path = settings.responses_path.parent / "services.py" if path.exists(): self.services = await read_logs(path) self.logger.debug("Services loaded")