Spaces:
Paused
Paused
Download frontend/index.html from Simzy/launch-desk: direct link, hf CLI and curl.
- Browser
- Download file 15.3 kB
-
https://huggingface.co/spaces/Simzy/launch-desk/resolve/main/frontend/index.html
- Command line
-
hf download hf://spaces/Simzy/launch-desk/frontend/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Simzy/launch-desk/resolve/main/frontend/index.html
15.3 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Launch Desk β AI Launch Planning</title> | |
| <style> | |
| :root { | |
| --bg: #0d1117; | |
| --card: #161b22; | |
| --border: #30363d; | |
| --accent: #58a6ff; | |
| --accent-dim: #388bfd1a; | |
| --text: #c9d1d9; | |
| --text-dim: #8b949e; | |
| --green: #3fb950; | |
| --yellow: #d29922; | |
| --red: #f85149; | |
| --radius: 8px; | |
| } | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| background: var(--bg); | |
| color: var(--text); | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; | |
| line-height: 1.6; | |
| min-height: 100vh; | |
| } | |
| .container { | |
| max-width: 960px; | |
| margin: 0 auto; | |
| padding: 32px 24px 80px; | |
| } | |
| /* Header */ | |
| header { | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| margin-bottom: 32px; | |
| } | |
| header h1 { | |
| font-size: 1.6rem; | |
| font-weight: 600; | |
| color: var(--accent); | |
| } | |
| header .logo { | |
| font-size: 1.8rem; | |
| } | |
| header .subtitle { | |
| color: var(--text-dim); | |
| font-size: 0.9rem; | |
| margin-left: auto; | |
| } | |
| /* Form */ | |
| .form-card { | |
| background: var(--card); | |
| border: 1px solid var(--border); | |
| border-radius: var(--radius); | |
| padding: 24px; | |
| margin-bottom: 24px; | |
| } | |
| .form-grid { | |
| display: grid; | |
| grid-template-columns: 1fr 1fr; | |
| gap: 16px; | |
| } | |
| .form-group { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 6px; | |
| } | |
| .form-group.full { grid-column: 1 / -1; } | |
| label { | |
| font-size: 0.85rem; | |
| color: var(--text-dim); | |
| font-weight: 500; | |
| } | |
| textarea, input { | |
| background: var(--bg); | |
| border: 1px solid var(--border); | |
| border-radius: 6px; | |
| color: var(--text); | |
| padding: 10px 12px; | |
| font-size: 0.9rem; | |
| font-family: inherit; | |
| resize: vertical; | |
| transition: border-color 0.2s; | |
| } | |
| textarea:focus, input:focus { | |
| outline: none; | |
| border-color: var(--accent); | |
| } | |
| textarea { min-height: 80px; } | |
| textarea#brief { min-height: 100px; } | |
| /* Button */ | |
| .btn { | |
| background: var(--accent); | |
| color: #fff; | |
| border: none; | |
| border-radius: 6px; | |
| padding: 10px 24px; | |
| font-size: 0.95rem; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: opacity 0.2s, background 0.2s; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| margin-top: 20px; | |
| } | |
| .btn:hover { opacity: 0.9; } | |
| .btn:disabled { | |
| background: var(--border); | |
| color: var(--text-dim); | |
| cursor: not-allowed; | |
| } | |
| .btn .spinner { | |
| width: 16px; height: 16px; | |
| border: 2px solid rgba(255,255,255,0.3); | |
| border-top-color: #fff; | |
| border-radius: 50%; | |
| animation: spin 0.6s linear infinite; | |
| display: none; | |
| } | |
| .btn.loading .spinner { display: inline-block; } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| /* Results area */ | |
| .results { | |
| margin-top: 24px; | |
| } | |
| .empty-state { | |
| text-align: center; | |
| padding: 48px 24px; | |
| color: var(--text-dim); | |
| } | |
| .empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; } | |
| /* Tool cards */ | |
| .tool-cards { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 8px; | |
| margin-bottom: 20px; | |
| } | |
| .tool-card { | |
| background: var(--card); | |
| border: 1px solid var(--border); | |
| border-radius: 6px; | |
| padding: 12px 16px; | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| font-size: 0.85rem; | |
| } | |
| .tool-card .status-icon { | |
| width: 18px; height: 18px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| flex-shrink: 0; | |
| } | |
| .tool-card .status-icon.spinner { | |
| border: 2px solid var(--border); | |
| border-top-color: var(--accent); | |
| border-radius: 50%; | |
| animation: spin 0.6s linear infinite; | |
| } | |
| .tool-card .status-icon.done { | |
| color: var(--green); | |
| font-size: 1.1rem; | |
| } | |
| .tool-card .tool-name { | |
| color: var(--accent); | |
| font-weight: 600; | |
| } | |
| .tool-card .tool-args { | |
| color: var(--text-dim); | |
| font-size: 0.8rem; | |
| font-family: 'SF Mono', monospace; | |
| max-width: 400px; | |
| overflow: hidden; | |
| text-overflow: ellipsis; | |
| white-space: nowrap; | |
| } | |
| .tool-card .tool-result { | |
| color: var(--green); | |
| font-size: 0.8rem; | |
| margin-left: auto; | |
| } | |
| /* Plan output */ | |
| .plan-output-card { | |
| background: var(--card); | |
| border: 1px solid var(--border); | |
| border-radius: var(--radius); | |
| overflow: hidden; | |
| } | |
| .plan-output-card .header { | |
| background: var(--bg); | |
| padding: 12px 16px; | |
| border-bottom: 1px solid var(--border); | |
| font-weight: 600; | |
| font-size: 0.9rem; | |
| color: var(--accent); | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .plan-output-card .header .cursor { | |
| display: inline-block; | |
| width: 8px; height: 16px; | |
| background: var(--accent); | |
| animation: blink 1s infinite; | |
| border-radius: 1px; | |
| } | |
| @keyframes blink { 50% { opacity: 0; } } | |
| .plan-output-card .body { | |
| padding: 16px 20px; | |
| white-space: pre-wrap; | |
| word-wrap: break-word; | |
| font-size: 0.9rem; | |
| line-height: 1.7; | |
| max-height: 600px; | |
| overflow-y: auto; | |
| } | |
| /* Error state */ | |
| .error-state { | |
| background: #f8514911; | |
| border: 1px solid var(--red); | |
| border-radius: var(--radius); | |
| padding: 16px 20px; | |
| color: var(--red); | |
| font-size: 0.9rem; | |
| } | |
| .error-state .icon { margin-right: 8px; } | |
| /* Markdown-ish section styling */ | |
| .plan-output-card .body h1, | |
| .plan-output-card .body h2, | |
| .plan-output-card .body h3 { | |
| color: var(--accent); | |
| margin-top: 18px; | |
| margin-bottom: 8px; | |
| } | |
| .plan-output-card .body h2 { font-size: 1.05rem; } | |
| .plan-output-card .body h3 { font-size: 0.95rem; } | |
| .plan-output-card .body ul, | |
| .plan-output-card .body ol { | |
| margin-left: 20px; | |
| margin-bottom: 10px; | |
| } | |
| .plan-output-card .body li { margin-bottom: 4px; } | |
| .plan-output-card .body code { | |
| background: var(--bg); | |
| padding: 2px 6px; | |
| border-radius: 4px; | |
| font-family: 'SF Mono', monospace; | |
| font-size: 0.85rem; | |
| } | |
| .plan-output-card .body strong { color: #fff; } | |
| /* Scrollbar */ | |
| ::-webkit-scrollbar { width: 8px; } | |
| ::-webkit-scrollbar-track { background: var(--bg); } | |
| ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; } | |
| ::-webkit-scrollbar-thumb:hover { background: #484f58; } | |
| @media (max-width: 640px) { | |
| .form-grid { grid-template-columns: 1fr; } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <header> | |
| <span class="logo">π</span> | |
| <h1>Launch Desk</h1> | |
| <span class="subtitle">AI-powered launch planning</span> | |
| </header> | |
| <!-- Form --> | |
| <div class="form-card"> | |
| <div class="form-grid"> | |
| <div class="form-group full"> | |
| <label for="brief">Product Brief</label> | |
| <textarea id="brief" placeholder="Describe the product you're launching..."></textarea> | |
| </div> | |
| <div class="form-group"> | |
| <label for="audience">Target Audience</label> | |
| <input type="text" id="audience" placeholder="e.g., enterprise DevOps teams"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="launch_date">Launch Date</label> | |
| <input type="date" id="launch_date"> | |
| </div> | |
| <div class="form-group full"> | |
| <label for="constraints">Constraints</label> | |
| <textarea id="constraints" placeholder="Budget limits, regulatory requirements, hard deadlines..."></textarea> | |
| </div> | |
| <div class="form-group full"> | |
| <label for="assets">Available Assets</label> | |
| <textarea id="assets" placeholder="Existing content, design files, team capacity, budget..."></textarea> | |
| </div> | |
| </div> | |
| <button class="btn" id="generateBtn" onclick="generatePlan()"> | |
| <span class="spinner"></span> | |
| <span class="btn-text">Generate Plan</span> | |
| </button> | |
| </div> | |
| <!-- Results --> | |
| <div class="results" id="results"> | |
| <div class="empty-state"> | |
| <div class="icon">π</div> | |
| <p>Fill in the form above and click <strong>Generate Plan</strong> to create your launch plan.</p> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // --------------------------------------------------------------------------- | |
| // State | |
| // --------------------------------------------------------------------------- | |
| let isGenerating = false; | |
| // --------------------------------------------------------------------------- | |
| // Helpers | |
| // --------------------------------------------------------------------------- | |
| function $(id) { return document.getElementById(id); } | |
| function setButtonLoading(loading) { | |
| const btn = $('generateBtn'); | |
| btn.classList.toggle('loading', loading); | |
| btn.disabled = loading; | |
| btn.querySelector('.btn-text').textContent = loading ? 'Generating...' : 'Generate Plan'; | |
| } | |
| function escapeHtml(text) { | |
| const div = document.createElement('div'); | |
| div.textContent = text; | |
| return div.innerHTML; | |
| } | |
| // Minimal markdown β HTML renderer (headings, lists, bold, code, paragraphs) | |
| function renderMarkdown(md) { | |
| let html = escapeHtml(md); | |
| // Headings | |
| html = html.replace(/^### (.+)$/gm, '<h3>$1</h3>'); | |
| html = html.replace(/^## (.+)$/gm, '<h2>$1</h2>'); | |
| html = html.replace(/^# (.+)$/gm, '<h2>$1</h2>'); | |
| // Bold | |
| html = html.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>'); | |
| // Inline code | |
| html = html.replace(/`([^`]+)`/g, '<code>$1</code>'); | |
| // Unordered list items | |
| html = html.replace(/^\s*[-β’] (.+)$/gm, '<li>$1</li>'); | |
| // Ordered list items | |
| html = html.replace(/^\s*\d+\.\s+(.+)$/gm, '<li>$1</li>'); | |
| // Wrap consecutive <li> in <ul> | |
| html = html.replace(/(<li>.*?<\/li>\n?)+/gs, function(m) { | |
| return '<ul>' + m + '</ul>'; | |
| }); | |
| // Paragraphs (double newline) | |
| html = html.replace(/\n\n/g, '</p><p>'); | |
| html = '<p>' + html + '</p>'; | |
| // Clean up empty <p> tags around block elements | |
| html = html.replace(/<p>\s*(<h[23]>)/g, '$1'); | |
| html = html.replace(/(<\/h[23]>)\s*<\/p>/g, '$1'); | |
| html = html.replace(/<p>\s*(<ul>)/g, '$1'); | |
| html = html.replace(/(<\/ul>)\s*<\/p>/g, '$1'); | |
| return html; | |
| } | |
| // --------------------------------------------------------------------------- | |
| // SSE streaming | |
| // --------------------------------------------------------------------------- | |
| async function generatePlan() { | |
| if (isGenerating) return; | |
| isGenerating = true; | |
| setButtonLoading(true); | |
| const payload = { | |
| brief: $('brief').value.trim(), | |
| audience: $('audience').value.trim(), | |
| launch_date: $('launch_date').value, | |
| constraints: $('constraints').value.trim(), | |
| assets: $('assets').value.trim(), | |
| }; | |
| // Build results DOM | |
| const results = $('results'); | |
| results.innerHTML = ''; | |
| // Tool cards container | |
| const toolCardsDiv = document.createElement('div'); | |
| toolCardsDiv.className = 'tool-cards'; | |
| results.appendChild(toolCardsDiv); | |
| // Plan output card | |
| const planCard = document.createElement('div'); | |
| planCard.className = 'plan-output-card'; | |
| planCard.innerHTML = ` | |
| <div class="header"> | |
| <span>Plan Output</span> | |
| <span class="cursor"></span> | |
| </div> | |
| <div class="body" id="planBody"></div> | |
| `; | |
| planCard.style.display = 'none'; | |
| results.appendChild(planCard); | |
| const planBody = planCard.querySelector('.body'); | |
| let fullText = ''; | |
| const toolCardMap = {}; // name -> card element (for updating spinner β checkmark) | |
| try { | |
| const resp = await fetch('/api/agent/stream', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(payload), | |
| }); | |
| if (!resp.ok) { | |
| throw new Error(`HTTP ${resp.status}: ${resp.statusText}`); | |
| } | |
| const reader = resp.body.getReader(); | |
| const decoder = new TextDecoder(); | |
| let buffer = ''; | |
| while (true) { | |
| const { done, value } = await reader.read(); | |
| if (done) break; | |
| buffer += decoder.decode(value, { stream: true }); | |
| // Process complete SSE events (separated by \n\n) | |
| let idx; | |
| while ((idx = buffer.indexOf('\n\n')) !== -1) { | |
| const rawEvent = buffer.slice(0, idx); | |
| buffer = buffer.slice(idx + 2); | |
| // Parse "data: {...}" line | |
| const line = rawEvent.trim(); | |
| if (!line.startsWith('data:')) continue; | |
| const jsonStr = line.slice(5).trim(); | |
| if (!jsonStr) continue; | |
| let event; | |
| try { event = JSON.parse(jsonStr); } | |
| catch (e) { continue; } | |
| switch (event.type) { | |
| case 'tool_start': { | |
| const card = document.createElement('div'); | |
| card.className = 'tool-card'; | |
| const argsStr = event.args ? JSON.stringify(event.args).slice(0, 120) : ''; | |
| card.innerHTML = ` | |
| <span class="status-icon spinner"></span> | |
| <span class="tool-name">${escapeHtml(event.name)}</span> | |
| <span class="tool-args">${escapeHtml(argsStr)}</span> | |
| `; | |
| toolCardsDiv.appendChild(card); | |
| toolCardMap[event.name] = card; | |
| break; | |
| } | |
| case 'tool_end': { | |
| const card = toolCardMap[event.name]; | |
| if (card) { | |
| const icon = card.querySelector('.status-icon'); | |
| icon.className = 'status-icon done'; | |
| icon.textContent = 'β'; | |
| // Add a result summary | |
| const resultStr = event.result ? JSON.stringify(event.result).slice(0, 80) : ''; | |
| const resultSpan = document.createElement('span'); | |
| resultSpan.className = 'tool-result'; | |
| resultSpan.textContent = resultStr ? 'β result' : 'done'; | |
| card.appendChild(resultSpan); | |
| } | |
| break; | |
| } | |
| case 'text_delta': { | |
| planCard.style.display = ''; | |
| fullText += event.text; | |
| planBody.innerHTML = renderMarkdown(fullText); | |
| // Auto-scroll | |
| planBody.scrollTop = planBody.scrollHeight; | |
| break; | |
| } | |
| case 'done': { | |
| if (event.output) { | |
| fullText = event.output; | |
| planBody.innerHTML = renderMarkdown(fullText); | |
| } | |
| // Remove blinking cursor | |
| const cursor = planCard.querySelector('.cursor'); | |
| if (cursor) cursor.remove(); | |
| break; | |
| } | |
| case 'error': { | |
| const errDiv = document.createElement('div'); | |
| errDiv.className = 'error-state'; | |
| errDiv.innerHTML = `<span class="icon">β </span>${escapeHtml(event.message || 'Unknown error')}`; | |
| results.appendChild(errDiv); | |
| break; | |
| } | |
| } | |
| } | |
| } | |
| // If we got no output at all, show empty state | |
| if (!fullText && toolCardsDiv.children.length === 0) { | |
| results.innerHTML = ` | |
| <div class="empty-state"> | |
| <div class="icon">π</div> | |
| <p>No output received. Check your API key and try again.</p> | |
| </div> | |
| `; | |
| } | |
| } catch (err) { | |
| results.innerHTML = ` | |
| <div class="error-state"> | |
| <span class="icon">β </span> | |
| ${escapeHtml(err.message || 'Failed to connect to the server.')} | |
| </div> | |
| `; | |
| } finally { | |
| isGenerating = false; | |
| setButtonLoading(false); | |
| } | |
| } | |
| // Set default date to 30 days from now | |
| (function() { | |
| const d = new Date(); | |
| d.setDate(d.getDate() + 30); | |
| $('launch_date').value = d.toISOString().split('T')[0]; | |
| })(); | |
| </script> | |
| </body> | |
| </html> | |