diff --git a/server/src/domain/job/job.service.spec.ts b/server/src/domain/job/job.service.spec.ts index 859bc39f0b327..c37f1ad21eea6 100644 --- a/server/src/domain/job/job.service.spec.ts +++ b/server/src/domain/job/job.service.spec.ts @@ -159,6 +159,9 @@ describe(JobService.name, () => { it('should handle a start object tagging command', async () => { jobMock.getQueueStatus.mockResolvedValue({ isActive: false, isPaused: false }); + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); await sut.handleCommand(QueueName.OBJECT_TAGGING, { command: JobCommand.START, force: false }); diff --git a/server/src/domain/server-info/server-info.service.spec.ts b/server/src/domain/server-info/server-info.service.spec.ts index 74aab12c7a502..46badfa52b546 100644 --- a/server/src/domain/server-info/server-info.service.spec.ts +++ b/server/src/domain/server-info/server-info.service.spec.ts @@ -171,7 +171,7 @@ describe(ServerInfoService.name, () => { passwordLogin: true, search: true, sidecar: true, - tagImage: true, + tagImage: false, configFile: false, trash: true, }); diff --git a/server/src/domain/smart-info/smart-info.service.spec.ts b/server/src/domain/smart-info/smart-info.service.spec.ts index e3b5acce3f06f..5c4f5c3791e43 100644 --- a/server/src/domain/smart-info/smart-info.service.spec.ts +++ b/server/src/domain/smart-info/smart-info.service.spec.ts @@ -48,6 +48,12 @@ describe(SmartInfoService.name, () => { }); describe('handleQueueObjectTagging', () => { + beforeEach(async () => { + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); + }); + it('should do nothing if machine learning is disabled', async () => { configMock.load.mockResolvedValue([{ key: SystemConfigKey.MACHINE_LEARNING_ENABLED, value: false }]); @@ -58,6 +64,9 @@ describe(SmartInfoService.name, () => { }); it('should queue the assets without tags', async () => { + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); assetMock.getWithout.mockResolvedValue({ items: [assetStub.image], hasNextPage: false, @@ -70,6 +79,9 @@ describe(SmartInfoService.name, () => { }); it('should queue all the assets', async () => { + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); assetMock.getAll.mockResolvedValue({ items: [assetStub.image], hasNextPage: false, @@ -103,6 +115,9 @@ describe(SmartInfoService.name, () => { }); it('should save the returned tags', async () => { + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); machineMock.classifyImage.mockResolvedValue(['tag1', 'tag2', 'tag3']); await sut.handleClassifyImage({ id: asset.id }); @@ -121,6 +136,9 @@ describe(SmartInfoService.name, () => { }); it('should always overwrite old tags', async () => { + configMock.load.mockResolvedValue([ + { key: SystemConfigKey.MACHINE_LEARNING_CLASSIFICATION_ENABLED, value: true }, + ]); machineMock.classifyImage.mockResolvedValue([]); await sut.handleClassifyImage({ id: asset.id }); diff --git a/server/src/domain/system-config/system-config.core.ts b/server/src/domain/system-config/system-config.core.ts index 5ec523afa09f9..2eeb8053803f3 100644 --- a/server/src/domain/system-config/system-config.core.ts +++ b/server/src/domain/system-config/system-config.core.ts @@ -67,7 +67,7 @@ export const defaults = Object.freeze({ enabled: process.env.IMMICH_MACHINE_LEARNING_ENABLED !== 'false', url: process.env.IMMICH_MACHINE_LEARNING_URL || 'http://immich-machine-learning:3003', classification: { - enabled: true, + enabled: false, modelName: 'microsoft/resnet-50', minScore: 0.9, }, diff --git a/server/src/domain/system-config/system-config.service.spec.ts b/server/src/domain/system-config/system-config.service.spec.ts index c67fb9e4caa3c..4ab1880d691f9 100644 --- a/server/src/domain/system-config/system-config.service.spec.ts +++ b/server/src/domain/system-config/system-config.service.spec.ts @@ -66,7 +66,7 @@ const updatedConfig = Object.freeze({ enabled: true, url: 'http://immich-machine-learning:3003', classification: { - enabled: true, + enabled: false, modelName: 'microsoft/resnet-50', minScore: 0.9, },