From 856f584666e2b869f70e90c9b9a6f137c1554af9 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 29 Mar 2026 07:24:59 -0500 Subject: [PATCH] Fix "Use This" button: transfer prompt across pages via sessionStorage The optimization "Use This" button was on the /history page but tried to set document.getElementById('prompt') which only exists on /. The JS value was lost on navigation. Fix: store prompt in sessionStorage, pick it up on main page load. Also opens the composer overlay so the user sees the loaded prompt immediately instead of landing on an empty output view. Co-Authored-By: Claude Opus 4.6 (1M context) --- llm_team_ui.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/llm_team_ui.py b/llm_team_ui.py index 00cc776..73c57e2 100644 --- a/llm_team_ui.py +++ b/llm_team_ui.py @@ -3538,6 +3538,18 @@ async function toggleDemo() { loadModels(); renderSamplePrompts(); checkDemo(); +// Pick up prompt from optimization "Use This" button +(function(){ + var pending = sessionStorage.getItem('pending-prompt'); + if (pending) { + sessionStorage.removeItem('pending-prompt'); + var el = document.getElementById('prompt'); + if (el) el.value = pending; + // Open composer if in output-focused mode + var ct = document.querySelector('.container'); + if (ct) { ct.classList.remove('output-focused'); ct.classList.add('composer-active'); } + } +})(); // Background grid animation !function(){const c=document.getElementById('bg-grid');if(!c)return;const x=c.getContext('2d');function resize(){c.width=window.innerWidth;c.height=window.innerHeight}resize();window.addEventListener('resize',resize);let t=0;function draw(){x.clearRect(0,0,c.width,c.height);const s=50,ox=(t*0.2)%s,oy=(t*0.1)%s;x.fillStyle='rgba(226,181,90,0.025)';for(let gx=-s+ox;gx0.985){const ly=Math.random()*c.height;x.strokeStyle='rgba(226,181,90,0.012)';x.lineWidth=1;x.beginPath();x.moveTo(0,ly);x.lineTo(c.width,ly);x.stroke()}if(Math.random()>0.995){const lx=Math.random()*c.width;x.strokeStyle='rgba(226,181,90,0.008)';x.lineWidth=40;x.beginPath();x.moveTo(lx,0);x.lineTo(lx,c.height);x.stroke()}t++;requestAnimationFrame(draw)}draw()}(); @@ -6950,8 +6962,7 @@ function _showOptimizeStream(runId, jobId) { useBtn.style.cssText = 'color:var(--accent);border-color:var(--accent);font-size:9px;white-space:nowrap'; useBtn.textContent = 'Use This'; useBtn.onclick = function(){ - var promptEl = document.getElementById('prompt'); - if (promptEl) promptEl.value = r.prompt; + sessionStorage.setItem('pending-prompt', r.prompt); window.location.href = '/'; }; row.appendChild(useBtn);