UI: GritAI engineered/industrial design system (dark, grit-orange, Archivo+IBM Plex)
Browse files
app.py
CHANGED
|
@@ -119,82 +119,213 @@ def api_analyze():
|
|
| 119 |
PAGE = """<!doctype html><html lang="en"><head><meta charset="utf-8">
|
| 120 |
<title>Feedback Analyzer</title>
|
| 121 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
|
|
|
|
|
|
| 122 |
<style>
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
.
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
.
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
#
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
@media(max-width:640px){.roll{grid-template-columns:1fr}}
|
| 146 |
-
.roll h3{margin:0 0
|
| 147 |
-
.bar{display:flex;height:12px;border-radius:
|
| 148 |
.bar i{display:block;height:100%}
|
| 149 |
-
.legend{display:flex;flex-wrap:wrap;gap:
|
| 150 |
-
.legend span{display:inline-flex;align-items:center;gap:
|
| 151 |
-
.
|
| 152 |
-
.
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
.
|
| 159 |
-
.b-
|
| 160 |
-
.
|
| 161 |
-
.
|
| 162 |
-
.
|
| 163 |
-
.
|
| 164 |
-
.
|
| 165 |
-
.
|
| 166 |
-
.
|
| 167 |
-
.
|
| 168 |
-
.
|
| 169 |
-
.spin{display:inline-flex;gap:6px;padding:20px}.spin span{width:9px;height:9px;border-radius:50%;background:var(--accent);opacity:.5;animation:bd 1.2s infinite}
|
| 170 |
-
.spin span:nth-child(2){animation-delay:.2s}.spin span:nth-child(3){animation-delay:.4s}
|
| 171 |
-
@keyframes bd{0%,60%,100%{transform:translateY(0);opacity:.35}30%{transform:translateY(-6px);opacity:1}}
|
| 172 |
-
.foot{text-align:center;font-size:10.5px;color:var(--muted);padding:16px 0 22px}.foot b{color:#6a5c4d}
|
| 173 |
</style></head>
|
| 174 |
-
<body><div class="
|
| 175 |
-
<header>
|
| 176 |
-
<
|
| 177 |
-
<div class="
|
| 178 |
-
<
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
</div>
|
| 186 |
<div class="out" id="out">
|
| 187 |
<div id="note"></div>
|
|
|
|
| 188 |
<div class="roll">
|
| 189 |
<div class="card"><h3>Sentiment</h3><div class="bar" id="sbar"></div><div class="legend" id="sleg"></div></div>
|
| 190 |
-
<div class="card"><h3>Top themes</h3><ul class="themes" id="themes"
|
| 191 |
</div>
|
| 192 |
-
<div class="
|
|
|
|
| 193 |
<div class="tablewrap"><table id="tbl"><thead><tr>
|
| 194 |
<th>Feedback</th><th>Sentiment</th><th>Intent</th><th>Conf.</th><th>Reason</th><th>Evidence</th>
|
| 195 |
</tr></thead><tbody id="tbody"></tbody></table></div>
|
| 196 |
</div>
|
| 197 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
</div><script>
|
| 199 |
const SAMPLE=["The barista remembered my order β made my whole morning!",
|
| 200 |
"App keeps crashing every time I try to check out. Fix this.",
|
|
@@ -211,7 +342,7 @@ const SAMPLE=["The barista remembered my order β made my whole morning!",
|
|
| 211 |
const $=id=>document.getElementById(id);
|
| 212 |
const src=$('src'),go=$('go'),out=$('out'),csv=$('csv'),labels=$('labels');
|
| 213 |
let isCsv=false,last=null;
|
| 214 |
-
const SC={positive:'var(--
|
| 215 |
function esc(s){return String(s==null?'':s).replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c]));}
|
| 216 |
function loadSample(){src.value=SAMPLE.join("\\n");isCsv=false;run();}
|
| 217 |
csv.onchange=e=>{const f=e.target.files[0];if(!f)return;const r=new FileReader();
|
|
@@ -227,7 +358,7 @@ function run(){if(go.disabled)return;const text=src.value.trim();if(!text){src.f
|
|
| 227 |
if(d.error){$('tbody').innerHTML='<tr><td colspan="6">'+esc(d.error)+'</td></tr>';return;}
|
| 228 |
last=d;render(d);
|
| 229 |
}).catch(()=>{$('tbody').innerHTML='<tr><td colspan="6">Something went wrong β please try again.</td></tr>';})
|
| 230 |
-
.finally(()=>{go.disabled=false;go.textContent='Analyze
|
| 231 |
}
|
| 232 |
function render(d){
|
| 233 |
if(d.truncated)$('note').innerHTML='<div class="note">Showing the first '+d.total+' of '+d.original+' rows (per-run cap).</div>';
|
|
@@ -235,7 +366,7 @@ function render(d){
|
|
| 235 |
const order=['positive','neutral','mixed','negative'];const total=d.total||1;
|
| 236 |
$('sbar').innerHTML=order.filter(s=>d.sentiment[s]).map(s=>'<i style="width:'+(100*d.sentiment[s]/total)+'%;background:'+SC[s]+'"></i>').join('');
|
| 237 |
$('sleg').innerHTML=order.filter(s=>d.sentiment[s]).map(s=>'<span><span class="dot" style="background:'+SC[s]+'"></span>'+s+' '+d.sentiment[s]+'</span>').join('');
|
| 238 |
-
$('themes').innerHTML=(d.themes||[]).map(t=>'<li>'+esc(t)+'</li>').join('')||'<li style="color:var(--
|
| 239 |
$('tbody').innerHTML=d.results.map(r=>{const c=Math.round((r.confidence||0)*100);
|
| 240 |
return '<tr><td class="txt">'+esc(r.text)+'</td>'+
|
| 241 |
'<td><span class="badge b-'+esc(r.sentiment)+'">'+esc(r.sentiment)+'</span></td>'+
|
|
|
|
| 119 |
PAGE = """<!doctype html><html lang="en"><head><meta charset="utf-8">
|
| 120 |
<title>Feedback Analyzer</title>
|
| 121 |
<meta name="viewport" content="width=device-width,initial-scale=1">
|
| 122 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 123 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 124 |
+
<link href="https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
| 125 |
<style>
|
| 126 |
+
/* ============================================================================
|
| 127 |
+
GRITAI DESIGN SYSTEM β "Engineered / Industrial"
|
| 128 |
+
Dark Β· grit-orange Β· Archivo + IBM Plex Β· blueprint grid + grain.
|
| 129 |
+
Canonical source of truth for every GritAI app (30-in-15 #1-30) + the hub.
|
| 130 |
+
Rob-approved 2026-09-05 (#9 pilot: design-critic 5.71 -> 7.57).
|
| 131 |
+
|
| 132 |
+
HOW TO USE: embed this <style> verbatim in an app's page, add the Google Fonts
|
| 133 |
+
<link> below, then build the body from the component classes here. Keep the
|
| 134 |
+
header (monogram + app name + tags), grit-orange as the ONLY accent, dark bg.
|
| 135 |
+
|
| 136 |
+
FONTS (add to <head>):
|
| 137 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 138 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 139 |
+
<link href="https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
| 140 |
+
============================================================================ */
|
| 141 |
+
:root{
|
| 142 |
+
--bg:#0a0b0e; --bg2:#0e1015; --panel:#111318; --panel2:#15181f;
|
| 143 |
+
--ink:#eef0f4; --dim:#9aa1b0; --dim2:#5f6675; --line:#20242e; --line2:#2b303c;
|
| 144 |
+
--grit:#ff5a2a; --grit2:#ff7d54; --grit-dim:#c9451f; --ok:#5fd08a; --bad:#ff6b6b;
|
| 145 |
+
--disp:'Archivo',system-ui,sans-serif; --body:'IBM Plex Sans',system-ui,sans-serif;
|
| 146 |
+
--mono:'IBM Plex Mono',ui-monospace,monospace;
|
| 147 |
+
}
|
| 148 |
+
*{box-sizing:border-box}
|
| 149 |
+
html,body{height:100%}
|
| 150 |
+
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--body);font-size:15px;line-height:1.6;
|
| 151 |
+
-webkit-font-smoothing:antialiased;position:relative;overflow-x:hidden}
|
| 152 |
+
/* blueprint grid + vignette */
|
| 153 |
+
body::before{content:"";position:fixed;inset:0;z-index:0;pointer-events:none;
|
| 154 |
+
background:linear-gradient(0deg,transparent 95%,rgba(255,90,42,.04) 100%),
|
| 155 |
+
repeating-linear-gradient(90deg,transparent 0 63px,rgba(255,255,255,.018) 63px 64px),
|
| 156 |
+
repeating-linear-gradient(0deg,transparent 0 63px,rgba(255,255,255,.018) 63px 64px),
|
| 157 |
+
radial-gradient(120% 80% at 50% -10%,#141821 0%,var(--bg) 55%)}
|
| 158 |
+
/* film grain */
|
| 159 |
+
body::after{content:"";position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.05;mix-blend-mode:overlay;
|
| 160 |
+
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
|
| 161 |
+
.wrap{position:relative;z-index:1;max-width:960px;margin:0 auto;padding:0 28px 70px}
|
| 162 |
+
|
| 163 |
+
/* ---- header band (monogram SVG + wordmark + tags) ---- */
|
| 164 |
+
header{display:flex;align-items:center;gap:16px;padding:22px 0 18px;border-bottom:1px solid var(--line);animation:fade .6s .02s both}
|
| 165 |
+
.mark{width:38px;height:38px;flex:none}.mark svg{display:block}
|
| 166 |
+
.brand{display:flex;flex-direction:column;line-height:1}
|
| 167 |
+
.brand .co{font-family:var(--disp);font-weight:900;font-size:19px;letter-spacing:.5px}.brand .co b{color:var(--grit)}
|
| 168 |
+
.brand .sub{font-family:var(--mono);font-size:10.5px;letter-spacing:.28em;text-transform:uppercase;color:var(--dim2);margin-top:5px}
|
| 169 |
+
.tags{margin-left:auto;display:flex;gap:8px}
|
| 170 |
+
.tag{font-family:var(--mono);font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--dim);border:1px solid var(--line2);border-radius:2px;padding:5px 9px}
|
| 171 |
+
.tag.hot{color:var(--grit);border-color:var(--grit-dim)}
|
| 172 |
+
/* canonical monogram SVG (paste in .mark):
|
| 173 |
+
<svg width="38" height="38" viewBox="0 0 38 38" fill="none"><rect x="1" y="1" width="36" height="36" rx="2" stroke="#2b303c"/><path d="M27 12.5A9 9 0 1 0 28 22H19" stroke="#ff5a2a" stroke-width="2.4" stroke-linecap="square"/><rect x="10.5" y="10.5" width="3" height="3" fill="#ff5a2a"/></svg> */
|
| 174 |
+
|
| 175 |
+
/* ---- hero ---- */
|
| 176 |
+
.hero{padding:34px 0 26px;animation:fade .6s .12s both}
|
| 177 |
+
.hero h1{font-family:var(--disp);font-weight:800;font-size:clamp(30px,5.4vw,52px);line-height:1.02;letter-spacing:-.02em;margin:0;max-width:16ch}
|
| 178 |
+
.hero h1 em{font-style:normal;color:var(--grit)}
|
| 179 |
+
.hero p{color:var(--dim);max-width:56ch;margin:16px 0 0;font-size:15.5px}
|
| 180 |
+
|
| 181 |
+
/* ---- section label (01 Β· NAME + rule) ---- */
|
| 182 |
+
.sec{display:flex;align-items:center;gap:14px;margin:30px 0 14px}
|
| 183 |
+
.sec .num{font-family:var(--mono);font-size:11px;font-weight:600;color:var(--grit);letter-spacing:.1em}
|
| 184 |
+
.sec .name{font-family:var(--mono);font-size:11px;font-weight:500;letter-spacing:.26em;text-transform:uppercase;color:var(--dim)}
|
| 185 |
+
.sec .rule{flex:1;height:1px;background:linear-gradient(90deg,var(--line2),transparent)}
|
| 186 |
+
|
| 187 |
+
/* ---- panels ---- */
|
| 188 |
+
.panel{border:1px solid var(--line);border-radius:3px;background:linear-gradient(180deg,var(--panel),var(--bg2))}
|
| 189 |
+
.card{border:1px solid var(--line2);border-radius:3px;background:var(--panel);padding:18px 20px}
|
| 190 |
+
.card.accent{border-left:2px solid var(--grit)}
|
| 191 |
+
|
| 192 |
+
/* ---- input field (terminal) ---- */
|
| 193 |
+
.field{display:flex;align-items:stretch;border:1px solid var(--line2);border-radius:3px;background:var(--panel);overflow:hidden;transition:border-color .18s}
|
| 194 |
+
.field:focus-within{border-color:var(--grit-dim)}
|
| 195 |
+
.field .car{font-family:var(--mono);color:var(--grit);padding:16px 0 16px 16px;font-size:15px;user-select:none}
|
| 196 |
+
.field input,.field textarea{flex:1;background:transparent;border:0;outline:none;color:var(--ink);font-family:var(--body);font-size:15.5px;padding:16px 14px;resize:vertical}
|
| 197 |
+
.field input::placeholder,.field textarea::placeholder{color:var(--dim2)}
|
| 198 |
+
textarea.ta{width:100%;min-height:140px;border:1px solid var(--line2);border-radius:3px;background:var(--panel);color:var(--ink);font-family:var(--body);font-size:15px;padding:14px 16px;outline:none;resize:vertical}
|
| 199 |
+
textarea.ta:focus{border-color:var(--grit-dim)}
|
| 200 |
+
|
| 201 |
+
/* ---- buttons ---- */
|
| 202 |
+
.run{border:0;background:var(--grit);color:#140a06;font-family:var(--mono);font-weight:600;font-size:13px;letter-spacing:.14em;text-transform:uppercase;padding:0 24px;cursor:pointer;transition:.16s;box-shadow:-1px 0 0 var(--grit-dim)}
|
| 203 |
+
.run:hover{background:var(--grit2);box-shadow:0 0 26px -4px rgba(255,90,42,.55)}
|
| 204 |
+
.run:disabled{opacity:.55;cursor:default;box-shadow:none}
|
| 205 |
+
.btn{display:inline-flex;align-items:center;gap:8px;border:0;border-radius:3px;background:var(--grit);color:#140a06;font-family:var(--mono);font-weight:600;font-size:13px;letter-spacing:.1em;text-transform:uppercase;padding:12px 22px;cursor:pointer;transition:.16s}
|
| 206 |
+
.btn:hover{background:var(--grit2);box-shadow:0 0 26px -4px rgba(255,90,42,.55)}
|
| 207 |
+
.btn.ghost{background:transparent;color:var(--dim);border:1px solid var(--line2)}
|
| 208 |
+
.btn.ghost:hover{color:var(--grit);border-color:var(--grit-dim);background:transparent;box-shadow:none}
|
| 209 |
+
|
| 210 |
+
/* ---- chips / controls ---- */
|
| 211 |
+
.chip{font-family:var(--mono);font-size:12px;color:var(--dim);background:var(--panel);border:1px solid var(--line);border-radius:2px;padding:8px 11px;cursor:pointer;transition:.15s}
|
| 212 |
+
.chip:hover{color:var(--grit);border-color:var(--grit-dim)}
|
| 213 |
+
.chip .pt{color:var(--dim2);margin-right:7px}
|
| 214 |
+
select,.select{padding:10px 12px;border:1px solid var(--line2);border-radius:3px;background:var(--panel);color:var(--ink);font-family:var(--mono);font-size:13px;outline:none;cursor:pointer}
|
| 215 |
+
select:focus{border-color:var(--grit-dim)}
|
| 216 |
+
label.lbl{font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:.24em;color:var(--dim2);display:block;margin-bottom:6px}
|
| 217 |
+
|
| 218 |
+
/* ---- mono log / trace rows ---- */
|
| 219 |
+
.log{font-family:var(--mono);font-size:13px;line-height:1.75}
|
| 220 |
+
.row{display:grid;grid-template-columns:22px auto 1fr;gap:0 12px;padding:13px 18px;border-bottom:1px solid var(--line)}
|
| 221 |
+
.row:last-child{border-bottom:0}
|
| 222 |
+
.row .mk{color:var(--grit);font-weight:600}
|
| 223 |
+
.row .tn{color:var(--grit2);text-transform:uppercase;letter-spacing:.06em;font-weight:500}
|
| 224 |
+
.row .rd{color:var(--ink);word-break:break-word}.row .rd .arg{color:var(--dim2)}
|
| 225 |
+
|
| 226 |
+
/* ---- tables ---- */
|
| 227 |
+
table{width:100%;border-collapse:collapse;font-size:13.5px}
|
| 228 |
+
th{text-align:left;font-family:var(--mono);font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:var(--dim2);font-weight:500;padding:11px 14px;border-bottom:1px solid var(--line2);background:var(--bg2)}
|
| 229 |
+
td{padding:11px 14px;border-bottom:1px solid var(--line);vertical-align:top}
|
| 230 |
+
tr:last-child td{border-bottom:0}
|
| 231 |
+
.tablewrap{border:1px solid var(--line);border-radius:3px;overflow:hidden;overflow-x:auto}
|
| 232 |
+
|
| 233 |
+
/* ---- chat bubbles ---- */
|
| 234 |
+
.msg{max-width:78%;padding:12px 15px;border-radius:3px;font-size:15px;line-height:1.55;margin-bottom:12px}
|
| 235 |
+
.msg.user{margin-left:auto;background:var(--panel2);border:1px solid var(--line2)}
|
| 236 |
+
.msg.bot{background:var(--panel);border:1px solid var(--line);border-left:2px solid var(--grit)}
|
| 237 |
+
|
| 238 |
+
/* ---- badges / pills ---- */
|
| 239 |
+
.badge{display:inline-block;font-family:var(--mono);font-size:11px;font-weight:500;letter-spacing:.06em;padding:3px 9px;border-radius:2px;border:1px solid var(--line2);color:var(--dim)}
|
| 240 |
+
.badge.on{color:var(--grit);border-color:var(--grit-dim)}
|
| 241 |
+
.hl{color:var(--grit);font-weight:600;font-family:var(--mono)}
|
| 242 |
+
|
| 243 |
+
/* ---- answer/output prose ---- */
|
| 244 |
+
.prose{font-size:16px;line-height:1.65}.prose p{margin:0 0 12px}.prose p:last-child{margin-bottom:0}.prose b{color:var(--ink)}
|
| 245 |
+
|
| 246 |
+
/* ---- spinner ---- */
|
| 247 |
+
.spin{display:inline-flex;gap:6px;padding:16px 18px}.spin span{width:8px;height:8px;border-radius:50%;background:var(--grit);opacity:.5;animation:bd 1.2s infinite}
|
| 248 |
+
.spin span:nth-child(2){animation-delay:.18s}.spin span:nth-child(3){animation-delay:.36s}
|
| 249 |
+
|
| 250 |
+
/* ---- footer ---- */
|
| 251 |
+
footer{margin-top:34px;padding-top:16px;border-top:1px solid var(--line);font-family:var(--mono);font-size:11px;letter-spacing:.06em;color:var(--dim2);display:flex;gap:16px;flex-wrap:wrap;animation:fade .6s .5s both}
|
| 252 |
+
footer .b{color:var(--dim)}footer .sp{margin-left:auto}
|
| 253 |
+
footer a{color:var(--dim);text-decoration:none}footer a:hover{color:var(--grit)}
|
| 254 |
+
|
| 255 |
+
/* ---- reveal animations ---- */
|
| 256 |
+
@keyframes fade{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
|
| 257 |
+
@keyframes slidein{from{opacity:0;transform:translateX(-8px)}to{opacity:1;transform:none}}
|
| 258 |
+
@keyframes bd{0%,60%,100%{transform:translateY(0);opacity:.35}30%{transform:translateY(-6px);opacity:1}}
|
| 259 |
+
.rvl{animation:fade .6s both}
|
| 260 |
+
|
| 261 |
+
/* ---- app-specific: feedback analyzer ---- */
|
| 262 |
+
.tools{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-top:14px}
|
| 263 |
+
#go{padding-top:14px;padding-bottom:14px;border-radius:3px}
|
| 264 |
+
.field.labelfield{flex:1;min-width:220px}
|
| 265 |
+
.out{display:none;margin-top:8px}.out.show{display:block}
|
| 266 |
+
.note{font-family:var(--mono);font-size:12px;color:var(--grit2);letter-spacing:.03em;margin:8px 2px 16px}
|
| 267 |
+
.roll{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:8px}
|
| 268 |
@media(max-width:640px){.roll{grid-template-columns:1fr}}
|
| 269 |
+
.roll h3{margin:0 0 12px;font-family:var(--mono);font-size:11px;letter-spacing:.24em;text-transform:uppercase;color:var(--dim2)}
|
| 270 |
+
.bar{display:flex;height:12px;border-radius:2px;overflow:hidden;margin-bottom:12px;background:var(--panel2);border:1px solid var(--line)}
|
| 271 |
.bar i{display:block;height:100%}
|
| 272 |
+
.legend{display:flex;flex-wrap:wrap;gap:12px;font-family:var(--mono);font-size:12px;color:var(--dim)}
|
| 273 |
+
.legend span{display:inline-flex;align-items:center;gap:6px}
|
| 274 |
+
.dot{width:9px;height:9px;border-radius:2px;display:inline-block}
|
| 275 |
+
.themes{margin:0;padding:0;list-style:none}
|
| 276 |
+
.themes li{font-family:var(--mono);font-size:13px;color:var(--ink);padding:6px 0 6px 18px;position:relative}
|
| 277 |
+
.themes li::before{content:"\\25B8";color:var(--grit);position:absolute;left:0}
|
| 278 |
+
.actions{display:flex;justify-content:space-between;align-items:center;gap:14px;margin:6px 2px 14px}
|
| 279 |
+
.actions h2{margin:0;font-family:var(--mono);font-size:11px;letter-spacing:.24em;text-transform:uppercase;color:var(--dim2)}
|
| 280 |
+
table{min-width:680px}
|
| 281 |
+
td.txt{max-width:300px;color:var(--ink)}
|
| 282 |
+
.badge.b-positive{color:var(--ok);border-color:rgba(95,208,138,.45)}
|
| 283 |
+
.badge.b-negative{color:var(--bad);border-color:rgba(255,107,107,.45)}
|
| 284 |
+
.badge.b-neutral{color:var(--dim);border-color:var(--line2)}
|
| 285 |
+
.badge.b-mixed{color:var(--grit);border-color:var(--grit-dim)}
|
| 286 |
+
.intent{font-family:var(--mono);font-size:12.5px;color:var(--dim);text-transform:capitalize}
|
| 287 |
+
.conf{font-family:var(--mono);font-variant-numeric:tabular-nums;color:var(--dim);font-size:12.5px}
|
| 288 |
+
.bar2{height:5px;background:var(--line);border-radius:2px;margin-top:5px;overflow:hidden}
|
| 289 |
+
.bar2 i{display:block;height:100%;background:var(--grit)}
|
| 290 |
+
.reason{color:var(--ink)}
|
| 291 |
+
.ev{color:var(--dim);font-style:italic}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
</style></head>
|
| 293 |
+
<body><div class="wrap">
|
| 294 |
+
<header>
|
| 295 |
+
<div class="mark"><svg width="38" height="38" viewBox="0 0 38 38" fill="none"><rect x="1" y="1" width="36" height="36" rx="2" stroke="#2b303c"/><path d="M27 12.5A9 9 0 1 0 28 22H19" stroke="#ff5a2a" stroke-width="2.4" stroke-linecap="square"/><rect x="10.5" y="10.5" width="3" height="3" fill="#ff5a2a"/></svg></div>
|
| 296 |
+
<div class="brand"><span class="co">GRIT<b>AI</b></span><span class="sub">Feedback Analyzer</span></div>
|
| 297 |
+
<div class="tags"><span class="tag hot">▸ Live</span><span class="tag">SDVOSB</span><span class="tag">Lawton OK</span></div>
|
| 298 |
+
</header>
|
| 299 |
+
<section class="hero">
|
| 300 |
+
<h1>Every review, scored for <em>sentiment & intent</em></h1>
|
| 301 |
+
<p>Paste or upload customer feedback in bulk β get per-item sentiment, intent, confidence, a reason, and the exact evidence phrase, plus a rollup and a downloadable labeled CSV.</p>
|
| 302 |
+
</section>
|
| 303 |
+
<div class="sec"><span class="num">01</span><span class="name">Feedback</span><span class="rule"></span></div>
|
| 304 |
+
<textarea id="src" class="ta" placeholder="Paste feedback β one item per line, or full reviews separated by a blank line. Or upload a CSV."></textarea>
|
| 305 |
+
<div class="tools">
|
| 306 |
+
<label class="btn ghost" for="csv">Upload CSV<input type="file" id="csv" accept=".csv,text/csv" style="display:none"></label>
|
| 307 |
+
<span class="chip" onclick="loadSample()">Load sample</span>
|
| 308 |
+
<div class="field labelfield"><span class="car">›</span><input id="labels" placeholder="Custom intent labels (optional, comma-separated)"></div>
|
| 309 |
+
<button class="run" id="go" onclick="run()">Analyze</button>
|
| 310 |
</div>
|
| 311 |
<div class="out" id="out">
|
| 312 |
<div id="note"></div>
|
| 313 |
+
<div class="sec"><span class="num">02</span><span class="name">Rollup</span><span class="rule"></span></div>
|
| 314 |
<div class="roll">
|
| 315 |
<div class="card"><h3>Sentiment</h3><div class="bar" id="sbar"></div><div class="legend" id="sleg"></div></div>
|
| 316 |
+
<div class="card"><h3>Top themes</h3><ul class="themes" id="themes"></ul></div>
|
| 317 |
</div>
|
| 318 |
+
<div class="sec"><span class="num">03</span><span class="name">Per-item results</span><span class="rule"></span></div>
|
| 319 |
+
<div class="actions"><h2>Labeled feedback</h2><button class="btn ghost" id="dl" onclick="download()">Download CSV</button></div>
|
| 320 |
<div class="tablewrap"><table id="tbl"><thead><tr>
|
| 321 |
<th>Feedback</th><th>Sentiment</th><th>Intent</th><th>Conf.</th><th>Reason</th><th>Evidence</th>
|
| 322 |
</tr></thead><tbody id="tbody"></tbody></table></div>
|
| 323 |
</div>
|
| 324 |
+
<footer>
|
| 325 |
+
<span class="b">One batched, schema-valid AI call</span>
|
| 326 |
+
<span>Counts computed in code</span>
|
| 327 |
+
<span class="sp">GRITAI SOLUTIONS Β· 30-in-15 β5</span>
|
| 328 |
+
</footer>
|
| 329 |
</div><script>
|
| 330 |
const SAMPLE=["The barista remembered my order β made my whole morning!",
|
| 331 |
"App keeps crashing every time I try to check out. Fix this.",
|
|
|
|
| 342 |
const $=id=>document.getElementById(id);
|
| 343 |
const src=$('src'),go=$('go'),out=$('out'),csv=$('csv'),labels=$('labels');
|
| 344 |
let isCsv=false,last=null;
|
| 345 |
+
const SC={positive:'var(--ok)',negative:'var(--bad)',neutral:'var(--dim)',mixed:'var(--grit)'};
|
| 346 |
function esc(s){return String(s==null?'':s).replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c]));}
|
| 347 |
function loadSample(){src.value=SAMPLE.join("\\n");isCsv=false;run();}
|
| 348 |
csv.onchange=e=>{const f=e.target.files[0];if(!f)return;const r=new FileReader();
|
|
|
|
| 358 |
if(d.error){$('tbody').innerHTML='<tr><td colspan="6">'+esc(d.error)+'</td></tr>';return;}
|
| 359 |
last=d;render(d);
|
| 360 |
}).catch(()=>{$('tbody').innerHTML='<tr><td colspan="6">Something went wrong β please try again.</td></tr>';})
|
| 361 |
+
.finally(()=>{go.disabled=false;go.textContent='Analyze';});
|
| 362 |
}
|
| 363 |
function render(d){
|
| 364 |
if(d.truncated)$('note').innerHTML='<div class="note">Showing the first '+d.total+' of '+d.original+' rows (per-run cap).</div>';
|
|
|
|
| 366 |
const order=['positive','neutral','mixed','negative'];const total=d.total||1;
|
| 367 |
$('sbar').innerHTML=order.filter(s=>d.sentiment[s]).map(s=>'<i style="width:'+(100*d.sentiment[s]/total)+'%;background:'+SC[s]+'"></i>').join('');
|
| 368 |
$('sleg').innerHTML=order.filter(s=>d.sentiment[s]).map(s=>'<span><span class="dot" style="background:'+SC[s]+'"></span>'+s+' '+d.sentiment[s]+'</span>').join('');
|
| 369 |
+
$('themes').innerHTML=(d.themes||[]).map(t=>'<li>'+esc(t)+'</li>').join('')||'<li style="color:var(--dim)">β</li>';
|
| 370 |
$('tbody').innerHTML=d.results.map(r=>{const c=Math.round((r.confidence||0)*100);
|
| 371 |
return '<tr><td class="txt">'+esc(r.text)+'</td>'+
|
| 372 |
'<td><span class="badge b-'+esc(r.sentiment)+'">'+esc(r.sentiment)+'</span></td>'+
|