@@ -193,7 +193,8 @@ var app = new Vue({
193193 let payload = {
194194 spec : this . modelSpec ,
195195 } ;
196- const response = await fetch ( `${ URL } /verify` , {
196+ let startTime = performance . now ( ) ; // Capture start time
197+ const response = await fetch ( `${ SELF_URL } /verify` , {
197198 method : 'POST' ,
198199 headers : {
199200 'Content-Type' : 'application/json' ,
@@ -202,7 +203,10 @@ var app = new Vue({
202203 } ) ;
203204 console . log ( response ) ;
204205 let r = await response . json ( ) ;
205- this . latency = r . elapsed ;
206+ let endTime = performance . now ( ) ; // Capture end time
207+ let latency = endTime - startTime ; // Calculate latency in milliseconds
208+ latency = latency . toFixed ( 3 ) / 1000 ; // Round to 2 decimal places
209+ this . latency = latency ;
206210 if ( ! response . ok ) {
207211 this . updateStatusDot ( false ) ;
208212 this . errorMsg = 'Integration verification failed:' + JSON . stringify ( r ) ;
@@ -218,7 +222,7 @@ var app = new Vue({
218222 this . saveStateToLocalStorage ( ) ;
219223 } ,
220224 loadConfigs : async function ( ) {
221- const response = await fetch ( `${ URL } /v1/data-config` , {
225+ const response = await fetch ( `${ SELF_URL } /v1/data-config` , {
222226 method : 'GET' ,
223227 headers : {
224228 'Content-Type' : 'application/json' ,
@@ -290,6 +294,7 @@ var app = new Vue({
290294 this . okMsg = `${ event . module } ` ;
291295 return
292296 }
297+ this . latency = event . latency . toFixed ( 3 ) ;
293298 console . log ( 'New event' ) ;
294299 // { "module": "Module 49", "tokens": 480, "cost": 4.800000000000001, "progress": 9.8 }
295300 let progress = event . progress ;
@@ -325,14 +330,14 @@ var app = new Vue({
325330 let payload = {
326331 table : this . mainTable ,
327332 } ;
328- const response = await fetch ( `${ URL } /plot.jpeg` , {
333+ const response = await fetch ( `${ SELF_URL } /plot.jpeg` , {
329334 method : 'POST' ,
330335 headers : {
331336 'Content-Type' : 'application/json' ,
332337 } ,
333338 body : JSON . stringify ( payload ) ,
334339 } ) ;
335- // Convert image response to a data URL for the <img> src
340+ // Convert image response to a data SELF_URL for the <img> src
336341 const blob = await response . blob ( ) ;
337342 const reader = new FileReader ( ) ;
338343 reader . readAsDataURL ( blob ) ;
@@ -375,7 +380,7 @@ var app = new Vue({
375380 } ,
376381 stopScan : async function ( ) {
377382 this . scanRunning = false ;
378- const response = await fetch ( `${ URL } /stop` , {
383+ const response = await fetch ( `${ SELF_URL } /stop` , {
379384 method : 'POST' ,
380385 headers : {
381386 'Content-Type' : 'application/json' ,
@@ -391,7 +396,7 @@ var app = new Vue({
391396 optimize : this . optimize ,
392397 enableMultiStepAttack : this . enableMultiStepAttack ,
393398 } ;
394- const response = await fetch ( `${ URL } /scan` , {
399+ const response = await fetch ( `${ SELF_URL } /scan` , {
395400 method : 'POST' ,
396401 headers : {
397402 'Content-Type' : 'application/json' ,
0 commit comments