Skip to content

Commit

Permalink
fix: fix pre annoation exceptions (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen authored Aug 26, 2024
1 parent 791df15 commit bd61682
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion labelu/internal/application/service/pre_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@
def read_jsonl_file(db: Session, file_id: int) -> List[dict]:
attachment = crud_attachment.get(db, file_id)
if attachment is None:
raise LabelUException(status_code=404, code=ErrorCode.CODE_51001_TASK_ATTACHMENT_NOT_FOUND)
return []

attachment_path = attachment.path
file_full_path = settings.MEDIA_ROOT.joinpath(attachment_path.lstrip("/"))

# check if the file exists
if not file_full_path.exists() or not attachment.filename.endswith('.jsonl'):
return []

try:
with open(file_full_path, "r", encoding="utf-8") as f:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "labelu"
version = '1.0.6'
version = '1.0.7-alpha.1'
description = ""
license = "Apache-2.0"
authors = ["shenguanlin <[email protected]>"]
Expand Down

0 comments on commit bd61682

Please sign in to comment.