Spaces:
Sleeping
Sleeping
| <!-- | |
| ============================================================================ | |
| agent verf - Production UI | |
| Version: 1.0.0 | |
| Last Updated: 2026-01-25 | |
| AI-powered fact-checking for social media claims. | |
| ============================================================================ | |
| --> | |
| <html lang="en" data-theme="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>agent verf - Verify Any Content</title> | |
| <meta name="description" content="AI-powered fact-checking for social media claims. Paste a tweet URL and get a verdict with sources."> | |
| <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔍</text></svg>"> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| :root { | |
| --bg-primary: #0a0a0a; | |
| --bg-secondary: #111; | |
| --bg-tertiary: #1a1a1a; | |
| --border-primary: #1f1f1f; | |
| --border-secondary: #2a2a2a; | |
| --text-primary: #ededed; | |
| --text-secondary: #888; | |
| --text-tertiary: #555; | |
| --accent: #ededed; | |
| --accent-hover: #fff; | |
| --verdict-true: #22c55e; | |
| --verdict-false: #ef4444; | |
| --verdict-mixed: #f59e0b; | |
| --verdict-true-bg: rgba(34, 197, 94, 0.15); | |
| --verdict-false-bg: rgba(239, 68, 68, 0.15); | |
| --verdict-mixed-bg: rgba(245, 158, 11, 0.15); | |
| } | |
| [data-theme="light"] { | |
| --bg-primary: #ffffff; | |
| --bg-secondary: #ffffff; | |
| --bg-tertiary: #f9fafb; | |
| --border-primary: #e5e7eb; | |
| --border-secondary: #d1d5db; | |
| --text-primary: #111827; | |
| --text-secondary: #6b7280; | |
| --text-tertiary: #9ca3af; | |
| --accent: #111827; | |
| --accent-hover: #000; | |
| --verdict-true-bg: #dcfce7; | |
| --verdict-false-bg: #fee2e2; | |
| --verdict-mixed-bg: #fef3c7; | |
| } | |
| body { | |
| font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; | |
| background: var(--bg-primary); | |
| color: var(--text-primary); | |
| line-height: 1.6; | |
| min-height: 100vh; | |
| transition: background 0.3s, color 0.3s; | |
| } | |
| header { | |
| border-bottom: 1px solid var(--border-primary); | |
| padding: 16px 32px; | |
| background: var(--bg-secondary); | |
| position: sticky; | |
| top: 0; | |
| z-index: 100; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .logo { | |
| font-size: 18px; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| text-decoration: none; | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| } | |
| .theme-toggle { | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| cursor: pointer; | |
| } | |
| .toggle-switch { | |
| width: 44px; | |
| height: 24px; | |
| background: var(--border-secondary); | |
| border-radius: 12px; | |
| position: relative; | |
| transition: background 0.3s; | |
| } | |
| .toggle-switch::after { | |
| content: ""; | |
| position: absolute; | |
| top: 3px; | |
| left: 3px; | |
| width: 18px; | |
| height: 18px; | |
| background: var(--text-primary); | |
| border-radius: 50%; | |
| transition: transform 0.3s; | |
| } | |
| [data-theme="light"] .toggle-switch::after { | |
| transform: translateX(20px); | |
| } | |
| .container { | |
| max-width: 640px; | |
| margin: 0 auto; | |
| padding: 60px 24px; | |
| } | |
| .hero { | |
| text-align: center; | |
| margin-bottom: 48px; | |
| } | |
| h1 { | |
| font-size: 40px; | |
| font-weight: 700; | |
| margin-bottom: 12px; | |
| letter-spacing: -0.02em; | |
| } | |
| .subtitle { | |
| color: var(--text-secondary); | |
| font-size: 16px; | |
| } | |
| .input-card { | |
| background: var(--bg-secondary); | |
| border: 1px solid var(--border-primary); | |
| border-radius: 12px; | |
| padding: 28px; | |
| } | |
| label { | |
| display: block; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 12px; | |
| font-weight: 500; | |
| margin-bottom: 10px; | |
| color: var(--text-secondary); | |
| text-transform: uppercase; | |
| letter-spacing: 0.5px; | |
| } | |
| input[type="text"], textarea { | |
| width: 100%; | |
| padding: 14px 16px; | |
| background: var(--bg-primary); | |
| border: 1px solid var(--border-secondary); | |
| border-radius: 8px; | |
| font-size: 15px; | |
| font-family: 'JetBrains Mono', monospace; | |
| color: var(--text-primary); | |
| margin-bottom: 16px; | |
| transition: all 0.2s; | |
| } | |
| textarea { | |
| min-height: 100px; | |
| resize: vertical; | |
| } | |
| input::placeholder, textarea::placeholder { | |
| color: var(--text-tertiary); | |
| } | |
| input:focus, textarea:focus { | |
| outline: none; | |
| border-color: var(--text-secondary); | |
| } | |
| .input-tabs { | |
| display: flex; | |
| gap: 8px; | |
| margin-bottom: 20px; | |
| } | |
| .tab-btn { | |
| flex: 1; | |
| padding: 10px; | |
| background: var(--bg-tertiary); | |
| border: 1px solid var(--border-secondary); | |
| border-radius: 6px; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 12px; | |
| color: var(--text-secondary); | |
| cursor: pointer; | |
| transition: all 0.15s; | |
| } | |
| .tab-btn.active { | |
| background: var(--accent); | |
| color: var(--bg-primary); | |
| border-color: var(--accent); | |
| } | |
| .btn-primary { | |
| width: 100%; | |
| padding: 14px; | |
| background: var(--accent); | |
| color: var(--bg-primary); | |
| border: none; | |
| border-radius: 8px; | |
| font-size: 14px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: all 0.15s; | |
| font-family: inherit; | |
| } | |
| .btn-primary:hover { | |
| background: var(--accent-hover); | |
| } | |
| .btn-primary:disabled { | |
| opacity: 0.5; | |
| cursor: not-allowed; | |
| } | |
| .btn-secondary { | |
| padding: 12px 24px; | |
| background: transparent; | |
| border: 1px solid var(--border-secondary); | |
| border-radius: 8px; | |
| font-size: 14px; | |
| font-weight: 500; | |
| color: var(--text-secondary); | |
| cursor: pointer; | |
| font-family: inherit; | |
| transition: all 0.15s; | |
| } | |
| .btn-secondary:hover { | |
| border-color: var(--text-secondary); | |
| color: var(--text-primary); | |
| } | |
| .progress-section { | |
| text-align: center; | |
| } | |
| .progress-card { | |
| background: var(--bg-secondary); | |
| border: 1px solid var(--border-primary); | |
| border-radius: 12px; | |
| padding: 48px 32px; | |
| } | |
| .spinner { | |
| width: 40px; | |
| height: 40px; | |
| border: 2px solid var(--border-secondary); | |
| border-top-color: var(--text-primary); | |
| border-radius: 50%; | |
| animation: spin 0.8s linear infinite; | |
| margin: 0 auto 28px; | |
| } | |
| @keyframes spin { | |
| to { transform: rotate(360deg); } | |
| } | |
| .progress-title { | |
| font-size: 20px; | |
| font-weight: 600; | |
| margin-bottom: 8px; | |
| } | |
| .progress-bar-container { | |
| width: 100%; | |
| height: 4px; | |
| background: var(--border-primary); | |
| border-radius: 2px; | |
| margin: 24px 0 16px; | |
| overflow: hidden; | |
| } | |
| .progress-bar { | |
| height: 100%; | |
| background: var(--text-primary); | |
| border-radius: 2px; | |
| transition: width 0.4s ease; | |
| } | |
| .progress-step { | |
| font-family: 'JetBrains Mono', monospace; | |
| color: var(--text-tertiary); | |
| font-size: 13px; | |
| } | |
| .steps { | |
| display: flex; | |
| justify-content: center; | |
| gap: 8px; | |
| margin-top: 24px; | |
| } | |
| .step-dot { | |
| width: 6px; | |
| height: 6px; | |
| border-radius: 50%; | |
| background: var(--border-secondary); | |
| transition: all 0.3s; | |
| } | |
| .step-dot.active { | |
| background: var(--text-primary); | |
| box-shadow: 0 0 8px var(--text-secondary); | |
| } | |
| .step-dot.complete { | |
| background: var(--text-secondary); | |
| } | |
| .result-section { | |
| text-align: center; | |
| } | |
| .verdict-header { | |
| margin-bottom: 32px; | |
| } | |
| .verdict-badge { | |
| display: inline-flex; | |
| align-items: center; | |
| gap: 8px; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 14px; | |
| font-weight: 600; | |
| padding: 10px 20px; | |
| border-radius: 6px; | |
| margin-bottom: 12px; | |
| letter-spacing: 1px; | |
| } | |
| .badge-true { background: var(--verdict-true-bg); color: var(--verdict-true); border: 1px solid var(--verdict-true); } | |
| .badge-false { background: var(--verdict-false-bg); color: var(--verdict-false); border: 1px solid var(--verdict-false); } | |
| .badge-mixed { background: var(--verdict-mixed-bg); color: var(--verdict-mixed); border: 1px solid var(--verdict-mixed); } | |
| .badge-unknown { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-secondary); } | |
| .verdict-meta { | |
| display: flex; | |
| justify-content: center; | |
| gap: 32px; | |
| margin-top: 20px; | |
| } | |
| .meta-item { | |
| text-align: center; | |
| } | |
| .meta-value { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 28px; | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| } | |
| .meta-label { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 11px; | |
| color: var(--text-tertiary); | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| margin-top: 4px; | |
| } | |
| /* Verdict tooltip */ | |
| .verdict-badge { | |
| position: relative; | |
| cursor: help; | |
| } | |
| .verdict-tooltip { | |
| position: absolute; | |
| bottom: calc(100% + 12px); | |
| left: 50%; | |
| transform: translateX(-50%); | |
| background: var(--bg-secondary); | |
| border: 1px solid var(--border-secondary); | |
| border-radius: 8px; | |
| padding: 12px 16px; | |
| width: 280px; | |
| font-size: 13px; | |
| font-family: 'Inter', sans-serif; | |
| font-weight: 400; | |
| letter-spacing: 0; | |
| text-align: left; | |
| color: var(--text-secondary); | |
| line-height: 1.5; | |
| opacity: 0; | |
| visibility: hidden; | |
| transition: opacity 0.2s, visibility 0.2s; | |
| z-index: 100; | |
| box-shadow: 0 4px 12px rgba(0,0,0,0.3); | |
| } | |
| .verdict-tooltip::after { | |
| content: ""; | |
| position: absolute; | |
| top: 100%; | |
| left: 50%; | |
| transform: translateX(-50%); | |
| border: 6px solid transparent; | |
| border-top-color: var(--border-secondary); | |
| } | |
| .verdict-badge:hover .verdict-tooltip { | |
| opacity: 1; | |
| visibility: visible; | |
| } | |
| .tooltip-title { | |
| font-weight: 600; | |
| color: var(--text-primary); | |
| margin-bottom: 6px; | |
| } | |
| .result-card { | |
| background: var(--bg-secondary); | |
| border: 1px solid var(--border-primary); | |
| border-radius: 12px; | |
| padding: 24px; | |
| margin-bottom: 12px; | |
| text-align: left; | |
| } | |
| .result-card h2 { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 11px; | |
| font-weight: 500; | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| color: var(--text-tertiary); | |
| margin-bottom: 16px; | |
| } | |
| .result-card p { | |
| color: var(--text-secondary); | |
| font-size: 14px; | |
| line-height: 1.7; | |
| } | |
| .result-card ul { | |
| padding-left: 0; | |
| list-style: none; | |
| } | |
| .result-card li { | |
| color: var(--text-secondary); | |
| font-size: 14px; | |
| margin-bottom: 10px; | |
| padding-left: 16px; | |
| position: relative; | |
| } | |
| .result-card li::before { | |
| content: "->"; | |
| position: absolute; | |
| left: 0; | |
| color: var(--text-tertiary); | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 12px; | |
| } | |
| .source-item { | |
| padding: 16px; | |
| background: var(--bg-tertiary); | |
| border: 1px solid var(--border-primary); | |
| border-radius: 8px; | |
| margin-bottom: 10px; | |
| } | |
| .source-item a { | |
| color: var(--text-secondary); | |
| text-decoration: none; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 13px; | |
| word-break: break-all; | |
| } | |
| .source-item a:hover { | |
| color: var(--text-primary); | |
| } | |
| .source-title { | |
| font-weight: 500; | |
| color: var(--text-primary); | |
| margin-bottom: 4px; | |
| font-size: 14px; | |
| } | |
| .source-desc { | |
| font-size: 13px; | |
| color: var(--text-tertiary); | |
| margin-top: 8px; | |
| } | |
| .actions { | |
| display: flex; | |
| justify-content: center; | |
| gap: 12px; | |
| margin-top: 32px; | |
| } | |
| .error-msg { | |
| background: var(--verdict-false-bg); | |
| border: 1px solid var(--verdict-false); | |
| color: var(--verdict-false); | |
| padding: 12px 16px; | |
| border-radius: 8px; | |
| margin-top: 16px; | |
| font-size: 14px; | |
| } | |
| .hidden { display: none ; } | |
| @media (max-width: 480px) { | |
| h1 { font-size: 28px; } | |
| .container { padding: 40px 16px; } | |
| header { padding: 12px 16px; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <a href="/" class="logo"> | |
| <span>🔍</span> | |
| agent verf | |
| </a> | |
| <div class="theme-toggle" onclick="toggleTheme()"> | |
| <span id="theme-icon">🌙</span> | |
| <div class="toggle-switch"></div> | |
| <span>☀️</span> | |
| </div> | |
| </header> | |
| <main class="container"> | |
| <!-- Input Section --> | |
| <div id="input-section"> | |
| <div class="hero"> | |
| <h1>Verify content</h1> | |
| <p class="subtitle">AI-powered fact-checking in seconds</p> | |
| </div> | |
| <div class="input-card"> | |
| <div class="input-tabs"> | |
| <button class="tab-btn active" onclick="switchTab('url')">URL</button> | |
| <button class="tab-btn" onclick="switchTab('text')">Text</button> | |
| </div> | |
| <form id="verify-form"> | |
| <div id="url-input"> | |
| <label>Paste a Twitter/X URL</label> | |
| <input type="text" id="url" placeholder="https://x.com/user/status/..."> | |
| </div> | |
| <div id="text-input" class="hidden"> | |
| <label>Paste claim text</label> | |
| <textarea id="text" placeholder="Enter the claim you want to verify..."></textarea> | |
| </div> | |
| <button type="submit" class="btn-primary" id="submit-btn">Verify</button> | |
| </form> | |
| <div id="error-msg" class="error-msg hidden"></div> | |
| </div> | |
| </div> | |
| <!-- Progress Section --> | |
| <div id="progress-section" class="progress-section hidden"> | |
| <div class="progress-card"> | |
| <div class="spinner"></div> | |
| <div class="progress-title">Verifying</div> | |
| <p class="progress-step" id="progress-step">starting...</p> | |
| <div class="progress-bar-container"> | |
| <div class="progress-bar" id="progress-bar" style="width: 10%"></div> | |
| </div> | |
| <div class="steps"> | |
| <div class="step-dot" id="dot-1"></div> | |
| <div class="step-dot" id="dot-2"></div> | |
| <div class="step-dot" id="dot-3"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Result Section --> | |
| <div id="result-section" class="result-section hidden"> | |
| <div class="verdict-header"> | |
| <div class="verdict-badge" id="verdict-badge"> | |
| <span class="verdict-tooltip" id="verdict-tooltip"></span> | |
| </div> | |
| <div class="verdict-meta"> | |
| <div class="meta-item"> | |
| <div class="meta-value" id="confidence-value">--</div> | |
| <div class="meta-label">Confidence</div> | |
| </div> | |
| <div class="meta-item"> | |
| <div class="meta-value" id="sources-value">--</div> | |
| <div class="meta-label">Sources</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="result-card"> | |
| <h2>Summary</h2> | |
| <p id="verdict-summary"></p> | |
| </div> | |
| <div class="result-card" id="findings-card"> | |
| <h2>Key Findings</h2> | |
| <ul id="findings-list"></ul> | |
| </div> | |
| <div class="result-card" id="sources-card"> | |
| <h2>Sources</h2> | |
| <div id="sources-list"></div> | |
| </div> | |
| <div class="actions"> | |
| <button class="btn-secondary" onclick="resetForm()">Verify another</button> | |
| </div> | |
| </div> | |
| </main> | |
| <script> | |
| // Use relative URL - works on any host | |
| const API_BASE = ''; | |
| // Theme | |
| function toggleTheme() { | |
| const html = document.documentElement; | |
| const newTheme = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'; | |
| html.setAttribute('data-theme', newTheme); | |
| localStorage.setItem('theme', newTheme); | |
| } | |
| (function() { | |
| const saved = localStorage.getItem('theme') || 'dark'; | |
| document.documentElement.setAttribute('data-theme', saved); | |
| })(); | |
| // Input tabs | |
| let inputMode = 'url'; | |
| function switchTab(mode) { | |
| inputMode = mode; | |
| document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active')); | |
| document.querySelector(`.tab-btn:nth-child(${mode === 'url' ? 1 : 2})`).classList.add('active'); | |
| document.getElementById('url-input').classList.toggle('hidden', mode !== 'url'); | |
| document.getElementById('text-input').classList.toggle('hidden', mode !== 'text'); | |
| } | |
| // Verdict styling with tooltips | |
| const VERDICT_MAP = { | |
| 'TRUE': { | |
| class: 'badge-true', icon: '✓', label: 'TRUE', | |
| tooltip: 'The claim is accurate and well-supported by multiple reliable sources.' | |
| }, | |
| 'MOSTLY_TRUE': { | |
| class: 'badge-true', icon: '✓', label: 'MOSTLY TRUE', | |
| tooltip: 'The claim is largely accurate but may omit minor details or context. Core facts are verified.' | |
| }, | |
| 'MIXED': { | |
| class: 'badge-mixed', icon: '⚠', label: 'MIXED', | |
| tooltip: 'The claim contains both accurate and inaccurate elements. Some parts are true, others are false or misleading.' | |
| }, | |
| 'MOSTLY_FALSE': { | |
| class: 'badge-false', icon: '✗', label: 'MOSTLY FALSE', | |
| tooltip: 'The claim is largely inaccurate. It may contain a small kernel of truth but misrepresents the facts overall.' | |
| }, | |
| 'FALSE': { | |
| class: 'badge-false', icon: '✗', label: 'FALSE', | |
| tooltip: 'The claim is demonstrably false. No credible evidence supports it.' | |
| }, | |
| 'UNVERIFIABLE': { | |
| class: 'badge-unknown', icon: '?', label: 'UNVERIFIABLE', | |
| tooltip: 'Unable to verify this claim. Insufficient evidence available or the claim is too vague to fact-check.' | |
| }, | |
| }; | |
| const STEP_LABELS = { | |
| 'queued': 'starting...', | |
| 'triage': 'analyzing claims...', | |
| 'evidence': 'gathering evidence...', | |
| 'synthesis': 'generating verdict...', | |
| 'done': 'complete!' | |
| }; | |
| // Form submission | |
| document.getElementById('verify-form').addEventListener('submit', async (e) => { | |
| e.preventDefault(); | |
| hideError(); | |
| const payload = {}; | |
| if (inputMode === 'url') { | |
| const url = document.getElementById('url').value.trim(); | |
| if (!url) return showError('Please enter a URL'); | |
| payload.url = url; | |
| } else { | |
| const text = document.getElementById('text').value.trim(); | |
| if (!text) return showError('Please enter some text'); | |
| payload.text = text; | |
| } | |
| showProgress(); | |
| try { | |
| const response = await fetch(`${API_BASE}/api/v1/verify/quick`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(payload), | |
| }); | |
| if (!response.ok) { | |
| const err = await response.json(); | |
| throw new Error(err.detail || 'Verification failed'); | |
| } | |
| const result = await response.json(); | |
| showResult(result); | |
| } catch (err) { | |
| showError(err.message); | |
| showInput(); | |
| } | |
| }); | |
| function showProgress() { | |
| document.getElementById('input-section').classList.add('hidden'); | |
| document.getElementById('progress-section').classList.remove('hidden'); | |
| document.getElementById('result-section').classList.add('hidden'); | |
| // Animate progress | |
| let progress = 10; | |
| const steps = ['triage', 'evidence', 'synthesis']; | |
| let stepIdx = 0; | |
| const interval = setInterval(() => { | |
| progress = Math.min(progress + Math.random() * 15, 90); | |
| document.getElementById('progress-bar').style.width = `${progress}%`; | |
| if (progress > 30 && stepIdx < 1) stepIdx = 1; | |
| if (progress > 60 && stepIdx < 2) stepIdx = 2; | |
| document.getElementById('progress-step').textContent = STEP_LABELS[steps[stepIdx]]; | |
| for (let i = 0; i < 3; i++) { | |
| const dot = document.getElementById(`dot-${i + 1}`); | |
| dot.classList.remove('active', 'complete'); | |
| if (i < stepIdx) dot.classList.add('complete'); | |
| if (i === stepIdx) dot.classList.add('active'); | |
| } | |
| }, 500); | |
| window._progressInterval = interval; | |
| } | |
| function showResult(data) { | |
| if (window._progressInterval) clearInterval(window._progressInterval); | |
| document.getElementById('progress-section').classList.add('hidden'); | |
| document.getElementById('result-section').classList.remove('hidden'); | |
| const verdict = data.verdict || 'UNVERIFIABLE'; | |
| const style = VERDICT_MAP[verdict] || VERDICT_MAP['UNVERIFIABLE']; | |
| const badge = document.getElementById('verdict-badge'); | |
| badge.className = 'verdict-badge ' + style.class; | |
| badge.innerHTML = `${style.icon} ${style.label}<span class="verdict-tooltip"><span class="tooltip-title">${style.label}</span>${style.tooltip}</span>`; | |
| const confidence = data.confidence ? Math.round(data.confidence * 100) : '--'; | |
| const sourceCount = data.sources ? data.sources.length : 0; | |
| document.getElementById('confidence-value').textContent = `${confidence}%`; | |
| document.getElementById('sources-value').textContent = sourceCount; | |
| document.getElementById('verdict-summary').textContent = data.summary || 'No summary available.'; | |
| // Key findings | |
| const findingsCard = document.getElementById('findings-card'); | |
| const findingsList = document.getElementById('findings-list'); | |
| if (data.key_findings && data.key_findings.length > 0) { | |
| findingsCard.classList.remove('hidden'); | |
| findingsList.innerHTML = data.key_findings.map(f => `<li>${escapeHtml(f)}</li>`).join(''); | |
| } else { | |
| findingsCard.classList.add('hidden'); | |
| } | |
| // Sources | |
| const sourcesCard = document.getElementById('sources-card'); | |
| const sourcesList = document.getElementById('sources-list'); | |
| if (data.sources && data.sources.length > 0) { | |
| sourcesCard.classList.remove('hidden'); | |
| sourcesList.innerHTML = data.sources.map(s => ` | |
| <div class="source-item"> | |
| <div class="source-title">${escapeHtml(s.title || 'Source')}</div> | |
| <a href="${escapeHtml(s.url)}" target="_blank" rel="noopener">${escapeHtml(s.url)}</a> | |
| ${s.description ? `<div class="source-desc">${escapeHtml(s.description.slice(0, 150))}...</div>` : ''} | |
| </div> | |
| `).join(''); | |
| } else { | |
| sourcesCard.classList.add('hidden'); | |
| } | |
| } | |
| function showInput() { | |
| if (window._progressInterval) clearInterval(window._progressInterval); | |
| document.getElementById('input-section').classList.remove('hidden'); | |
| document.getElementById('progress-section').classList.add('hidden'); | |
| document.getElementById('result-section').classList.add('hidden'); | |
| } | |
| function resetForm() { | |
| document.getElementById('url').value = ''; | |
| document.getElementById('text').value = ''; | |
| hideError(); | |
| showInput(); | |
| } | |
| function showError(msg) { | |
| const el = document.getElementById('error-msg'); | |
| el.textContent = msg; | |
| el.classList.remove('hidden'); | |
| } | |
| function hideError() { | |
| document.getElementById('error-msg').classList.add('hidden'); | |
| } | |
| function escapeHtml(text) { | |
| const div = document.createElement('div'); | |
| div.textContent = text; | |
| return div.innerHTML; | |
| } | |
| </script> | |
| </body> | |
| </html> | |