1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02: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:
Mert
2024-12-04 15:17:47 -05:00
committed by GitHub
parent 411878c0aa
commit 4bf1b84cc2
22 changed files with 202 additions and 73 deletions

View File

@ -17,7 +17,8 @@ class SystemConfigMachineLearningDto {
required this.duplicateDetection,
required this.enabled,
required this.facialRecognition,
required this.url,
this.url,
this.urls = const [],
});
CLIPConfig clip;
@ -28,7 +29,16 @@ class SystemConfigMachineLearningDto {
FacialRecognitionConfig facialRecognition;
String url;
/// This property was deprecated in v1.122.0
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? url;
List<String> urls;
@override
bool operator ==(Object other) => identical(this, other) || other is SystemConfigMachineLearningDto &&
@ -36,7 +46,8 @@ class SystemConfigMachineLearningDto {
other.duplicateDetection == duplicateDetection &&
other.enabled == enabled &&
other.facialRecognition == facialRecognition &&
other.url == url;
other.url == url &&
_deepEquality.equals(other.urls, urls);
@override
int get hashCode =>
@ -45,10 +56,11 @@ class SystemConfigMachineLearningDto {
(duplicateDetection.hashCode) +
(enabled.hashCode) +
(facialRecognition.hashCode) +
(url.hashCode);
(url == null ? 0 : url!.hashCode) +
(urls.hashCode);
@override
String toString() => 'SystemConfigMachineLearningDto[clip=$clip, duplicateDetection=$duplicateDetection, enabled=$enabled, facialRecognition=$facialRecognition, url=$url]';
String toString() => 'SystemConfigMachineLearningDto[clip=$clip, duplicateDetection=$duplicateDetection, enabled=$enabled, facialRecognition=$facialRecognition, url=$url, urls=$urls]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -56,7 +68,12 @@ class SystemConfigMachineLearningDto {
json[r'duplicateDetection'] = this.duplicateDetection;
json[r'enabled'] = this.enabled;
json[r'facialRecognition'] = this.facialRecognition;
if (this.url != null) {
json[r'url'] = this.url;
} else {
// json[r'url'] = null;
}
json[r'urls'] = this.urls;
return json;
}
@ -73,7 +90,10 @@ class SystemConfigMachineLearningDto {
duplicateDetection: DuplicateDetectionConfig.fromJson(json[r'duplicateDetection'])!,
enabled: mapValueOfType<bool>(json, r'enabled')!,
facialRecognition: FacialRecognitionConfig.fromJson(json[r'facialRecognition'])!,
url: mapValueOfType<String>(json, r'url')!,
url: mapValueOfType<String>(json, r'url'),
urls: json[r'urls'] is Iterable
? (json[r'urls'] as Iterable).cast<String>().toList(growable: false)
: const [],
);
}
return null;
@ -125,7 +145,7 @@ class SystemConfigMachineLearningDto {
'duplicateDetection',
'enabled',
'facialRecognition',
'url',
'urls',
};
}