Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix snippet linter #87

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading