mirror of
https://github.com/immich-app/immich.git
synced 2025-12-26 09:14:58 +03:00
feat(ml): support multiple urls (#14347)
* support multiple url * update api * styling unnecessary `?.` * update docs, make new url field go first add load balancing section * update tests doc formatting wording wording linting * small styling * `url` -> `urls` * fix tests * update docs * make docusaurus happy --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -717,7 +717,7 @@ describe(PersonService.name, () => {
|
||||
assetMock.getByIds.mockResolvedValue([assetStub.image]);
|
||||
await sut.handleDetectFaces({ id: assetStub.image.id });
|
||||
expect(machineLearningMock.detectFaces).toHaveBeenCalledWith(
|
||||
'http://immich-machine-learning:3003',
|
||||
['http://immich-machine-learning:3003'],
|
||||
'/uploads/user-id/thumbs/path.jpg',
|
||||
expect.objectContaining({ minScore: 0.7, modelName: 'buffalo_l' }),
|
||||
);
|
||||
|
||||
@@ -297,7 +297,7 @@ export class PersonService extends BaseService {
|
||||
}
|
||||
|
||||
const { imageHeight, imageWidth, faces } = await this.machineLearningRepository.detectFaces(
|
||||
machineLearning.url,
|
||||
machineLearning.urls,
|
||||
previewFile.path,
|
||||
machineLearning.facialRecognition,
|
||||
);
|
||||
|
||||
@@ -86,7 +86,7 @@ export class SearchService extends BaseService {
|
||||
const userIds = await this.getUserIdsToSearch(auth);
|
||||
|
||||
const embedding = await this.machineLearningRepository.encodeText(
|
||||
machineLearning.url,
|
||||
machineLearning.urls,
|
||||
dto.query,
|
||||
machineLearning.clip,
|
||||
);
|
||||
|
||||
@@ -289,7 +289,7 @@ describe(SmartInfoService.name, () => {
|
||||
expect(await sut.handleEncodeClip({ id: assetStub.image.id })).toEqual(JobStatus.SUCCESS);
|
||||
|
||||
expect(machineLearningMock.encodeImage).toHaveBeenCalledWith(
|
||||
'http://immich-machine-learning:3003',
|
||||
['http://immich-machine-learning:3003'],
|
||||
'/uploads/user-id/thumbs/path.jpg',
|
||||
expect.objectContaining({ modelName: 'ViT-B-32__openai' }),
|
||||
);
|
||||
@@ -322,7 +322,7 @@ describe(SmartInfoService.name, () => {
|
||||
|
||||
expect(databaseMock.wait).toHaveBeenCalledWith(512);
|
||||
expect(machineLearningMock.encodeImage).toHaveBeenCalledWith(
|
||||
'http://immich-machine-learning:3003',
|
||||
['http://immich-machine-learning:3003'],
|
||||
'/uploads/user-id/thumbs/path.jpg',
|
||||
expect.objectContaining({ modelName: 'ViT-B-32__openai' }),
|
||||
);
|
||||
|
||||
@@ -122,7 +122,7 @@ export class SmartInfoService extends BaseService {
|
||||
}
|
||||
|
||||
const embedding = await this.machineLearningRepository.encodeImage(
|
||||
machineLearning.url,
|
||||
machineLearning.urls,
|
||||
previewFile.path,
|
||||
machineLearning.clip,
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ const updatedConfig = Object.freeze<SystemConfig>({
|
||||
},
|
||||
machineLearning: {
|
||||
enabled: true,
|
||||
url: 'http://immich-machine-learning:3003',
|
||||
urls: ['http://immich-machine-learning:3003'],
|
||||
clip: {
|
||||
enabled: true,
|
||||
modelName: 'ViT-B-32__openai',
|
||||
@@ -330,11 +330,11 @@ describe(SystemConfigService.name, () => {
|
||||
|
||||
it('should allow underscores in the machine learning url', async () => {
|
||||
configMock.getEnv.mockReturnValue(mockEnvData({ configFile: 'immich-config.json' }));
|
||||
const partialConfig = { machineLearning: { url: 'immich_machine_learning' } };
|
||||
const partialConfig = { machineLearning: { urls: ['immich_machine_learning'] } };
|
||||
systemMock.readFile.mockResolvedValue(JSON.stringify(partialConfig));
|
||||
|
||||
const config = await sut.getSystemConfig();
|
||||
expect(config.machineLearning.url).toEqual('immich_machine_learning');
|
||||
expect(config.machineLearning.urls).toEqual(['immich_machine_learning']);
|
||||
});
|
||||
|
||||
const externalDomainTests = [
|
||||
|
||||
Reference in New Issue
Block a user