Files
Stirling-PDF/frontend/src/hooks/tools/ocr/useOCRParameters.ts
T
23d86deae7 Feature/v2/automate (#4248)
* automate feature
* Moved all providers to app level to simplify homepage 
* Circular dependency fixes
* You will see that now toolRegistry gets a tool config and a tool
settings object. These enable automate to run the tools using as much
static code as possible.

---------

Co-authored-by: Connor Yoh <[email protected]>
2025-08-22 14:40:27 +01:00

30 lines
804 B
TypeScript

import { BaseParameters } from '../../../types/parameters';
import { useBaseParameters, BaseParametersHook } from '../shared/useBaseParameters';
export interface OCRParameters extends BaseParameters {
languages: string[];
ocrType: string;
ocrRenderType: string;
additionalOptions: string[];
}
export type OCRParametersHook = BaseParametersHook<OCRParameters>;
export const defaultParameters: OCRParameters = {
languages: [],
ocrType: 'skip-text',
ocrRenderType: 'hocr',
additionalOptions: [],
};
export const useOCRParameters = (): OCRParametersHook => {
return useBaseParameters({
defaultParameters,
endpointName: 'ocr-pdf',
validateFn: (params) => {
// At minimum, we need at least one language selected
return params.languages.length > 0;
},
});
};