Update index.html
Browse files- index.html +374 -165
index.html
CHANGED
|
@@ -4,128 +4,276 @@
|
|
| 4 |
<meta charset="UTF-8"/>
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
| 6 |
<title>Problem Solver</title>
|
| 7 |
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet"/>
|
| 8 |
<style>
|
| 9 |
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
|
|
| 10 |
:root{
|
| 11 |
-
--
|
| 12 |
-
--bg:#
|
| 13 |
-
--
|
| 14 |
-
--
|
| 15 |
-
--
|
| 16 |
-
--
|
| 17 |
-
--
|
| 18 |
-
--
|
| 19 |
-
--
|
| 20 |
-
--
|
| 21 |
-
--
|
| 22 |
-
--
|
| 23 |
-
--
|
| 24 |
-
--
|
| 25 |
-
--
|
| 26 |
-
--
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
.
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
.
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
.
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
.
|
| 51 |
-
.
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
|
|
|
| 54 |
#pp,#up{display:none;}
|
| 55 |
#pp.on,#up.on{display:block;}
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
.drop
|
| 65 |
-
.drop-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
.fbadge.on{display:flex;}
|
| 68 |
-
.
|
| 69 |
-
.
|
|
|
|
|
|
|
|
|
|
| 70 |
input[type=file]{display:none;}
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
.
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
.
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
.
|
| 93 |
-
|
| 94 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
.out::-webkit-scrollbar{width:4px;}
|
| 96 |
-
.out::-webkit-scrollbar-thumb{background:var(--
|
| 97 |
|
| 98 |
-
.empty{
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
-
/* Output sections
|
| 103 |
-
.section{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
.section.in{opacity:1;transform:translateY(0);}
|
| 105 |
-
.section-
|
| 106 |
-
|
| 107 |
-
.section-
|
| 108 |
-
.section-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
@keyframes spin{to{transform:rotate(360deg)}}
|
| 111 |
|
| 112 |
-
/*
|
| 113 |
-
.prose{font-size:
|
| 114 |
-
.prose h2{
|
|
|
|
|
|
|
|
|
|
| 115 |
.prose h2:first-child{margin-top:0;}
|
| 116 |
-
.prose h3{font-size:
|
| 117 |
-
.prose strong{font-weight:600;color:var(--
|
| 118 |
-
.prose ul,.prose ol{padding-left:
|
| 119 |
-
.prose li{margin-bottom:
|
| 120 |
-
.prose
|
| 121 |
|
| 122 |
-
|
| 123 |
-
.toast
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
@media(max-width:
|
| 126 |
.body{grid-template-columns:1fr;}
|
| 127 |
-
.side{border-right:none;border-bottom:1px solid var(--
|
| 128 |
-
.main{min-height:
|
| 129 |
.pipe{display:none;}
|
| 130 |
}
|
| 131 |
</style>
|
|
@@ -134,60 +282,77 @@ input[type=file]{display:none;}
|
|
| 134 |
<div class="app">
|
| 135 |
|
| 136 |
<nav class="nav">
|
| 137 |
-
<div class="nav-
|
| 138 |
-
|
| 139 |
-
|
|
|
|
|
|
|
|
|
|
| 140 |
</nav>
|
| 141 |
|
| 142 |
<div class="body">
|
|
|
|
|
|
|
| 143 |
<aside class="side">
|
| 144 |
-
<div class="side-
|
| 145 |
|
| 146 |
-
<div class="
|
| 147 |
-
<div class="field">
|
| 148 |
-
<label>Name</label>
|
| 149 |
<input type="text" id="iName" placeholder="e.g. Priya Sharma"/>
|
| 150 |
</div>
|
| 151 |
|
| 152 |
-
<div class="
|
| 153 |
<div class="tabs">
|
| 154 |
-
<div class="tab on" id="
|
| 155 |
-
<div class="tab" id="
|
| 156 |
-
</div>
|
| 157 |
-
|
| 158 |
-
<div id="pp" class="on">
|
| 159 |
-
<textarea id="tx" placeholder="Paste your transcript, meeting notes, or problem description…"></textarea>
|
| 160 |
</div>
|
| 161 |
|
| 162 |
-
<
|
|
|
|
| 163 |
<div class="drop" id="dz"
|
| 164 |
onclick="document.getElementById('fi').click()"
|
| 165 |
ondragover="dg(event,true)" ondragleave="dg(event,false)" ondrop="dp(event)">
|
| 166 |
-
<div class="drop-
|
| 167 |
-
|
| 168 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
</div>
|
| 170 |
<div class="fbadge" id="fb">
|
| 171 |
-
<
|
| 172 |
-
|
| 173 |
-
<
|
|
|
|
|
|
|
| 174 |
</div>
|
| 175 |
<input type="file" id="fi" accept=".pdf,.txt,.md" onchange="pf(event)"/>
|
| 176 |
</div>
|
| 177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
</div>
|
|
|
|
| 179 |
<div class="side-foot">
|
| 180 |
-
<button class="btn-
|
| 181 |
-
<svg
|
| 182 |
Analyze
|
| 183 |
</button>
|
| 184 |
-
<button class="btn-
|
| 185 |
-
<svg
|
| 186 |
Download PDF
|
| 187 |
</button>
|
| 188 |
</div>
|
| 189 |
</aside>
|
| 190 |
|
|
|
|
| 191 |
<main class="main">
|
| 192 |
<div class="bar">
|
| 193 |
<div class="sdot" id="sd"></div>
|
|
@@ -200,13 +365,18 @@ input[type=file]{display:none;}
|
|
| 200 |
<div class="pn" id="pn4">Coach</div>
|
| 201 |
</div>
|
| 202 |
</div>
|
|
|
|
| 203 |
<div class="out" id="out">
|
| 204 |
<div class="empty" id="es">
|
| 205 |
-
<
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
| 207 |
</div>
|
| 208 |
</div>
|
| 209 |
</main>
|
|
|
|
| 210 |
</div>
|
| 211 |
</div>
|
| 212 |
<div class="toast" id="toast"></div>
|
|
@@ -214,30 +384,46 @@ input[type=file]{display:none;}
|
|
| 214 |
<script>
|
| 215 |
const API='https://banao-tech-problem-decoder.hf.space';
|
| 216 |
const AG=[
|
| 217 |
-
{key:'analyst', title:'Problem Analyst', n:'
|
| 218 |
-
{key:'root_cause', title:'Root Cause
|
| 219 |
-
{key:'solutions', title:'Solutions', n:'
|
| 220 |
-
{key:'action_plan', title:'Action Plan', n:'
|
| 221 |
-
{key:'thinking', title:'Thinking Coach', n:'
|
| 222 |
];
|
| 223 |
-
let running=false,selFile=null,lastP=null,tab='
|
| 224 |
|
| 225 |
function setTab(t){
|
| 226 |
tab=t;
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
});
|
| 232 |
}
|
| 233 |
function dg(e,on){e.preventDefault();document.getElementById('dz').classList.toggle('over',on);}
|
| 234 |
function dp(e){e.preventDefault();document.getElementById('dz').classList.remove('over');const f=e.dataTransfer.files[0];if(f)sf(f);}
|
| 235 |
function pf(e){const f=e.target.files[0];if(f)sf(f);}
|
| 236 |
-
function sf(f){
|
| 237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
-
function toast(m,e=false){
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
function sp(i,s){const e=document.getElementById('pn'+i);if(e)e.className='pn '+s;}
|
| 242 |
function rp(){for(let i=0;i<5;i++)sp(i,'');}
|
| 243 |
|
|
@@ -253,27 +439,37 @@ function md(s){
|
|
| 253 |
|
| 254 |
async function rf(f){
|
| 255 |
if(f.name.endsWith('.pdf')){
|
| 256 |
-
return new Promise((res,rej)=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
}
|
| 258 |
-
return new Promise((res,rej)=>{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
}
|
| 260 |
|
| 261 |
async function run(){
|
| 262 |
if(running)return;
|
| 263 |
-
const name=document.getElementById('iName').value.trim()||'
|
| 264 |
let content='';
|
| 265 |
-
if(tab==='
|
|
|
|
|
|
|
|
|
|
| 266 |
content=document.getElementById('tx').value.trim();
|
| 267 |
if(!content){toast('Paste something first.',true);return;}
|
| 268 |
-
} else {
|
| 269 |
-
if(!selFile){toast('Select a file first.',true);return;}
|
| 270 |
-
try{content=await rf(selFile);}catch{toast('Could not read file.',true);return;}
|
| 271 |
}
|
|
|
|
| 272 |
running=true;
|
| 273 |
-
lastP={content,
|
| 274 |
document.getElementById('bRun').disabled=true;
|
| 275 |
document.getElementById('bPdf').disabled=true;
|
| 276 |
rp();
|
|
|
|
| 277 |
const out=document.getElementById('out');
|
| 278 |
out.innerHTML='';
|
| 279 |
ss('Running…','run');
|
|
@@ -282,19 +478,26 @@ async function run(){
|
|
| 282 |
const d=document.createElement('div');
|
| 283 |
d.className='section';
|
| 284 |
d.id='s-'+a.key;
|
| 285 |
-
d.innerHTML=`
|
| 286 |
-
<div class="section-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
|
|
|
|
|
|
| 290 |
out.appendChild(d);
|
| 291 |
});
|
| 292 |
|
| 293 |
try{
|
| 294 |
-
const res=await fetch(`${API}/analyze/stream`,{
|
|
|
|
|
|
|
|
|
|
| 295 |
if(!res.ok){const e=await res.json().catch(()=>({detail:res.statusText}));throw new Error(e.detail);}
|
|
|
|
| 296 |
const reader=res.body.getReader(),dec=new TextDecoder();
|
| 297 |
let buf='',cur=null;
|
|
|
|
| 298 |
while(true){
|
| 299 |
const{done,value}=await reader.read();
|
| 300 |
if(done)break;
|
|
@@ -320,13 +523,14 @@ async function run(){
|
|
| 320 |
const i=AG.findIndex(a=>a.key===m.agent);
|
| 321 |
sp(i,'done');
|
| 322 |
} else if(m.event==='done'){
|
| 323 |
-
ss('
|
| 324 |
document.getElementById('bPdf').disabled=false;
|
| 325 |
}
|
| 326 |
}catch{}
|
| 327 |
}
|
| 328 |
}
|
| 329 |
-
}catch(e){ss('
|
|
|
|
| 330 |
running=false;
|
| 331 |
document.getElementById('bRun').disabled=false;
|
| 332 |
}
|
|
@@ -336,12 +540,17 @@ async function getPdf(){
|
|
| 336 |
const b=document.getElementById('bPdf');
|
| 337 |
b.textContent='Generating…';b.disabled=true;
|
| 338 |
try{
|
| 339 |
-
const res=await fetch(`${API}/analyze/pdf`,{
|
| 340 |
-
|
|
|
|
|
|
|
|
|
|
| 341 |
const blob=await res.blob(),a=document.createElement('a');
|
| 342 |
-
a.href=URL.createObjectURL(blob);
|
|
|
|
|
|
|
| 343 |
}catch(e){toast(e.message,true);}
|
| 344 |
-
b.innerHTML='<svg width="
|
| 345 |
b.disabled=false;
|
| 346 |
}
|
| 347 |
</script>
|
|
|
|
| 4 |
<meta charset="UTF-8"/>
|
| 5 |
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
|
| 6 |
<title>Problem Solver</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;1,400&display=swap" rel="stylesheet"/>
|
| 8 |
<style>
|
| 9 |
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
| 10 |
+
|
| 11 |
:root{
|
| 12 |
+
--white:#ffffff;
|
| 13 |
+
--bg:#f8f9fa;
|
| 14 |
+
--bg2:#f1f3f5;
|
| 15 |
+
--border:#e9ecef;
|
| 16 |
+
--border2:#dee2e6;
|
| 17 |
+
--text:#0f1117;
|
| 18 |
+
--text2:#343a40;
|
| 19 |
+
--text3:#6c757d;
|
| 20 |
+
--text4:#adb5bd;
|
| 21 |
+
--accent:#2563eb;
|
| 22 |
+
--accent-h:#1d4ed8;
|
| 23 |
+
--accent-bg:#eff6ff;
|
| 24 |
+
--accent-border:#bfdbfe;
|
| 25 |
+
--success:#16a34a;
|
| 26 |
+
--success-bg:#f0fdf4;
|
| 27 |
+
--success-border:#bbf7d0;
|
| 28 |
+
--danger:#dc2626;
|
| 29 |
+
--radius:10px;
|
| 30 |
+
--radius-sm:7px;
|
| 31 |
+
--shadow:0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
|
| 32 |
+
--shadow-md:0 4px 6px rgba(0,0,0,.05),0 2px 4px rgba(0,0,0,.04);
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
html,body{height:100%;font-family:'Inter',system-ui,sans-serif;font-size:15px;line-height:1.5;color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;}
|
| 36 |
+
|
| 37 |
+
/* ── Layout ── */
|
| 38 |
+
.app{display:grid;grid-template-rows:57px 1fr;height:100vh;overflow:hidden;}
|
| 39 |
+
|
| 40 |
+
/* ── Nav ── */
|
| 41 |
+
.nav{
|
| 42 |
+
display:flex;align-items:center;padding:0 28px;
|
| 43 |
+
background:var(--white);border-bottom:1px solid var(--border);
|
| 44 |
+
box-shadow:var(--shadow);position:relative;z-index:10;
|
| 45 |
+
}
|
| 46 |
+
.nav-logo{display:flex;align-items:center;gap:9px;}
|
| 47 |
+
.nav-mark{
|
| 48 |
+
width:28px;height:28px;background:var(--accent);border-radius:7px;
|
| 49 |
+
display:flex;align-items:center;justify-content:center;flex-shrink:0;
|
| 50 |
+
}
|
| 51 |
+
.nav-mark svg{width:14px;height:14px;stroke:#fff;fill:none;stroke-width:2.5;}
|
| 52 |
+
.nav-name{font-size:15px;font-weight:600;color:var(--text);letter-spacing:-.01em;}
|
| 53 |
+
|
| 54 |
+
/* ── Body ── */
|
| 55 |
+
.body{display:grid;grid-template-columns:380px 1fr;overflow:hidden;}
|
| 56 |
+
|
| 57 |
+
/* ── Sidebar ── */
|
| 58 |
+
.side{
|
| 59 |
+
background:var(--white);border-right:1px solid var(--border);
|
| 60 |
+
display:flex;flex-direction:column;overflow:hidden;
|
| 61 |
+
}
|
| 62 |
+
.side-scroll{flex:1;overflow-y:auto;padding:28px 24px 0;}
|
| 63 |
+
.side-scroll::-webkit-scrollbar{width:0;}
|
| 64 |
+
.side-foot{padding:20px 24px;border-top:1px solid var(--border);}
|
| 65 |
+
|
| 66 |
+
/* Section label */
|
| 67 |
+
.slabel{
|
| 68 |
+
font-size:11px;font-weight:600;color:var(--text4);
|
| 69 |
+
letter-spacing:.08em;text-transform:uppercase;
|
| 70 |
+
margin-bottom:10px;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/* Name field */
|
| 74 |
+
.name-field{margin-bottom:28px;}
|
| 75 |
+
.name-field label{display:block;font-size:13px;font-weight:500;color:var(--text3);margin-bottom:6px;}
|
| 76 |
+
input[type=text]{
|
| 77 |
+
width:100%;background:var(--bg);border:1.5px solid var(--border);
|
| 78 |
+
border-radius:var(--radius-sm);color:var(--text);
|
| 79 |
+
font:inherit;font-size:15px;padding:10px 14px;
|
| 80 |
+
outline:none;transition:border-color .15s,box-shadow .15s;
|
| 81 |
+
}
|
| 82 |
+
input[type=text]:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(37,99,235,.1);}
|
| 83 |
+
input::placeholder{color:var(--text4);}
|
| 84 |
+
|
| 85 |
+
/* ── Tabs ── */
|
| 86 |
+
.tabs{
|
| 87 |
+
display:grid;grid-template-columns:1fr 1fr;
|
| 88 |
+
gap:0;background:var(--bg2);border-radius:var(--radius);
|
| 89 |
+
padding:3px;margin-bottom:16px;
|
| 90 |
+
}
|
| 91 |
+
.tab{
|
| 92 |
+
padding:9px 12px;text-align:center;font-size:14px;font-weight:500;
|
| 93 |
+
color:var(--text3);border-radius:8px;cursor:pointer;
|
| 94 |
+
transition:all .18s;user-select:none;
|
| 95 |
+
}
|
| 96 |
+
.tab.on{
|
| 97 |
+
background:var(--white);color:var(--text);font-weight:600;
|
| 98 |
+
box-shadow:var(--shadow);
|
| 99 |
+
}
|
| 100 |
|
| 101 |
+
/* ── Panes ── */
|
| 102 |
#pp,#up{display:none;}
|
| 103 |
#pp.on,#up.on{display:block;}
|
| 104 |
+
|
| 105 |
+
/* Upload — primary */
|
| 106 |
+
.drop{
|
| 107 |
+
border:2px dashed var(--border2);border-radius:var(--radius);
|
| 108 |
+
padding:36px 20px;text-align:center;cursor:pointer;
|
| 109 |
+
background:var(--bg);transition:border-color .2s,background .2s;
|
| 110 |
+
position:relative;
|
| 111 |
+
}
|
| 112 |
+
.drop:hover,.drop.over{border-color:var(--accent);background:var(--accent-bg);}
|
| 113 |
+
.drop-icon{
|
| 114 |
+
width:44px;height:44px;border-radius:11px;
|
| 115 |
+
background:var(--white);border:1.5px solid var(--border);
|
| 116 |
+
display:flex;align-items:center;justify-content:center;
|
| 117 |
+
margin:0 auto 14px;box-shadow:var(--shadow);
|
| 118 |
+
}
|
| 119 |
+
.drop-icon svg{width:20px;height:20px;stroke:var(--text3);fill:none;stroke-width:1.8;}
|
| 120 |
+
.drop h4{font-size:15px;font-weight:600;color:var(--text2);margin-bottom:4px;}
|
| 121 |
+
.drop p{font-size:13px;color:var(--text3);line-height:1.5;}
|
| 122 |
+
.drop-chips{display:flex;gap:6px;justify-content:center;margin-top:12px;}
|
| 123 |
+
.chip{
|
| 124 |
+
font-size:11px;font-weight:500;color:var(--text3);
|
| 125 |
+
background:var(--white);border:1px solid var(--border);
|
| 126 |
+
border-radius:4px;padding:2px 7px;letter-spacing:.03em;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.fbadge{
|
| 130 |
+
display:none;align-items:center;gap:10px;
|
| 131 |
+
padding:11px 14px;background:var(--success-bg);
|
| 132 |
+
border:1.5px solid var(--success-border);border-radius:var(--radius-sm);
|
| 133 |
+
margin-top:12px;
|
| 134 |
+
}
|
| 135 |
.fbadge.on{display:flex;}
|
| 136 |
+
.fbadge-icon{width:28px;height:28px;background:var(--success-bg);border:1.5px solid var(--success-border);border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
|
| 137 |
+
.fbadge-icon svg{width:14px;height:14px;stroke:var(--success);fill:none;stroke-width:2;}
|
| 138 |
+
.fbadge-name{flex:1;font-size:13px;font-weight:500;color:var(--success);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
| 139 |
+
.fbadge-clear{cursor:pointer;color:var(--text4);font-size:16px;line-height:1;transition:color .15s;}
|
| 140 |
+
.fbadge-clear:hover{color:var(--text2);}
|
| 141 |
input[type=file]{display:none;}
|
| 142 |
|
| 143 |
+
/* Textarea */
|
| 144 |
+
textarea{
|
| 145 |
+
width:100%;background:var(--bg);border:1.5px solid var(--border);
|
| 146 |
+
border-radius:var(--radius);color:var(--text);
|
| 147 |
+
font:inherit;font-size:14px;line-height:1.7;
|
| 148 |
+
padding:14px;min-height:220px;resize:none;outline:none;
|
| 149 |
+
transition:border-color .15s,box-shadow .15s;
|
| 150 |
+
}
|
| 151 |
+
textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(37,99,235,.1);}
|
| 152 |
+
textarea::placeholder{color:var(--text4);}
|
| 153 |
+
|
| 154 |
+
/* ── Buttons ── */
|
| 155 |
+
.btn-run{
|
| 156 |
+
width:100%;background:var(--accent);color:#fff;border:none;
|
| 157 |
+
border-radius:var(--radius-sm);padding:13px 18px;
|
| 158 |
+
font:inherit;font-size:15px;font-weight:600;cursor:pointer;
|
| 159 |
+
display:flex;align-items:center;justify-content:center;gap:8px;
|
| 160 |
+
transition:background .15s,box-shadow .15s,transform .1s;
|
| 161 |
+
letter-spacing:-.01em;
|
| 162 |
+
}
|
| 163 |
+
.btn-run:hover:not(:disabled){background:var(--accent-h);box-shadow:0 4px 14px rgba(37,99,235,.35);}
|
| 164 |
+
.btn-run:active:not(:disabled){transform:scale(.985);}
|
| 165 |
+
.btn-run:disabled{opacity:.45;cursor:not-allowed;}
|
| 166 |
+
.btn-run svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2.5;}
|
| 167 |
+
|
| 168 |
+
.btn-pdf{
|
| 169 |
+
width:100%;margin-top:8px;background:transparent;
|
| 170 |
+
color:var(--text3);border:1.5px solid var(--border);
|
| 171 |
+
border-radius:var(--radius-sm);padding:11px 18px;
|
| 172 |
+
font:inherit;font-size:14px;font-weight:500;cursor:pointer;
|
| 173 |
+
display:flex;align-items:center;justify-content:center;gap:8px;
|
| 174 |
+
transition:all .15s;
|
| 175 |
+
}
|
| 176 |
+
.btn-pdf:hover:not(:disabled){background:var(--success-bg);color:var(--success);border-color:var(--success-border);}
|
| 177 |
+
.btn-pdf:disabled{opacity:.3;cursor:not-allowed;}
|
| 178 |
+
.btn-pdf svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;}
|
| 179 |
+
|
| 180 |
+
/* ── Main output ── */
|
| 181 |
+
.main{display:flex;flex-direction:column;overflow:hidden;background:var(--white);}
|
| 182 |
+
|
| 183 |
+
.bar{
|
| 184 |
+
display:flex;align-items:center;gap:10px;
|
| 185 |
+
padding:0 28px;height:46px;border-bottom:1px solid var(--border);flex-shrink:0;
|
| 186 |
+
background:var(--white);
|
| 187 |
+
}
|
| 188 |
+
.sdot{width:7px;height:7px;border-radius:50%;background:var(--border);flex-shrink:0;transition:background .3s;}
|
| 189 |
+
.sdot.run{background:var(--accent);animation:pulse .9s infinite;}
|
| 190 |
+
.sdot.done{background:var(--success);}
|
| 191 |
+
.sdot.err{background:var(--danger);}
|
| 192 |
+
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.35}}
|
| 193 |
+
.stxt{font-size:13px;color:var(--text3);}
|
| 194 |
+
|
| 195 |
+
.pipe{margin-left:auto;display:flex;align-items:center;gap:4px;}
|
| 196 |
+
.pn{
|
| 197 |
+
font-size:11.5px;font-weight:500;color:var(--text4);
|
| 198 |
+
padding:3px 9px;border-radius:5px;
|
| 199 |
+
border:1px solid transparent;background:transparent;
|
| 200 |
+
transition:all .2s;
|
| 201 |
+
}
|
| 202 |
+
.pn.run{color:var(--accent);border-color:var(--accent-border);background:var(--accent-bg);}
|
| 203 |
+
.pn.done{color:var(--success);border-color:var(--success-border);background:var(--success-bg);}
|
| 204 |
+
.ps{font-size:10px;color:var(--border);}
|
| 205 |
+
|
| 206 |
+
/* ── Output ── */
|
| 207 |
+
.out{flex:1;overflow-y:auto;background:var(--white);}
|
| 208 |
.out::-webkit-scrollbar{width:4px;}
|
| 209 |
+
.out::-webkit-scrollbar-thumb{background:var(--border);border-radius:4px;}
|
| 210 |
|
| 211 |
+
.empty{
|
| 212 |
+
display:flex;flex-direction:column;align-items:center;
|
| 213 |
+
justify-content:center;height:100%;gap:14px;
|
| 214 |
+
text-align:center;padding-bottom:60px;
|
| 215 |
+
}
|
| 216 |
+
.empty-ico{
|
| 217 |
+
width:52px;height:52px;border-radius:13px;
|
| 218 |
+
background:var(--bg);border:1.5px solid var(--border);
|
| 219 |
+
display:flex;align-items:center;justify-content:center;
|
| 220 |
+
}
|
| 221 |
+
.empty-ico svg{width:22px;height:22px;stroke:var(--text4);fill:none;stroke-width:1.6;}
|
| 222 |
+
.empty h3{font-size:17px;font-weight:600;color:var(--text2);letter-spacing:-.01em;}
|
| 223 |
+
.empty p{font-size:14px;color:var(--text3);max-width:280px;line-height:1.65;}
|
| 224 |
|
| 225 |
+
/* ── Output sections ── */
|
| 226 |
+
.section{
|
| 227 |
+
border-bottom:1px solid var(--border);
|
| 228 |
+
padding:24px 32px;
|
| 229 |
+
opacity:0;transform:translateY(8px);
|
| 230 |
+
transition:opacity .35s ease,transform .35s ease;
|
| 231 |
+
}
|
| 232 |
.section.in{opacity:1;transform:translateY(0);}
|
| 233 |
+
.section:last-child{border-bottom:none;}
|
| 234 |
+
|
| 235 |
+
.section-hd{display:flex;align-items:center;gap:10px;margin-bottom:16px;}
|
| 236 |
+
.section-badge{
|
| 237 |
+
font-size:11px;font-weight:600;color:var(--text3);
|
| 238 |
+
background:var(--bg2);border:1px solid var(--border);
|
| 239 |
+
border-radius:5px;padding:2px 8px;letter-spacing:.04em;
|
| 240 |
+
text-transform:uppercase;flex-shrink:0;
|
| 241 |
+
}
|
| 242 |
+
.section-title{font-size:15px;font-weight:600;color:var(--text);letter-spacing:-.01em;flex:1;}
|
| 243 |
+
.section-spin{
|
| 244 |
+
width:14px;height:14px;flex-shrink:0;
|
| 245 |
+
border:1.8px solid var(--text4);border-top-color:transparent;
|
| 246 |
+
border-radius:50%;animation:spin .7s linear infinite;
|
| 247 |
+
}
|
| 248 |
+
.section-tick{font-size:15px;color:var(--success);flex-shrink:0;}
|
| 249 |
@keyframes spin{to{transform:rotate(360deg)}}
|
| 250 |
|
| 251 |
+
/* ── Prose ── */
|
| 252 |
+
.prose{font-size:15px;line-height:1.8;color:var(--text2);}
|
| 253 |
+
.prose h2{
|
| 254 |
+
font-size:14px;font-weight:600;color:var(--text);
|
| 255 |
+
margin:20px 0 8px;letter-spacing:-.01em;
|
| 256 |
+
}
|
| 257 |
.prose h2:first-child{margin-top:0;}
|
| 258 |
+
.prose h3{font-size:14px;font-weight:600;color:var(--text2);margin:14px 0 5px;}
|
| 259 |
+
.prose strong{font-weight:600;color:var(--text);}
|
| 260 |
+
.prose ul,.prose ol{padding-left:20px;margin:6px 0 10px;}
|
| 261 |
+
.prose li{margin-bottom:4px;}
|
| 262 |
+
.prose br+br{display:none;}
|
| 263 |
|
| 264 |
+
/* ── Toast ── */
|
| 265 |
+
.toast{
|
| 266 |
+
position:fixed;bottom:20px;left:50%;transform:translateX(-50%);
|
| 267 |
+
background:var(--text);color:#fff;padding:10px 18px;
|
| 268 |
+
border-radius:8px;font-size:14px;display:none;z-index:999;
|
| 269 |
+
box-shadow:var(--shadow-md);white-space:nowrap;
|
| 270 |
+
}
|
| 271 |
+
.toast.err{background:var(--danger);}
|
| 272 |
|
| 273 |
+
@media(max-width:780px){
|
| 274 |
.body{grid-template-columns:1fr;}
|
| 275 |
+
.side{border-right:none;border-bottom:1px solid var(--border);}
|
| 276 |
+
.main{min-height:55vh;}
|
| 277 |
.pipe{display:none;}
|
| 278 |
}
|
| 279 |
</style>
|
|
|
|
| 282 |
<div class="app">
|
| 283 |
|
| 284 |
<nav class="nav">
|
| 285 |
+
<div class="nav-logo">
|
| 286 |
+
<div class="nav-mark">
|
| 287 |
+
<svg viewBox="0 0 24 24"><path d="M9 12l2 2 4-4M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
| 288 |
+
</div>
|
| 289 |
+
<span class="nav-name">Problem Solver</span>
|
| 290 |
+
</div>
|
| 291 |
</nav>
|
| 292 |
|
| 293 |
<div class="body">
|
| 294 |
+
|
| 295 |
+
<!-- Sidebar -->
|
| 296 |
<aside class="side">
|
| 297 |
+
<div class="side-scroll">
|
| 298 |
|
| 299 |
+
<div class="slabel">Your name</div>
|
| 300 |
+
<div class="name-field">
|
|
|
|
| 301 |
<input type="text" id="iName" placeholder="e.g. Priya Sharma"/>
|
| 302 |
</div>
|
| 303 |
|
| 304 |
+
<div class="slabel">Input</div>
|
| 305 |
<div class="tabs">
|
| 306 |
+
<div class="tab on" id="tUpload" onclick="setTab('upload')">Upload file</div>
|
| 307 |
+
<div class="tab" id="tPaste" onclick="setTab('paste')">Paste text</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 308 |
</div>
|
| 309 |
|
| 310 |
+
<!-- Upload — default -->
|
| 311 |
+
<div id="up" class="on">
|
| 312 |
<div class="drop" id="dz"
|
| 313 |
onclick="document.getElementById('fi').click()"
|
| 314 |
ondragover="dg(event,true)" ondragleave="dg(event,false)" ondrop="dp(event)">
|
| 315 |
+
<div class="drop-icon">
|
| 316 |
+
<svg viewBox="0 0 24 24"><path d="M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2M16 10l-4-4-4 4M12 6v10"/></svg>
|
| 317 |
+
</div>
|
| 318 |
+
<h4>Upload a file</h4>
|
| 319 |
+
<p>Drag & drop or click to browse</p>
|
| 320 |
+
<div class="drop-chips">
|
| 321 |
+
<span class="chip">PDF</span>
|
| 322 |
+
<span class="chip">TXT</span>
|
| 323 |
+
<span class="chip">MD</span>
|
| 324 |
+
</div>
|
| 325 |
</div>
|
| 326 |
<div class="fbadge" id="fb">
|
| 327 |
+
<div class="fbadge-icon">
|
| 328 |
+
<svg viewBox="0 0 24 24"><path d="M9 12l2 2 4-4"/><rect x="3" y="3" width="18" height="18" rx="3"/></svg>
|
| 329 |
+
</div>
|
| 330 |
+
<span class="fbadge-name" id="fn">—</span>
|
| 331 |
+
<span class="fbadge-clear" onclick="cf()">✕</span>
|
| 332 |
</div>
|
| 333 |
<input type="file" id="fi" accept=".pdf,.txt,.md" onchange="pf(event)"/>
|
| 334 |
</div>
|
| 335 |
|
| 336 |
+
<!-- Paste text -->
|
| 337 |
+
<div id="pp">
|
| 338 |
+
<textarea id="tx" placeholder="Paste your transcript, meeting notes, problem description, or any text you want analyzed…"></textarea>
|
| 339 |
+
</div>
|
| 340 |
+
|
| 341 |
</div>
|
| 342 |
+
|
| 343 |
<div class="side-foot">
|
| 344 |
+
<button class="btn-run" id="bRun" onclick="run()">
|
| 345 |
+
<svg viewBox="0 0 24 24"><path d="M5 3l14 9-14 9V3z"/></svg>
|
| 346 |
Analyze
|
| 347 |
</button>
|
| 348 |
+
<button class="btn-pdf" id="bPdf" disabled onclick="getPdf()">
|
| 349 |
+
<svg viewBox="0 0 24 24"><path d="M12 15V3m0 12l-4-4m4 4l4-4M3 17v2a2 2 0 002 2h14a2 2 0 002-2v-2"/></svg>
|
| 350 |
Download PDF
|
| 351 |
</button>
|
| 352 |
</div>
|
| 353 |
</aside>
|
| 354 |
|
| 355 |
+
<!-- Output -->
|
| 356 |
<main class="main">
|
| 357 |
<div class="bar">
|
| 358 |
<div class="sdot" id="sd"></div>
|
|
|
|
| 365 |
<div class="pn" id="pn4">Coach</div>
|
| 366 |
</div>
|
| 367 |
</div>
|
| 368 |
+
|
| 369 |
<div class="out" id="out">
|
| 370 |
<div class="empty" id="es">
|
| 371 |
+
<div class="empty-ico">
|
| 372 |
+
<svg viewBox="0 0 24 24"><path d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/></svg>
|
| 373 |
+
</div>
|
| 374 |
+
<h3>Upload or paste to begin</h3>
|
| 375 |
+
<p>Five agents will analyze your input and hand you a structured breakdown with next steps.</p>
|
| 376 |
</div>
|
| 377 |
</div>
|
| 378 |
</main>
|
| 379 |
+
|
| 380 |
</div>
|
| 381 |
</div>
|
| 382 |
<div class="toast" id="toast"></div>
|
|
|
|
| 384 |
<script>
|
| 385 |
const API='https://banao-tech-problem-decoder.hf.space';
|
| 386 |
const AG=[
|
| 387 |
+
{key:'analyst', title:'Problem Analyst', n:'01'},
|
| 388 |
+
{key:'root_cause', title:'Root Cause', n:'02'},
|
| 389 |
+
{key:'solutions', title:'Solutions', n:'03'},
|
| 390 |
+
{key:'action_plan', title:'Action Plan', n:'04'},
|
| 391 |
+
{key:'thinking', title:'Thinking Coach', n:'05'},
|
| 392 |
];
|
| 393 |
+
let running=false,selFile=null,lastP=null,tab='upload';
|
| 394 |
|
| 395 |
function setTab(t){
|
| 396 |
tab=t;
|
| 397 |
+
document.getElementById('tUpload').classList.toggle('on',t==='upload');
|
| 398 |
+
document.getElementById('tPaste').classList.toggle('on',t==='paste');
|
| 399 |
+
document.getElementById('up').classList.toggle('on',t==='upload');
|
| 400 |
+
document.getElementById('pp').classList.toggle('on',t==='paste');
|
|
|
|
| 401 |
}
|
| 402 |
function dg(e,on){e.preventDefault();document.getElementById('dz').classList.toggle('over',on);}
|
| 403 |
function dp(e){e.preventDefault();document.getElementById('dz').classList.remove('over');const f=e.dataTransfer.files[0];if(f)sf(f);}
|
| 404 |
function pf(e){const f=e.target.files[0];if(f)sf(f);}
|
| 405 |
+
function sf(f){
|
| 406 |
+
selFile=f;
|
| 407 |
+
document.getElementById('fn').textContent=f.name;
|
| 408 |
+
document.getElementById('fb').classList.add('on');
|
| 409 |
+
}
|
| 410 |
+
function cf(){
|
| 411 |
+
selFile=null;
|
| 412 |
+
document.getElementById('fn').textContent='—';
|
| 413 |
+
document.getElementById('fb').classList.remove('on');
|
| 414 |
+
document.getElementById('fi').value='';
|
| 415 |
+
}
|
| 416 |
|
| 417 |
+
function toast(m,e=false){
|
| 418 |
+
const t=document.getElementById('toast');
|
| 419 |
+
t.textContent=m;t.className='toast'+(e?' err':'');
|
| 420 |
+
t.style.display='block';
|
| 421 |
+
setTimeout(()=>t.style.display='none',3500);
|
| 422 |
+
}
|
| 423 |
+
function ss(txt,s=''){
|
| 424 |
+
document.getElementById('st').textContent=txt;
|
| 425 |
+
document.getElementById('sd').className='sdot '+s;
|
| 426 |
+
}
|
| 427 |
function sp(i,s){const e=document.getElementById('pn'+i);if(e)e.className='pn '+s;}
|
| 428 |
function rp(){for(let i=0;i<5;i++)sp(i,'');}
|
| 429 |
|
|
|
|
| 439 |
|
| 440 |
async function rf(f){
|
| 441 |
if(f.name.endsWith('.pdf')){
|
| 442 |
+
return new Promise((res,rej)=>{
|
| 443 |
+
const r=new FileReader();
|
| 444 |
+
r.onload=()=>res('__PDF_BASE64__'+r.result.split(',')[1]);
|
| 445 |
+
r.onerror=rej;r.readAsDataURL(f);
|
| 446 |
+
});
|
| 447 |
}
|
| 448 |
+
return new Promise((res,rej)=>{
|
| 449 |
+
const r=new FileReader();
|
| 450 |
+
r.onload=()=>res(r.result);
|
| 451 |
+
r.onerror=rej;r.readAsText(f);
|
| 452 |
+
});
|
| 453 |
}
|
| 454 |
|
| 455 |
async function run(){
|
| 456 |
if(running)return;
|
| 457 |
+
const name=document.getElementById('iName').value.trim()||'Anonymous';
|
| 458 |
let content='';
|
| 459 |
+
if(tab==='upload'){
|
| 460 |
+
if(!selFile){toast('Upload a file first.',true);return;}
|
| 461 |
+
try{content=await rf(selFile);}catch{toast('Could not read file.',true);return;}
|
| 462 |
+
} else {
|
| 463 |
content=document.getElementById('tx').value.trim();
|
| 464 |
if(!content){toast('Paste something first.',true);return;}
|
|
|
|
|
|
|
|
|
|
| 465 |
}
|
| 466 |
+
|
| 467 |
running=true;
|
| 468 |
+
lastP={content,user_name:name,user_role:'',user_goal:''};
|
| 469 |
document.getElementById('bRun').disabled=true;
|
| 470 |
document.getElementById('bPdf').disabled=true;
|
| 471 |
rp();
|
| 472 |
+
|
| 473 |
const out=document.getElementById('out');
|
| 474 |
out.innerHTML='';
|
| 475 |
ss('Running…','run');
|
|
|
|
| 478 |
const d=document.createElement('div');
|
| 479 |
d.className='section';
|
| 480 |
d.id='s-'+a.key;
|
| 481 |
+
d.innerHTML=`
|
| 482 |
+
<div class="section-hd">
|
| 483 |
+
<span class="section-badge">${a.n}</span>
|
| 484 |
+
<span class="section-title">${a.title}</span>
|
| 485 |
+
<div class="section-spin" id="sp-${a.key}"></div>
|
| 486 |
+
</div>
|
| 487 |
+
<div class="prose" id="pr-${a.key}"></div>`;
|
| 488 |
out.appendChild(d);
|
| 489 |
});
|
| 490 |
|
| 491 |
try{
|
| 492 |
+
const res=await fetch(`${API}/analyze/stream`,{
|
| 493 |
+
method:'POST',headers:{'Content-Type':'application/json'},
|
| 494 |
+
body:JSON.stringify(lastP),
|
| 495 |
+
});
|
| 496 |
if(!res.ok){const e=await res.json().catch(()=>({detail:res.statusText}));throw new Error(e.detail);}
|
| 497 |
+
|
| 498 |
const reader=res.body.getReader(),dec=new TextDecoder();
|
| 499 |
let buf='',cur=null;
|
| 500 |
+
|
| 501 |
while(true){
|
| 502 |
const{done,value}=await reader.read();
|
| 503 |
if(done)break;
|
|
|
|
| 523 |
const i=AG.findIndex(a=>a.key===m.agent);
|
| 524 |
sp(i,'done');
|
| 525 |
} else if(m.event==='done'){
|
| 526 |
+
ss('Analysis complete','done');
|
| 527 |
document.getElementById('bPdf').disabled=false;
|
| 528 |
}
|
| 529 |
}catch{}
|
| 530 |
}
|
| 531 |
}
|
| 532 |
+
}catch(e){ss('Something went wrong','err');toast(e.message,true);}
|
| 533 |
+
|
| 534 |
running=false;
|
| 535 |
document.getElementById('bRun').disabled=false;
|
| 536 |
}
|
|
|
|
| 540 |
const b=document.getElementById('bPdf');
|
| 541 |
b.textContent='Generating…';b.disabled=true;
|
| 542 |
try{
|
| 543 |
+
const res=await fetch(`${API}/analyze/pdf`,{
|
| 544 |
+
method:'POST',headers:{'Content-Type':'application/json'},
|
| 545 |
+
body:JSON.stringify(lastP),
|
| 546 |
+
});
|
| 547 |
+
if(!res.ok)throw new Error('PDF generation failed');
|
| 548 |
const blob=await res.blob(),a=document.createElement('a');
|
| 549 |
+
a.href=URL.createObjectURL(blob);
|
| 550 |
+
a.download=`analysis_${Date.now()}.pdf`;
|
| 551 |
+
a.click();
|
| 552 |
}catch(e){toast(e.message,true);}
|
| 553 |
+
b.innerHTML='<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 15V3m0 12l-4-4m4 4l4-4M3 17v2a2 2 0 002 2h14a2 2 0 002-2v-2"/></svg> Download PDF';
|
| 554 |
b.disabled=false;
|
| 555 |
}
|
| 556 |
</script>
|