Skip to content

Commit

Permalink
Merge pull request #841 from i-dot-ai/bugfix/REDBOX-566-errors-logged…
Browse files Browse the repository at this point in the history
…-on-file-upload

Fix errors on file upload.
  • Loading branch information
brunns authored Jul 24, 2024
2 parents 679870c + 5d84cb0 commit 0802d93
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions django_app/redbox_app/redbox_core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class CoreChatResponse:
@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclass(frozen=True)
class FileStatus:
processing_status: Literal[
"uploaded", "parsing", "chunking", "embedding", "indexing", "complete", "unknown", "errored"
]
processing_status: (
Literal["uploaded", "parsing", "chunking", "embedding", "indexing", "complete", "unknown", "errored"] | None
)


@dataclass_json(undefined=Undefined.EXCLUDE)
Expand Down
4 changes: 2 additions & 2 deletions django_app/redbox_app/redbox_core/views/document_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def file_status_api_view(request: HttpRequest) -> JsonResponse:
logger.error("Error getting file object information - no file ID provided %s.")
return JsonResponse({"status": StatusEnum.unknown.label})
try:
file = get_object_or_404(File, id=file_id)
file: File = get_object_or_404(File, id=file_id)
except File.DoesNotExist as ex:
logger.exception("File object information not found in django - file does not exist %s.", file_id, exc_info=ex)
return JsonResponse({"status": StatusEnum.unknown.label})
Expand All @@ -205,6 +205,6 @@ def file_status_api_view(request: HttpRequest) -> JsonResponse:
file.status = StatusEnum.unknown.label
file.save()
return JsonResponse({"status": file.status})
file.status = core_file_status_response.processing_status
file.status = core_file_status_response.processing_status or StatusEnum.unknown.name
file.save()
return JsonResponse({"status": file.get_status_text()})
2 changes: 1 addition & 1 deletion redbox-core/redbox/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class FileStatus(BaseModel):
"""Status of a file."""

file_uuid: UUID
processing_status: ProcessingStatusEnum
processing_status: ProcessingStatusEnum | None
chunk_statuses: None = Field(default=None, description="deprecated, see processing_status")


Expand Down

0 comments on commit 0802d93

Please sign in to comment.