@ -108,10 +108,12 @@ document.addEventListener('DOMContentLoaded', () => {
const line = document . createElement ( 'div' ) ;
const line = document . createElement ( 'div' ) ;
line . className = ` log-line ${ type } ` ;
line . className = ` log-line ${ type } ` ;
// Simple heuristic for colored logs
// Advanced heuristic for colored logs
if ( text . includes ( '[INFO]' ) ) line . classList . add ( 'info' ) ;
if ( text . includes ( '[INFO]' ) ) line . classList . add ( 'info' ) ;
if ( text . includes ( '[WARN]' ) ) line . classList . add ( 'warn' ) ;
if ( text . includes ( '[WARN]' ) ) line . classList . add ( 'warn' ) ;
if ( text . includes ( '[ERROR]' ) ) line . classList . add ( 'error' ) ;
if ( text . includes ( '[ERROR]' ) ) line . classList . add ( 'error' ) ;
if ( text . includes ( '[SUCCESS]' ) ) line . classList . add ( 'success' ) ;
if ( text . includes ( '[FRAME ' ) ) line . classList . add ( 'frame-log' ) ;
if ( text . includes ( 'Traceback' ) || text . includes ( 'Exception' ) ) line . classList . add ( 'error' ) ;
if ( text . includes ( 'Traceback' ) || text . includes ( 'Exception' ) ) line . classList . add ( 'error' ) ;
line . textContent = text ;
line . textContent = text ;
@ -150,13 +152,23 @@ document.addEventListener('DOMContentLoaded', () => {
if ( data . startsWith ( '[PROCESS_COMPLETED]' ) ) {
if ( data . startsWith ( '[PROCESS_COMPLETED]' ) ) {
appendLog ( ` > Simulation Finished. ${ data } ` , 'info' ) ;
appendLog ( ` > Simulation Finished. ${ data } ` , 'info' ) ;
setLoadingState ( false ) ;
setLoadingState ( false ) ;
document . getElementById ( 'sim-progress-container' ) . style . display = 'none' ;
} else {
} else {
// Only append if it's not a carriage return override (like tqdm progress bars)
// We do a simple replacement to simulate carriage returns in HTML
// Intercept progress bar logs
if ( data . includes ( 'SIMULATING:' ) ) {
const match = data . match ( /(\d+)%\|.*\|\s*(\d+)\/(\d+)/ ) ;
if ( match ) {
document . getElementById ( 'sim-progress-container' ) . style . display = 'block' ;
document . getElementById ( 'sim-progress-fill' ) . style . width = match [ 1 ] + '%' ;
document . getElementById ( 'sim-progress-text' ) . textContent = ` ${ match [ 1 ] } % ( ${ match [ 2 ] } / ${ match [ 3 ] } frames) ` ;
continue ; // Skip appending this line to the terminal box
}
}
// Prevent carriage return visual artifacts
if ( data . includes ( '\r' ) ) {
if ( data . includes ( '\r' ) ) {
const parts = data . split ( '\r' ) ;
const parts = data . split ( '\r' ) ;
const lastPart = parts [ parts . length - 1 ] ;
const lastPart = parts [ parts . length - 1 ] ;
// Replace the content of the very last line if it exists
const lastLine = terminalOutput . lastElementChild ;
const lastLine = terminalOutput . lastElementChild ;
if ( lastLine && ! lastLine . textContent . includes ( '\n' ) ) {
if ( lastLine && ! lastLine . textContent . includes ( '\n' ) ) {
lastLine . textContent = lastPart ;
lastLine . textContent = lastPart ;