mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(server): Properly build ML predict URL (#9751)
New URL via URL constructor and not string concatenation
This commit is contained in:
parent
99f0aa868a
commit
4d4bb8b6a7
1 changed files with 5 additions and 3 deletions
|
@ -19,9 +19,11 @@ export class MachineLearningRepository implements IMachineLearningRepository {
|
|||
private async predict<T>(url: string, input: TextModelInput | VisionModelInput, config: ModelConfig): Promise<T> {
|
||||
const formData = await this.getFormData(input, config);
|
||||
|
||||
const res = await fetch(`${url}/predict`, { method: 'POST', body: formData }).catch((error: Error | any) => {
|
||||
const res = await fetch(new URL('/predict', url), { method: 'POST', body: formData }).catch(
|
||||
(error: Error | any) => {
|
||||
throw new Error(`${errorPrefix} to "${url}" failed with ${error?.cause || error}`);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
if (res.status >= 400) {
|
||||
const modelType = config.modelType ? ` for ${config.modelType.replace('-', ' ')}` : '';
|
||||
|
|
Loading…
Reference in a new issue