mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 11:00:47 +02:00
* 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]>
30 lines
804 B
TypeScript
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;
|
|
},
|
|
});
|
|
};
|