Skip to content

Commit

Permalink
fix: Fix snippet linter (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramimashkouk authored Sep 3, 2024
1 parent 7c7b7fc commit 06d810b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion backend/chatsky_ui/api/api_v1/endpoints/dff_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions backend/chatsky_ui/services/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 06d810b

Please sign in to comment.