feat(server): allow subpaths for machine learning URL (#28427)
This allows to use a machine learning server URL under a subpath, such as "http://example.com/ml-server/".pull/26727/head
parent
37cc028868
commit
b0c9743d9a
|
|
@ -132,7 +132,7 @@ export class MachineLearningRepository {
|
||||||
private async check(url: string) {
|
private async check(url: string) {
|
||||||
let healthy = false;
|
let healthy = false;
|
||||||
try {
|
try {
|
||||||
const response = await fetch(new URL('/ping', url), {
|
const response = await fetch(new URL('ping', url), {
|
||||||
signal: AbortSignal.timeout(this.config.availabilityChecks.timeout),
|
signal: AbortSignal.timeout(this.config.availabilityChecks.timeout),
|
||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
|
|
@ -170,7 +170,7 @@ export class MachineLearningRepository {
|
||||||
...this.config.urls.filter((url) => !this.isHealthy(url)),
|
...this.config.urls.filter((url) => !this.isHealthy(url)),
|
||||||
]) {
|
]) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(new URL('/predict', url), { method: 'POST', body: formData });
|
const response = await fetch(new URL('predict', url), { method: 'POST', body: formData });
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
this.setHealthy(url, true);
|
this.setHealthy(url, true);
|
||||||
return response.json();
|
return response.json();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue