mirror of
https://github.com/immich-app/immich.git
synced 2024-12-26 10:50:29 +02:00
fix(server): empty tag responses should be considered valid (#2993)
* accept empty tag array * renamed test
This commit is contained in:
parent
22a73b67d3
commit
017214fd56
@ -91,13 +91,13 @@ describe(SmartInfoService.name, () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should no update the smart info if no tags were returned', async () => {
|
it('should always overwrite old tags', async () => {
|
||||||
machineMock.classifyImage.mockResolvedValue([]);
|
machineMock.classifyImage.mockResolvedValue([]);
|
||||||
|
|
||||||
await sut.handleClassifyImage({ id: asset.id });
|
await sut.handleClassifyImage({ id: asset.id });
|
||||||
|
|
||||||
expect(machineMock.classifyImage).toHaveBeenCalled();
|
expect(machineMock.classifyImage).toHaveBeenCalled();
|
||||||
expect(smartMock.upsert).not.toHaveBeenCalled();
|
expect(smartMock.upsert).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41,10 +41,6 @@ export class SmartInfoService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tags = await this.machineLearning.classifyImage({ imagePath: asset.resizePath });
|
const tags = await this.machineLearning.classifyImage({ imagePath: asset.resizePath });
|
||||||
if (tags.length === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.repository.upsert({ assetId: asset.id, tags });
|
await this.repository.upsert({ assetId: asset.id, tags });
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user