diff --git a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx index 6ace32c..8c37b2c 100644 --- a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx +++ b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx @@ -87,6 +87,7 @@ type SwitchDecision = "save" | "discard" | "cancel"; const LSF_IFRAME_SRC = "/lsf/lsf.html"; const TASK_PAGE_START = 0; const TASK_PAGE_SIZE = 200; +const SOURCE_DOCUMENT_EXTENSIONS = [".pdf", ".doc", ".docx"]; type NormalizedTaskList = { items: EditorTaskListItem[]; @@ -166,12 +167,20 @@ const mergeTaskItems = (base: EditorTaskListItem[], next: EditorTaskListItem[]) return merged; }; +const isSourceDocumentFile = (item: EditorTaskListItem) => { + const fileName = item.fileName?.toLowerCase() ?? ""; + return SOURCE_DOCUMENT_EXTENSIONS.some((ext) => fileName.endsWith(ext)); +}; + +const filterSourceDocumentTasks = (items: EditorTaskListItem[]) => + items.filter((item) => !isSourceDocumentFile(item)); + const normalizeTaskListResponse = ( response: ApiResponse | null | undefined, fallbackPage: number, ): NormalizedTaskList => { const content = response?.data?.content; - const items = Array.isArray(content) ? content : []; + const items = filterSourceDocumentTasks(Array.isArray(content) ? content : []); const size = response?.data?.size ?? TASK_PAGE_SIZE; const total = response?.data?.totalElements ?? items.length; const totalPages =