Eliminate the "none" compute mode and all related code paths, including the NoneComputeBackend, "unsupported" parse status, and PDF margin settings. Parsing is now always available if the app starts successfully, and configuration is limited to "local" or "worker" compute modes. Update types, API routes, client adapters, and documentation to reflect this simplification. BREAKING CHANGE: "none" is no longer a valid COMPUTE_MODE; only "local" and "worker" are supported. "unsupported" parse status and PDF margin settings are removed.
79 lines
1.4 KiB
TypeScript
79 lines
1.4 KiB
TypeScript
export type ParsedPdfBlockKind =
|
|
| 'abstract'
|
|
| 'algorithm'
|
|
| 'aside_text'
|
|
| 'chart'
|
|
| 'content'
|
|
| 'formula'
|
|
| 'doc_title'
|
|
| 'figure_title'
|
|
| 'footer'
|
|
| 'footnote'
|
|
| 'formula_number'
|
|
| 'header'
|
|
| 'image'
|
|
| 'number'
|
|
| 'paragraph_title'
|
|
| 'reference'
|
|
| 'reference_content'
|
|
| 'seal'
|
|
| 'table'
|
|
| 'text'
|
|
| 'vision_footnote';
|
|
|
|
export const PARSED_PDF_BLOCK_KINDS: ParsedPdfBlockKind[] = [
|
|
'abstract',
|
|
'algorithm',
|
|
'aside_text',
|
|
'chart',
|
|
'content',
|
|
'formula',
|
|
'doc_title',
|
|
'figure_title',
|
|
'footer',
|
|
'footnote',
|
|
'formula_number',
|
|
'header',
|
|
'image',
|
|
'number',
|
|
'paragraph_title',
|
|
'reference',
|
|
'reference_content',
|
|
'seal',
|
|
'table',
|
|
'text',
|
|
'vision_footnote',
|
|
];
|
|
|
|
export interface ParsedPdfBlockFragment {
|
|
page: number;
|
|
bbox: [number, number, number, number];
|
|
text: string;
|
|
readingOrder: number;
|
|
modelConfidence?: number;
|
|
}
|
|
|
|
export interface ParsedPdfBlock {
|
|
id: string;
|
|
kind: ParsedPdfBlockKind;
|
|
fragments: ParsedPdfBlockFragment[];
|
|
text: string;
|
|
parentSectionId?: string;
|
|
}
|
|
|
|
export interface ParsedPdfPage {
|
|
pageNumber: number;
|
|
width: number;
|
|
height: number;
|
|
blocks: ParsedPdfBlock[];
|
|
}
|
|
|
|
export interface ParsedPdfDocument {
|
|
schemaVersion: 1;
|
|
documentId: string;
|
|
parserVersion: string;
|
|
parsedAt: number;
|
|
pages: ParsedPdfPage[];
|
|
}
|
|
|
|
export type PdfParseStatus = 'pending' | 'running' | 'ready' | 'failed';
|