mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-12-07 19:59:07 +00:00
* custom `IsOptional` * added link to source * formatting * Update server/src/domain/domain.util.ts Co-authored-by: Jason Rasmussen <jrasm91@gmail.com> * nullable birth date endpoint * made `nullable` a property * formatting * removed unused dto * updated decorator arg * fixed album e2e tests * add null tests for auth e2e * add null test for person e2e * fixed tests * added null test for user e2e * removed unusued import * log key in test name * chore: add note about mobile not being able to use the endpoint --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import { IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, Max, Min } from 'class-validator';
|
|
import { CLIPMode, ModelType } from '../machine-learning.interface';
|
|
import { Optional } from '../../domain.util';
|
|
|
|
export class ModelConfig {
|
|
@IsBoolean()
|
|
enabled!: boolean;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
modelName!: string;
|
|
|
|
@IsEnum(ModelType)
|
|
@Optional()
|
|
@ApiProperty({ enumName: 'ModelType', enum: ModelType })
|
|
modelType?: ModelType;
|
|
}
|
|
|
|
export class ClassificationConfig extends ModelConfig {
|
|
@IsNumber()
|
|
@Min(0)
|
|
@Max(1)
|
|
@Type(() => Number)
|
|
@ApiProperty({ type: 'integer' })
|
|
minScore!: number;
|
|
}
|
|
|
|
export class CLIPConfig extends ModelConfig {
|
|
@IsEnum(CLIPMode)
|
|
@Optional()
|
|
@ApiProperty({ enumName: 'CLIPMode', enum: CLIPMode })
|
|
mode?: CLIPMode;
|
|
}
|
|
|
|
export class RecognitionConfig extends ModelConfig {
|
|
@IsNumber()
|
|
@Min(0)
|
|
@Max(1)
|
|
@Type(() => Number)
|
|
@ApiProperty({ type: 'integer' })
|
|
minScore!: number;
|
|
|
|
@IsNumber()
|
|
@Min(0)
|
|
@Max(2)
|
|
@Type(() => Number)
|
|
@ApiProperty({ type: 'integer' })
|
|
maxDistance!: number;
|
|
}
|