@@ -89,7 +89,8 @@ export async function downloadModelFromGallery(
8989export async function activeModels ( ) {
9090 let response ;
9191 try {
92- response = await authenticatedFetch ( `${ API_URL ( ) } v1/models` ) ;
92+ // Pass just the path - fetchWithAuth will handle prepending the base URL
93+ response = await authenticatedFetch ( 'v1/models' ) ;
9394 // console.log('response ok?' + response.ok);
9495 const result = await response . json ( ) ;
9596 return result ;
@@ -104,7 +105,8 @@ export async function activeModels() {
104105export async function apiHealthz ( ) {
105106 let response ;
106107 try {
107- response = await authenticatedFetch ( `${ API_URL ( ) } healthz` ) ;
108+ // Pass just the path - fetchWithAuth will handle prepending the base URL
109+ response = await authenticatedFetch ( 'healthz' ) ;
108110 // console.log('response ok?' + response.ok);
109111 const result = await response . json ( ) ;
110112 return result ;
@@ -118,7 +120,8 @@ export async function controllerHealthz() {
118120 let response ;
119121 try {
120122 // For now we hard code the worker to the default FastChat API port of 21002
121- response = await authenticatedFetch ( API_URL ( ) + 'v1/models' , {
123+ // Pass just the path - fetchWithAuth will handle prepending the base URL
124+ response = await authenticatedFetch ( 'v1/models' , {
122125 method : 'GET' ,
123126 } ) ;
124127 if ( response . ok ) {
@@ -135,7 +138,8 @@ export async function controllerHealthz() {
135138export async function localaiHealthz ( ) {
136139 let response ;
137140 try {
138- response = await authenticatedFetch ( API_URL ( ) + 'v1/models' ) ;
141+ // Pass just the path - fetchWithAuth will handle prepending the base URL
142+ response = await authenticatedFetch ( 'v1/models' ) ;
139143 // console.log('response ok?' + response.ok);
140144 const result = await response . json ( ) ;
141145 return result ;
@@ -148,7 +152,8 @@ export async function localaiHealthz() {
148152export async function getComputerInfo ( ) {
149153 let response ;
150154 try {
151- response = await authenticatedFetch ( API_URL ( ) + 'server/info' ) ;
155+ // Pass just the path - fetchWithAuth will handle prepending the base URL
156+ response = await authenticatedFetch ( 'server/info' ) ;
152157 // console.log('response ok?' + response.ok);
153158 const result = await response . json ( ) ;
154159 return result ;
@@ -181,21 +186,9 @@ export async function activateWorker(
181186 const paramsJSON = JSON . stringify ( parameters ) ;
182187
183188 try {
184- response = await authenticatedFetch (
185- API_URL ( ) +
186- 'server/worker_start?model_name=' +
187- model +
188- '&adaptor=' +
189- adaptorName +
190- '&model_architecture=' +
191- modelArchitecture +
192- '&engine=' +
193- engine +
194- '&experiment_id=' +
195- experimentId +
196- '¶meters=' +
197- paramsJSON ,
198- ) ;
189+ // Pass just the path with query params - fetchWithAuth will handle prepending the base URL
190+ const queryString = `server/worker_start?model_name=${ model } &adaptor=${ adaptorName } &model_architecture=${ modelArchitecture } &engine=${ engine } &experiment_id=${ experimentId } ¶meters=${ paramsJSON } ` ;
191+ response = await authenticatedFetch ( queryString ) ;
199192 const result = await response . json ( ) ;
200193 return result ;
201194 } catch ( error ) {
@@ -207,7 +200,8 @@ export async function activateWorker(
207200export async function killWorker ( ) {
208201 let response ;
209202 try {
210- response = await authenticatedFetch ( API_URL ( ) + 'server/worker_stop' ) ;
203+ // Pass just the path - fetchWithAuth will handle prepending the base URL
204+ response = await authenticatedFetch ( 'server/worker_stop' ) ;
211205 const result = await response . json ( ) ;
212206 return result ;
213207 } catch ( error ) {
0 commit comments