feat: add OCR functionality and related configurations

This commit is contained in:
CoderKang 2025-06-01 22:10:43 +08:00 committed by mertalev
parent 23fb2e0fae
commit 0e8ca1c159
No known key found for this signature in database
GPG key ID: DF6ABC77AAD98C95
64 changed files with 3998 additions and 1669 deletions

View file

@ -678,6 +678,7 @@ export type AllJobStatusResponseDto = {
metadataExtraction: JobStatusDto;
migration: JobStatusDto;
notifications: JobStatusDto;
ocr: JobStatusDto;
search: JobStatusDto;
sidecar: JobStatusDto;
smartSearch: JobStatusDto;
@ -957,6 +958,37 @@ export type SearchResponseDto = {
albums: SearchAlbumResponseDto;
assets: SearchAssetResponseDto;
};
export type OcrSearchDto = {
albumIds?: string[];
city?: string | null;
country?: string | null;
createdAfter?: string;
createdBefore?: string;
deviceId?: string;
isEncoded?: boolean;
isFavorite?: boolean;
isMotion?: boolean;
isNotInAlbum?: boolean;
isOffline?: boolean;
lensModel?: string | null;
libraryId?: string | null;
make?: string;
model?: string | null;
ocr: string;
page?: number;
personIds?: string[];
rating?: number;
state?: string | null;
tagIds?: string[] | null;
takenAfter?: string;
takenBefore?: string;
trashedAfter?: string;
trashedBefore?: string;
"type"?: AssetTypeEnum;
updatedAfter?: string;
updatedBefore?: string;
visibility?: AssetVisibility;
};
export type PlacesResponseDto = {
admin1name?: string;
admin2name?: string;
@ -1117,6 +1149,7 @@ export type ServerFeaturesDto = {
map: boolean;
oauth: boolean;
oauthAutoLaunch: boolean;
ocr: boolean;
passwordLogin: boolean;
reverseGeocoding: boolean;
search: boolean;
@ -1362,6 +1395,7 @@ export type SystemConfigJobDto = {
metadataExtraction: JobSettingsDto;
migration: JobSettingsDto;
notifications: JobSettingsDto;
ocr: JobSettingsDto;
search: JobSettingsDto;
sidecar: JobSettingsDto;
smartSearch: JobSettingsDto;
@ -1398,11 +1432,17 @@ export type FacialRecognitionConfig = {
minScore: number;
modelName: string;
};
export type OcrConfig = {
enabled: boolean;
minScore: number;
modelName: string;
};
export type SystemConfigMachineLearningDto = {
clip: ClipConfig;
duplicateDetection: DuplicateDetectionConfig;
enabled: boolean;
facialRecognition: FacialRecognitionConfig;
ocr: OcrConfig;
/** This property was deprecated in v1.122.0 */
url?: string;
urls: string[];
@ -3457,6 +3497,18 @@ export function searchAssets({ metadataSearchDto }: {
body: metadataSearchDto
})));
}
export function searchOcr({ ocrSearchDto }: {
ocrSearchDto: OcrSearchDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: SearchResponseDto;
}>("/search/ocr", oazapfts.json({
...opts,
method: "POST",
body: ocrSearchDto
})));
}
/**
* This endpoint requires the `person.read` permission.
*/
@ -4862,7 +4914,8 @@ export enum JobName {
Sidecar = "sidecar",
Library = "library",
Notifications = "notifications",
BackupDatabase = "backupDatabase"
BackupDatabase = "backupDatabase",
Ocr = "ocr"
}
export enum JobCommand {
Start = "start",