diff --git a/server/src/repositories/machine-learning.repository.ts b/server/src/repositories/machine-learning.repository.ts index 3d8f0cac1e..bff22b9507 100644 --- a/server/src/repositories/machine-learning.repository.ts +++ b/server/src/repositories/machine-learning.repository.ts @@ -19,9 +19,11 @@ export class MachineLearningRepository implements IMachineLearningRepository { private async predict(url: string, input: TextModelInput | VisionModelInput, config: ModelConfig): Promise { const formData = await this.getFormData(input, config); - const res = await fetch(`${url}/predict`, { method: 'POST', body: formData }).catch((error: Error | any) => { - throw new Error(`${errorPrefix} to "${url}" failed with ${error?.cause || error}`); - }); + 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('-', ' ')}` : '';