mirror of
https://github.com/immich-app/immich.git
synced 2025-10-31 18:47:09 -04:00
* feat: add OCR functionality and related configurations * chore: update labeler configuration for machine learning files * feat(i18n): enhance OCR model descriptions and add orientation classification and unwarping features * chore: update Dockerfile to include ccache for improved build performance * feat(ocr): enhance OCR model configuration with orientation classification and unwarping options, update PaddleOCR integration, and improve response structure * refactor(ocr): remove OCR_CLEANUP job from enum and type definitions * refactor(ocr): remove obsolete OCR entity and migration files, and update asset job status and schema to accommodate new OCR table structure * refactor(ocr): update OCR schema and response structure to use individual coordinates instead of bounding box, and adjust related service and repository files * feat: enhance OCR configuration and functionality - Updated OCR settings to include minimum detection box score, minimum detection score, and minimum recognition score. - Refactored PaddleOCRecognizer to utilize new scoring parameters. - Introduced new database tables for asset OCR data and search functionality. - Modified related services and repositories to support the new OCR features. - Updated translations for improved clarity in settings UI. * sql changes * use rapidocr * change dto * update web * update lock * update api * store positions as normalized floats * match column order in db * update admin ui settings descriptions fix max resolution key set min threshold to 0.1 fix bind * apply config correctly, adjust defaults * unnecessary model type * unnecessary sources * fix(ocr): switch RapidOCR lang type from LangDet to LangRec * fix(ocr): expose lang_type (LangRec.CH) and font_path on OcrOptions for RapidOCR * fix(ocr): make OCR text search case- and accent-insensitive using ILIKE + unaccent * fix(ocr): add OCR search fields * fix: Add OCR database migration and update ML prediction logic. * trigrams are already case insensitive * add tests * format * update migrations * wrong uuid function * linting * maybe fix medium tests * formatting * fix weblate check * openapi * sql * minor fixes * maybe fix medium tests part 2 * passing medium tests * format web * readd sql * format dart * disabled in e2e * chore: translation ordering --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
198 lines
6.0 KiB
Svelte
198 lines
6.0 KiB
Svelte
<script lang="ts">
|
|
import {
|
|
notificationController,
|
|
NotificationType,
|
|
} from '$lib/components/shared-components/notification/notification';
|
|
import { featureFlags } from '$lib/stores/server-config.store';
|
|
import { getJobName } from '$lib/utils';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { JobCommand, JobName, sendJobCommand, type AllJobStatusResponseDto, type JobCommandDto } from '@immich/sdk';
|
|
import { modalManager } from '@immich/ui';
|
|
import {
|
|
mdiContentDuplicate,
|
|
mdiFaceRecognition,
|
|
mdiFileJpgBox,
|
|
mdiFileXmlBox,
|
|
mdiFolderMove,
|
|
mdiImageSearch,
|
|
mdiLibraryShelves,
|
|
mdiTable,
|
|
mdiTagFaces,
|
|
mdiVideo,
|
|
mdiOcr,
|
|
} from '@mdi/js';
|
|
import type { Component } from 'svelte';
|
|
import { t } from 'svelte-i18n';
|
|
import JobTile from './JobTile.svelte';
|
|
import StorageMigrationDescription from './StorageMigrationDescription.svelte';
|
|
|
|
interface Props {
|
|
jobs: AllJobStatusResponseDto;
|
|
}
|
|
|
|
let { jobs = $bindable() }: Props = $props();
|
|
|
|
interface JobDetails {
|
|
title: string;
|
|
subtitle?: string;
|
|
description?: Component;
|
|
allText?: string;
|
|
refreshText?: string;
|
|
missingText: string;
|
|
disabled?: boolean;
|
|
icon: string;
|
|
handleCommand?: (jobId: JobName, jobCommand: JobCommandDto) => Promise<void>;
|
|
}
|
|
|
|
const handleConfirmCommand = async (jobId: JobName, dto: JobCommandDto) => {
|
|
if (dto.force) {
|
|
const isConfirmed = await modalManager.showDialog({
|
|
prompt: $t('admin.confirm_reprocess_all_faces'),
|
|
});
|
|
|
|
if (isConfirmed) {
|
|
await handleCommand(jobId, { command: JobCommand.Start, force: true });
|
|
return;
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
await handleCommand(jobId, dto);
|
|
};
|
|
|
|
let jobDetails: Partial<Record<JobName, JobDetails>> = {
|
|
[JobName.ThumbnailGeneration]: {
|
|
icon: mdiFileJpgBox,
|
|
title: $getJobName(JobName.ThumbnailGeneration),
|
|
subtitle: $t('admin.thumbnail_generation_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
},
|
|
[JobName.MetadataExtraction]: {
|
|
icon: mdiTable,
|
|
title: $getJobName(JobName.MetadataExtraction),
|
|
subtitle: $t('admin.metadata_extraction_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
},
|
|
[JobName.Library]: {
|
|
icon: mdiLibraryShelves,
|
|
title: $getJobName(JobName.Library),
|
|
subtitle: $t('admin.library_tasks_description'),
|
|
missingText: $t('rescan'),
|
|
},
|
|
[JobName.Sidecar]: {
|
|
title: $getJobName(JobName.Sidecar),
|
|
icon: mdiFileXmlBox,
|
|
subtitle: $t('admin.sidecar_job_description'),
|
|
allText: $t('sync'),
|
|
missingText: $t('discover'),
|
|
disabled: !$featureFlags.sidecar,
|
|
},
|
|
[JobName.SmartSearch]: {
|
|
icon: mdiImageSearch,
|
|
title: $getJobName(JobName.SmartSearch),
|
|
subtitle: $t('admin.smart_search_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
disabled: !$featureFlags.smartSearch,
|
|
},
|
|
[JobName.DuplicateDetection]: {
|
|
icon: mdiContentDuplicate,
|
|
title: $getJobName(JobName.DuplicateDetection),
|
|
subtitle: $t('admin.duplicate_detection_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
disabled: !$featureFlags.duplicateDetection,
|
|
},
|
|
[JobName.FaceDetection]: {
|
|
icon: mdiFaceRecognition,
|
|
title: $getJobName(JobName.FaceDetection),
|
|
subtitle: $t('admin.face_detection_description'),
|
|
allText: $t('reset'),
|
|
refreshText: $t('refresh'),
|
|
missingText: $t('missing'),
|
|
handleCommand: handleConfirmCommand,
|
|
disabled: !$featureFlags.facialRecognition,
|
|
},
|
|
[JobName.FacialRecognition]: {
|
|
icon: mdiTagFaces,
|
|
title: $getJobName(JobName.FacialRecognition),
|
|
subtitle: $t('admin.facial_recognition_job_description'),
|
|
allText: $t('reset'),
|
|
missingText: $t('missing'),
|
|
handleCommand: handleConfirmCommand,
|
|
disabled: !$featureFlags.facialRecognition,
|
|
},
|
|
[JobName.Ocr]: {
|
|
icon: mdiOcr,
|
|
title: $getJobName(JobName.Ocr),
|
|
subtitle: $t('admin.ocr_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
disabled: !$featureFlags.ocr,
|
|
},
|
|
[JobName.VideoConversion]: {
|
|
icon: mdiVideo,
|
|
title: $getJobName(JobName.VideoConversion),
|
|
subtitle: $t('admin.video_conversion_job_description'),
|
|
allText: $t('all'),
|
|
missingText: $t('missing'),
|
|
},
|
|
[JobName.StorageTemplateMigration]: {
|
|
icon: mdiFolderMove,
|
|
title: $getJobName(JobName.StorageTemplateMigration),
|
|
missingText: $t('start'),
|
|
description: StorageMigrationDescription,
|
|
},
|
|
[JobName.Migration]: {
|
|
icon: mdiFolderMove,
|
|
title: $getJobName(JobName.Migration),
|
|
subtitle: $t('admin.migration_job_description'),
|
|
missingText: $t('start'),
|
|
},
|
|
};
|
|
|
|
let jobList = Object.entries(jobDetails) as [JobName, JobDetails][];
|
|
|
|
async function handleCommand(jobId: JobName, jobCommand: JobCommandDto) {
|
|
const title = jobDetails[jobId]?.title;
|
|
|
|
try {
|
|
jobs[jobId] = await sendJobCommand({ id: jobId, jobCommandDto: jobCommand });
|
|
|
|
switch (jobCommand.command) {
|
|
case JobCommand.Empty: {
|
|
notificationController.show({
|
|
message: $t('admin.cleared_jobs', { values: { job: title } }),
|
|
type: NotificationType.Info,
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
handleError(error, $t('admin.failed_job_command', { values: { command: jobCommand.command, job: title } }));
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<div class="flex flex-col gap-7">
|
|
{#each jobList as [jobName, { title, subtitle, description, disabled, allText, refreshText, missingText, icon, handleCommand: handleCommandOverride }] (jobName)}
|
|
{@const { jobCounts, queueStatus } = jobs[jobName]}
|
|
<JobTile
|
|
{icon}
|
|
{title}
|
|
{disabled}
|
|
{subtitle}
|
|
{description}
|
|
{allText}
|
|
{refreshText}
|
|
{missingText}
|
|
{jobCounts}
|
|
{queueStatus}
|
|
onCommand={(command) => (handleCommandOverride || handleCommand)(jobName, command)}
|
|
/>
|
|
{/each}
|
|
</div>
|