mirror of
https://github.com/docling-project/docling-serve.git
synced 2025-11-29 08:33:50 +00:00
20 lines
601 B
Python
20 lines
601 B
Python
from typing import Optional
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from docling_serve.datamodel.engines import TaskStatus
|
|
from docling_serve.datamodel.requests import ConvertDocumentsRequest
|
|
from docling_serve.datamodel.responses import ConvertDocumentResponse
|
|
|
|
|
|
class Task(BaseModel):
|
|
task_id: str
|
|
task_status: TaskStatus = TaskStatus.PENDING
|
|
request: Optional[ConvertDocumentsRequest]
|
|
result: Optional[ConvertDocumentResponse] = None
|
|
|
|
def is_completed(self) -> bool:
|
|
if self.task_status in [TaskStatus.SUCCESS, TaskStatus.FAILURE]:
|
|
return True
|
|
return False
|