@@ -98,6 +98,7 @@ class RoutingPrototypingDemo {
9898 this . generateButton = document . getElementById ( 'generate-btn' ) ;
9999 this . analyzeButton = document . getElementById ( 'analyze-btn' ) ;
100100 this . refineButton = document . getElementById ( 'refine-btn' ) ;
101+ this . outputFrame = document . getElementById ( 'output-frame' ) ;
101102
102103 // Initialize settings system first
103104 await this . initializeSettings ( ) ;
@@ -148,22 +149,57 @@ class RoutingPrototypingDemo {
148149 }
149150 }
150151
152+ // Helper methods to manage both button sets
153+ setGenerateButtonState ( disabled ) {
154+ if ( this . generateButton ) {
155+ this . generateButton . disabled = disabled ;
156+ }
157+ const sidebarGenerateBtn = document . getElementById ( 'sidebar-generate-btn' ) ;
158+ if ( sidebarGenerateBtn ) {
159+ sidebarGenerateBtn . disabled = disabled ;
160+ }
161+ }
162+
163+ setRefineButtonState ( disabled ) {
164+ if ( this . refineButton ) {
165+ this . refineButton . disabled = disabled ;
166+ }
167+ const sidebarRefineBtn = document . getElementById ( 'sidebar-refine-btn' ) ;
168+ if ( sidebarRefineBtn ) {
169+ sidebarRefineBtn . disabled = disabled ;
170+ }
171+ }
172+
151173 setupEventListeners ( ) {
152- // Analyze Task button event listener
174+ // Main canvas button event listeners
153175 if ( this . analyzeButton ) {
154176 this . analyzeButton . addEventListener ( 'click' , ( ) => this . analyzeTask ( ) ) ;
155177 }
156178
157- // Generate Prototype button event listener
158179 if ( this . generateButton ) {
159180 this . generateButton . addEventListener ( 'click' , ( ) => this . generatePrototype ( ) ) ;
160181 }
161182
162- // Refine button event listener
163183 if ( this . refineButton ) {
164184 this . refineButton . addEventListener ( 'click' , ( ) => this . refinePrototype ( ) ) ;
165185 }
166186
187+ // Sidebar button event listeners (duplicates)
188+ const sidebarAnalyzeBtn = document . getElementById ( 'sidebar-analyze-btn' ) ;
189+ if ( sidebarAnalyzeBtn ) {
190+ sidebarAnalyzeBtn . addEventListener ( 'click' , ( ) => this . analyzeTask ( ) ) ;
191+ }
192+
193+ const sidebarGenerateBtn = document . getElementById ( 'sidebar-generate-btn' ) ;
194+ if ( sidebarGenerateBtn ) {
195+ sidebarGenerateBtn . addEventListener ( 'click' , ( ) => this . generatePrototype ( ) ) ;
196+ }
197+
198+ const sidebarRefineBtn = document . getElementById ( 'sidebar-refine-btn' ) ;
199+ if ( sidebarRefineBtn ) {
200+ sidebarRefineBtn . addEventListener ( 'click' , ( ) => this . refinePrototype ( ) ) ;
201+ }
202+
167203 // Template selection event listeners
168204 document . querySelectorAll ( '.template-card' ) . forEach ( card => {
169205 card . addEventListener ( 'click' , ( ) => {
@@ -190,6 +226,28 @@ class RoutingPrototypingDemo {
190226
191227 getModels ( ) {
192228 return [
229+ {
230+ id : 'ollama_gemma3_270m' ,
231+ name : 'Gemma3 270M (Local)' ,
232+ speed : 'Very Fast' ,
233+ capability : 'Basic' ,
234+ cost : 0.0 ,
235+ costLabel : 'Free (Local)' ,
236+ maxComplexity : 0.3 ,
237+ description : 'Ultra-fast local model for simple tasks' ,
238+ color : '#16a34a'
239+ } ,
240+ {
241+ id : 'ollama_llama32_3b' ,
242+ name : 'Llama3.2 3B (Local)' ,
243+ speed : 'Fast' ,
244+ capability : 'Balanced' ,
245+ cost : 0.0 ,
246+ costLabel : 'Free (Local)' ,
247+ maxComplexity : 0.7 ,
248+ description : 'Balanced local model for moderate complexity tasks' ,
249+ color : '#059669'
250+ } ,
193251 {
194252 id : 'openai_gpt35' ,
195253 name : 'GPT-3.5 Turbo' ,
@@ -282,7 +340,7 @@ class RoutingPrototypingDemo {
282340 }
283341
284342 selectDefaultModel ( ) {
285- this . selectModel ( 'openai_gpt35 ' ) ;
343+ this . selectModel ( 'ollama_gemma3_270m ' ) ;
286344 }
287345
288346 analyzeComplexityRealTime ( prompt ) {
@@ -387,10 +445,10 @@ class RoutingPrototypingDemo {
387445 }
388446
389447 async analyzeTask ( ) {
390- this . generateButton . disabled = true ;
448+ this . setGenerateButtonState ( true ) ;
391449
392450 const pipeline = this . createWorkflowPipeline ( ) ;
393- pipeline . updateStepStatus ( 'task-analysis ' , 'active' ) ;
451+ pipeline . updateStepStatus ( 'analyze ' , 'active' ) ;
394452
395453 // Simulate analysis delay
396454 await this . delay ( 500 ) ;
@@ -404,21 +462,21 @@ class RoutingPrototypingDemo {
404462 const recommendedModel = this . recommendModel ( complexity ) ;
405463 this . selectModel ( recommendedModel . id ) ;
406464
407- pipeline . updateStepStatus ( 'task-analysis ' , 'completed' ) ;
408- pipeline . updateStepStatus ( 'routing ' , 'active' ) ;
465+ pipeline . updateStepStatus ( 'analyze ' , 'completed' ) ;
466+ pipeline . updateStepStatus ( 'route ' , 'active' ) ;
409467
410468 // Simulate routing delay
411469 await this . delay ( 300 ) ;
412470
413471 this . createRoutingVisualization ( this . selectedModel , complexity ) ;
414- pipeline . updateStepStatus ( 'routing ' , 'completed' ) ;
415- pipeline . updateStepStatus ( 'generation ' , 'pending' ) ;
472+ pipeline . updateStepStatus ( 'route ' , 'completed' ) ;
473+ pipeline . updateStepStatus ( 'generate ' , 'pending' ) ;
416474
417- this . generateButton . disabled = false ;
475+ this . setGenerateButtonState ( false ) ;
418476 }
419477
420478 createRoutingVisualization ( selectedModel , complexity ) {
421- const visualizer = new WorkflowVisualizer ( 'routing-visualizer ' ) ;
479+ const visualizer = new WorkflowVisualizer ( 'routing-visualization ' ) ;
422480 visualizer . clear ( ) ;
423481
424482 const routes = this . getModels ( ) . map ( model => ( {
@@ -435,7 +493,7 @@ class RoutingPrototypingDemo {
435493 this . refineButton . disabled = true ;
436494
437495 const pipeline = this . createWorkflowPipeline ( ) ;
438- pipeline . updateStepStatus ( 'generation ' , 'active' ) ;
496+ pipeline . updateStepStatus ( 'generate ' , 'active' ) ;
439497
440498 const agentState = this . agentConfigManager . getState ( ) ;
441499
@@ -474,14 +532,14 @@ class RoutingPrototypingDemo {
474532 this . renderPrototypeResult ( result ) ;
475533 this . displayGenerationResults ( result ) ;
476534
477- pipeline . updateStepStatus ( 'generation ' , 'completed' ) ;
478- this . refineButton . disabled = false ;
535+ pipeline . updateStepStatus ( 'generate ' , 'completed' ) ;
536+ this . setRefineButtonState ( false ) ;
479537
480538 } catch ( error ) {
481539 console . error ( 'Generation failed:' , error ) ;
482- pipeline . updateStepStatus ( 'generation ' , 'error' ) ;
540+ pipeline . updateStepStatus ( 'generate ' , 'error' ) ;
483541 } finally {
484- this . generateButton . disabled = false ;
542+ this . setGenerateButtonState ( false ) ;
485543 }
486544 }
487545
@@ -520,13 +578,13 @@ class RoutingPrototypingDemo {
520578 const container = document . getElementById ( 'results-container' ) ;
521579 container . innerHTML = '' ;
522580
523- const visualizer = new WorkflowVisualizer ( ) ;
581+ const visualizer = new WorkflowVisualizer ( 'results-container' ) ;
524582 visualizer . createResultsDisplay ( {
525583 'Selected Model' : this . selectedModel . name ,
526584 'Task Complexity' : `${ ( this . currentComplexity * 100 ) . toFixed ( 0 ) } %` ,
527585 'Estimated Cost' : `$${ ( Math . random ( ) * 0.1 ) . toFixed ( 4 ) } ` ,
528586 'Execution Time' : `${ ( result . duration || 2500 / 1000 ) . toFixed ( 2 ) } s`
529- } , 'results-container' ) ;
587+ } ) ;
530588 }
531589
532590 async refinePrototype ( ) {
0 commit comments