Merge branch 'main' into renovate/electron-41.x

This commit is contained in:
Elian Doran
2026-04-05 20:38:36 +03:00
committed by GitHub
15 changed files with 140 additions and 48 deletions

View File

@@ -11,7 +11,7 @@ async function main() {
build.copy("/packages/share-theme/src/templates", "share-theme/templates/");
// Copy node modules dependencies
build.copyNodeModules([ "better-sqlite3", "bindings", "file-uri-to-path" ]);
build.copyNodeModules([ "better-sqlite3", "bindings", "file-uri-to-path", "tesseract.js" ]);
build.copy("/node_modules/ckeditor5/dist/ckeditor5-content.css", "ckeditor5-content.css");
build.buildFrontend();

View File

@@ -1,10 +1,16 @@
import { TextRepresentationResponse } from "@triliumnext/commons";
import type { OCRProcessResponse, TextRepresentationResponse } from "@triliumnext/commons";
import type { Request } from "express";
import becca from "../../becca/becca.js";
import ocrService from "../../services/ocr/ocr_service.js";
import options from "../../services/options.js";
import sql from "../../services/sql.js";
function getMinConfidenceThreshold(): number {
const minConfidence = options.getOption('ocrMinConfidence') ?? 0;
return parseFloat(minConfidence);
}
/**
* @swagger
* /api/ocr/process-note/{noteId}:
@@ -48,7 +54,7 @@ import sql from "../../services/sql.js";
* - session: []
* tags: ["ocr"]
*/
async function processNoteOCR(req: Request<{ noteId: string }>) {
async function processNoteOCR(req: Request<{ noteId: string }>): Promise<OCRProcessResponse | [number, OCRProcessResponse]> {
const { noteId } = req.params;
const { language, forceReprocess = false } = req.body || {};
@@ -62,7 +68,11 @@ async function processNoteOCR(req: Request<{ noteId: string }>) {
return [400, { success: false, message: 'Note is not an image or has unsupported format' }];
}
return { success: true, result };
return {
success: true,
result,
minConfidence: getMinConfidenceThreshold()
};
}
/**
@@ -108,7 +118,7 @@ async function processNoteOCR(req: Request<{ noteId: string }>) {
* - session: []
* tags: ["ocr"]
*/
async function processAttachmentOCR(req: Request<{ attachmentId: string }>) {
async function processAttachmentOCR(req: Request<{ attachmentId: string }>): Promise<OCRProcessResponse | [number, OCRProcessResponse]> {
const { attachmentId } = req.params;
const { language, forceReprocess = false } = req.body || {};
@@ -122,7 +132,11 @@ async function processAttachmentOCR(req: Request<{ attachmentId: string }>) {
return [400, { success: false, message: 'Attachment is not an image or has unsupported format' }];
}
return { success: true, result };
return {
success: true,
result,
minConfidence: getMinConfidenceThreshold()
};
}
/**

View File

@@ -6,7 +6,7 @@ import build from "./build.js";
import dataDir from "./data_dir.js";
const APP_DB_VERSION = 236;
const SYNC_VERSION = 37;
const SYNC_VERSION = 38;
const CLIPPER_PROTOCOL_VERSION = "1.0";
export default {