mirror of
https://github.com/zadam/trilium.git
synced 2026-06-27 14:07:39 +02:00
feat(ocr): allow manual processing of OCR
This commit is contained in:
@@ -49,10 +49,6 @@ async function processNoteOCR(req: Request<{ noteId: string }>) {
|
||||
const { noteId } = req.params;
|
||||
const { language = 'eng', forceReprocess = false } = req.body || {};
|
||||
|
||||
if (!ocrService.isOCREnabled()) {
|
||||
return [400, { success: false, message: 'OCR is not enabled in settings' }];
|
||||
}
|
||||
|
||||
const note = becca.getNote(noteId);
|
||||
if (!note) {
|
||||
return [404, { success: false, message: 'Note not found' }];
|
||||
@@ -111,10 +107,6 @@ async function processAttachmentOCR(req: Request<{ attachmentId: string }>) {
|
||||
const { attachmentId } = req.params;
|
||||
const { language = 'eng', forceReprocess = false } = req.body || {};
|
||||
|
||||
if (!ocrService.isOCREnabled()) {
|
||||
return [400, { success: false, message: 'OCR is not enabled in settings' }];
|
||||
}
|
||||
|
||||
const attachment = becca.getAttachment(attachmentId);
|
||||
if (!attachment) {
|
||||
return [404, { success: false, message: 'Attachment not found' }];
|
||||
|
||||
@@ -110,11 +110,6 @@ class OCRService {
|
||||
* Process OCR for a note (image type)
|
||||
*/
|
||||
async processNoteOCR(noteId: string, options: OCRProcessingOptions = {}): Promise<OCRResult | null> {
|
||||
if (!this.isOCREnabled()) {
|
||||
log.info('OCR is disabled in settings');
|
||||
return null;
|
||||
}
|
||||
|
||||
const note = becca.getNote(noteId);
|
||||
if (!note) {
|
||||
log.error(`Note ${noteId} not found`);
|
||||
@@ -168,11 +163,6 @@ class OCRService {
|
||||
* Process OCR for an attachment
|
||||
*/
|
||||
async processAttachmentOCR(attachmentId: string, options: OCRProcessingOptions = {}): Promise<OCRResult | null> {
|
||||
if (!this.isOCREnabled()) {
|
||||
log.info('OCR is disabled in settings');
|
||||
return null;
|
||||
}
|
||||
|
||||
const attachment = becca.getAttachment(attachmentId);
|
||||
if (!attachment) {
|
||||
log.error(`Attachment ${attachmentId} not found`);
|
||||
|
||||
Reference in New Issue
Block a user