Spaces:
Sleeping
Sleeping
Download server/static/index.html from at0day/GitReviewerPro: direct link, hf CLI and curl.
- Browser
- Download file 23.9 kB
-
https://huggingface.co/spaces/at0day/GitReviewerPro/resolve/main/server/static/index.html
- Command line
-
hf download hf://spaces/at0day/GitReviewerPro/server/static/index.html
-
curl -L -o index.html https://huggingface.co/spaces/at0day/GitReviewerPro/resolve/main/server/static/index.html
23.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Git Reviewer Pro | Advanced AI Commits Evaluation</title> | |
| <!-- Google Fonts --> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --bg-color: #0b0e14; | |
| --card-bg: rgba(23, 27, 34, 0.7); | |
| --sidebar-bg: #10141b; | |
| --accent-color: #00d2ff; | |
| --accent-glow: rgba(0, 210, 255, 0.3); | |
| --success-color: #00ff88; | |
| --warning-color: #ffcc00; | |
| --text-main: #e6edf3; | |
| --text-dim: #7d8590; | |
| --border-color: rgba(48, 54, 61, 0.8); | |
| --glass-border: rgba(255, 255, 255, 0.1); | |
| } | |
| * { | |
| box-sizing: border-box; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| body { | |
| font-family: 'Inter', -apple-system, sans-serif; | |
| background-color: var(--bg-color); | |
| color: var(--text-main); | |
| height: 100vh; | |
| overflow: hidden; | |
| display: flex; | |
| } | |
| /* Sidebar Styling */ | |
| .sidebar { | |
| width: 280px; | |
| background-color: var(--sidebar-bg); | |
| border-right: 1px solid var(--border-color); | |
| display: flex; | |
| flex-direction: column; | |
| padding: 24px; | |
| z-index: 10; | |
| } | |
| .logo { | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| font-weight: 700; | |
| font-size: 1.2rem; | |
| margin-bottom: 40px; | |
| background: linear-gradient(90deg, var(--accent-color), var(--success-color)); | |
| -webkit-background-clip: text; | |
| -webkit-text-fill-color: transparent; | |
| } | |
| .nav-section { | |
| margin-bottom: 32px; | |
| } | |
| .nav-label { | |
| font-size: 0.7rem; | |
| text-transform: uppercase; | |
| letter-spacing: 1px; | |
| color: var(--text-dim); | |
| margin-bottom: 12px; | |
| display: block; | |
| } | |
| .task-card { | |
| background: rgba(255, 255, 255, 0.03); | |
| border: 1px solid var(--border-color); | |
| padding: 12px; | |
| border-radius: 8px; | |
| margin-bottom: 10px; | |
| cursor: pointer; | |
| transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| .task-card:hover { | |
| border-color: var(--accent-color); | |
| background: rgba(0, 210, 255, 0.05); | |
| } | |
| .task-card.active { | |
| border-color: var(--accent-color); | |
| background: rgba(0, 210, 255, 0.1); | |
| box-shadow: 0 0 15px var(--accent-glow); | |
| } | |
| .task-title { | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| margin-bottom: 4px; | |
| } | |
| .task-meta { | |
| font-size: 0.75rem; | |
| color: var(--text-dim); | |
| } | |
| /* Main Content Layout */ | |
| .main-container { | |
| flex: 1; | |
| display: flex; | |
| flex-direction: column; | |
| position: relative; | |
| background: radial-gradient(circle at 50% 10%, #161b22 0%, #0b0e14 100%); | |
| } | |
| header { | |
| height: 70px; | |
| border-bottom: 1px solid var(--border-color); | |
| padding: 0 32px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: space-between; | |
| backdrop-filter: blur(10px); | |
| } | |
| .metrics-bar { | |
| display: flex; | |
| gap: 24px; | |
| } | |
| .metric { | |
| display: flex; | |
| flex-direction: column; | |
| align-items: flex-end; | |
| } | |
| .metric-value { | |
| font-family: 'Fira Code', monospace; | |
| font-size: 1.1rem; | |
| font-weight: 600; | |
| } | |
| .metric-label { | |
| font-size: 0.65rem; | |
| text-transform: uppercase; | |
| color: var(--text-dim); | |
| } | |
| /* Core Workspace */ | |
| .workspace { | |
| flex: 1; | |
| display: grid; | |
| grid-template-columns: 1fr 380px; | |
| gap: 24px; | |
| padding: 24px; | |
| overflow: hidden; | |
| } | |
| .viewer-card { | |
| background: var(--card-bg); | |
| border: 1px solid var(--glass-border); | |
| border-radius: 12px; | |
| backdrop-filter: blur(12px); | |
| display: flex; | |
| flex-direction: column; | |
| overflow: hidden; | |
| } | |
| .card-header { | |
| padding: 16px 24px; | |
| border-bottom: 1px solid var(--border-color); | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| } | |
| .commit-view { | |
| flex: 1; | |
| padding: 32px; | |
| font-family: 'Fira Code', monospace; | |
| font-size: 0.95rem; | |
| line-height: 1.6; | |
| overflow-y: auto; | |
| background: rgba(0, 0, 0, 0.2); | |
| } | |
| .commit-line { | |
| display: block; | |
| margin-bottom: 4px; | |
| } | |
| /* Action Panel */ | |
| .action-panel { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 20px; | |
| } | |
| .form-group { | |
| margin-bottom: 16px; | |
| } | |
| .form-label { | |
| display: block; | |
| font-size: 0.8rem; | |
| color: var(--text-dim); | |
| margin-bottom: 8px; | |
| } | |
| input[type="text"], textarea, select { | |
| width: 100%; | |
| background: rgba(0, 0, 0, 0.3); | |
| border: 1px solid var(--border-color); | |
| color: white; | |
| padding: 12px; | |
| border-radius: 6px; | |
| font-family: inherit; | |
| transition: border-color 0.2s; | |
| } | |
| input:focus { | |
| border-color: var(--accent-color); | |
| outline: none; | |
| } | |
| .slider-container { | |
| margin: 12px 0; | |
| } | |
| .slider { | |
| -webkit-appearance: none; | |
| width: 100%; | |
| height: 4px; | |
| background: var(--border-color); | |
| border-radius: 2px; | |
| outline: none; | |
| } | |
| .slider::-webkit-slider-thumb { | |
| -webkit-appearance: none; | |
| width: 18px; | |
| height: 18px; | |
| background: var(--accent-color); | |
| border-radius: 50%; | |
| cursor: pointer; | |
| box-shadow: 0 0 10px var(--accent-glow); | |
| } | |
| .btn { | |
| padding: 12px 24px; | |
| border-radius: 6px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| border: none; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| gap: 8px; | |
| width: 100%; | |
| } | |
| .btn-primary { | |
| background: linear-gradient(135deg, #00d2ff 0%, #0072ff 100%); | |
| color: white; | |
| box-shadow: 0 4px 15px rgba(0, 114, 255, 0.4); | |
| } | |
| .btn-primary:hover:not(:disabled) { | |
| transform: translateY(-2px); | |
| box-shadow: 0 6px 20px rgba(0, 114, 255, 0.6); | |
| } | |
| .btn-outline { | |
| background: transparent; | |
| border: 1px solid var(--border-color); | |
| color: var(--text-main); | |
| } | |
| .btn-outline:hover:not(:disabled) { | |
| border-color: var(--accent-color); | |
| background: rgba(0, 210, 255, 0.05); | |
| } | |
| .btn:disabled { | |
| opacity: 0.5; | |
| cursor: not-allowed; | |
| } | |
| /* Event Log (Terminal) */ | |
| .terminal { | |
| height: 180px; | |
| background: #000; | |
| border-top: 1px solid var(--border-color); | |
| padding: 12px 20px; | |
| font-family: 'Fira Code', monospace; | |
| font-size: 0.8rem; | |
| overflow-y: auto; | |
| color: #ccc; | |
| } | |
| .log-entry { margin-bottom: 4px; } | |
| .log-time { color: #555; margin-right: 8px; } | |
| .log-info { color: #aaa; } | |
| .log-success { color: var(--success-color); } | |
| .log-error { color: #ff5555; } | |
| .log-reward { color: var(--accent-color); font-weight: bold; } | |
| /* Overlays */ | |
| #loader { | |
| position: absolute; | |
| top: 0; left: 0; width: 100%; height: 100%; | |
| background: rgba(11, 14, 20, 0.8); | |
| backdrop-filter: blur(4px); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| justify-content: center; | |
| z-index: 100; | |
| display: none; | |
| } | |
| .spinner { | |
| width: 40px; height: 40px; | |
| border: 3px solid rgba(0, 210, 255, 0.1); | |
| border-top-color: var(--accent-color); | |
| border-radius: 50%; | |
| animation: spin 1s linear infinite; | |
| } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| </style> | |
| </head> | |
| <body> | |
| <div id="loader"> | |
| <div class="spinner"></div> | |
| <div style="margin-top: 16px; font-size: 0.9rem; color: var(--accent-color);">Processing...</div> | |
| </div> | |
| <!-- Sidebar --> | |
| <aside class="sidebar"> | |
| <div class="logo"> | |
| <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"> | |
| <path d="M12 2L4.5 20.29L5.21 21L12 18L18.79 21L19.5 20.29L12 2Z"></path> | |
| </svg> | |
| GIT REVIEWER PRO | |
| </div> | |
| <nav class="nav-section"> | |
| <span class="nav-label">Tasks</span> | |
| <div class="task-card active" id="task-easy" onclick="selectTask('easy')"> | |
| <div class="task-title">Easy Mode</div> | |
| <div class="task-meta">1 Commit • Linear Flow</div> | |
| </div> | |
| <div class="task-card" id="task-medium" onclick="selectTask('medium')"> | |
| <div class="task-title">Medium Mode</div> | |
| <div class="task-meta">3 Commits • Refactor Scope</div> | |
| </div> | |
| <div class="task-card" id="task-hard" onclick="selectTask('hard')"> | |
| <div class="task-title">Hard Mode</div> | |
| <div class="task-meta">5 Commits • Breaking Changes</div> | |
| </div> | |
| </nav> | |
| <nav class="nav-section"> | |
| <span class="nav-label">Global Controls</span> | |
| <button class="btn btn-outline" style="margin-bottom: 12px;" onclick="resetEnv()"> | |
| ↺ Full Session Reset | |
| </button> | |
| <button class="btn btn-outline" onclick="simulateAgent()"> | |
| ⚡ Auto-Simulate Action | |
| </button> | |
| </nav> | |
| <div style="margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border-color);"> | |
| <div class="metric" style="align-items: flex-start;"> | |
| <span class="metric-label">Session ID</span> | |
| <span class="metric-value" id="disp-session" style="font-size: 0.7rem; color: var(--text-dim);">Scanning...</span> | |
| </div> | |
| </div> | |
| </aside> | |
| <!-- Main Workspace --> | |
| <main class="main-container"> | |
| <header> | |
| <div id="active-task-label" style="font-weight: 600; color: var(--accent-color);">EASY MODE ACTIVE</div> | |
| <div class="metrics-bar"> | |
| <div class="metric"> | |
| <span class="metric-label">Latest Action Reward</span> | |
| <span class="metric-value" id="m-last-reward">0.00</span> | |
| </div> | |
| </div> | |
| </header> | |
| <div class="workspace"> | |
| <!-- Left: Commit Viewer --> | |
| <div class="viewer-card"> | |
| <div class="card-header"> | |
| <div style="display: flex; align-items: center; gap: 8px;"> | |
| <span style="display: block; width: 8px; height: 8px; border-radius: 50%; background: var(--success-color);"></span> | |
| <span style="font-weight: 600; font-size: 0.9rem;">Commit Diff Viewer</span> | |
| </div> | |
| <div id="commit-counter" style="color: var(--text-dim); font-size: 0.8rem;">1 / 1</div> | |
| </div> | |
| <div class="commit-view" id="commit-container"> | |
| <!-- Typing animation placeholder --> | |
| </div> | |
| </div> | |
| <!-- Right: Action Form --> | |
| <div class="action-panel"> | |
| <div class="viewer-card" style="padding: 24px; background: rgba(255,255,255,0.02);"> | |
| <div class="nav-label" style="margin-bottom: 24px; font-weight: 700; color: white;">Review Submission</div> | |
| <div class="form-group"> | |
| <label class="form-label">Quality Score: <span id="disp-score" style="color: var(--accent-color); font-weight: bold;">0.50</span></label> | |
| <div class="slider-container"> | |
| <input type="range" min="0" max="1" step="0.01" value="0.5" class="slider" id="input-score" oninput="document.getElementById('disp-score').innerText = parseFloat(this.value).toFixed(2)"> | |
| </div> | |
| </div> | |
| <div class="form-group"> | |
| <label style="display: flex; align-items: center; gap: 10px; cursor: pointer;"> | |
| <input type="checkbox" id="input-type-valid" checked style="width: 18px; height: 18px;"> | |
| <span class="form-label" style="margin-bottom: 0;">Conventional Type Valid?</span> | |
| </label> | |
| </div> | |
| <div class="form-group"> | |
| <label class="form-label">Identified Issues (Comma separated)</label> | |
| <input type="text" id="input-issues" placeholder="Missing type, No footer..."> | |
| </div> | |
| <div class="form-group"> | |
| <label class="form-label">Proposed Refactored Message</label> | |
| <textarea id="input-suggestion" rows="4" placeholder="feat(scope): imperative summary"></textarea> | |
| </div> | |
| <button class="btn btn-primary" id="btn-submit" onclick="submitReview()"> | |
| <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> | |
| <polyline points="20 6 9 17 4 12"></polyline> | |
| </svg> | |
| Submit Review & Grade | |
| </button> | |
| </div> | |
| <div style="background: rgba(0,210,255,0.1); border: 1px dashed var(--accent-color); border-radius: 8px; padding: 16px;"> | |
| <div style="font-size: 0.75rem; color: var(--accent-color); font-weight: 600; margin-bottom: 4px;">PRO TIP</div> | |
| <div style="font-size: 0.75rem; line-height: 1.4; color: var(--text-dim);"> | |
| The grader looks for <b>conventional commit patterns</b> and <b>imperative mood</b>. Match the ground truth precisely for a 1.00 reward. | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Terminal Logs --> | |
| <div class="terminal" id="terminal"> | |
| <div class="log-entry"><span class="log-time">[12:00:00]</span> <span class="log-info">Kernel initialized. Awaiting user action.</span></div> | |
| </div> | |
| </main> | |
| <script> | |
| let currentTask = 'easy'; | |
| let sessionId = localStorage.getItem('git_reviewer_session') || null; | |
| let isComplete = false; | |
| async function init() { | |
| log("System Boot: Ready", "success"); | |
| await resetEnv(); | |
| } | |
| function log(msg, type = "info") { | |
| const term = document.getElementById('terminal'); | |
| const time = new Date().toLocaleTimeString('en-GB'); | |
| const div = document.createElement('div'); | |
| div.className = 'log-entry'; | |
| let typeColor = 'log-info'; | |
| if (type === 'success') typeColor = 'log-success'; | |
| if (type === 'error') typeColor = 'log-error'; | |
| if (type === 'reward') typeColor = 'log-reward'; | |
| div.innerHTML = `<span class="log-time">[${time}]</span> <span class="${typeColor}">${msg}</span>`; | |
| term.appendChild(div); | |
| term.scrollTop = term.scrollHeight; | |
| } | |
| function setLoading(val) { | |
| document.getElementById('loader').style.display = val ? 'flex' : 'none'; | |
| } | |
| function selectTask(name) { | |
| if (name === currentTask) return; | |
| document.querySelectorAll('.task-card').forEach(c => c.classList.remove('active')); | |
| document.getElementById(`task-${name}`).classList.add('active'); | |
| currentTask = name; | |
| document.getElementById('active-task-label').innerText = name.toUpperCase() + ' MODE ACTIVE'; | |
| resetEnv(); | |
| } | |
| async function resetEnv() { | |
| setLoading(true); | |
| log(`Resetting environment for task: ${currentTask}...`); | |
| try { | |
| const response = await fetch('/reset', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ task: currentTask }) | |
| }); | |
| if (!response.ok) throw new Error("Server error " + response.status); | |
| const data = await response.json(); | |
| const obs = data.observation || data; | |
| // Track session meticulously | |
| sessionId = data.session_id || obs.session_id || (data.metadata ? data.metadata.session_id : null); | |
| if (sessionId) { | |
| localStorage.setItem('git_reviewer_session', sessionId); | |
| document.getElementById('disp-session').innerText = sessionId.substring(0, 16) + '...'; | |
| } | |
| log(`Session synchronized: ${sessionId}`, "success"); | |
| isComplete = false; | |
| updateUI(obs, 0.0); | |
| await fetchState(); | |
| } catch (err) { | |
| log(`Reset Failed: ${err.message}`, "error"); | |
| } finally { | |
| setLoading(false); | |
| } | |
| } | |
| async function submitReview() { | |
| if (isComplete) return; | |
| const action = { | |
| score: parseFloat(document.getElementById('input-score').value), | |
| type_valid: document.getElementById('input-type-valid').checked, | |
| summary_length: parseInt(document.getElementById('commit-container').innerText.split('\n')[0].length), | |
| issues: document.getElementById('input-issues').value.split(',').map(i => i.trim()).filter(i => i), | |
| suggestion: document.getElementById('input-suggestion').value, | |
| session_id: sessionId | |
| }; | |
| log("Submitting review to evaluator..."); | |
| setLoading(true); | |
| try { | |
| const response = await fetch('/step', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| 'X-Session-Id': sessionId | |
| }, | |
| body: JSON.stringify({ action, session_id: sessionId }) | |
| }); | |
| if (!response.ok) throw new Error("Step Failed: " + response.status); | |
| const data = await response.json(); | |
| const obs = data.observation || data; | |
| const reward = data.reward !== undefined ? data.reward : (obs.reward || (data.metadata ? data.metadata.reward : 0)); | |
| log(`Evaluator Response: Reward ${parseFloat(reward).toFixed(2)}`, "reward"); | |
| // Sync stats from metadata if provided | |
| const meta = data.metadata || obs.metadata || {}; | |
| updateUI(obs, reward); | |
| await fetchState(); | |
| } catch (err) { | |
| log(`Interaction Error: ${err.message}`, "error"); | |
| } finally { | |
| setLoading(false); | |
| } | |
| } | |
| async function fetchState() { | |
| if (!sessionId) return; | |
| try { | |
| const url = `/state?session_id=${sessionId}`; | |
| const response = await fetch(url, { headers: { 'X-Session-Id': sessionId } }); | |
| if (response.ok) { | |
| const data = await response.json(); | |
| updateStats(data); | |
| } | |
| } catch (e) {} | |
| } | |
| function updateUI(obs, reward) { | |
| const container = document.getElementById('commit-container'); | |
| const counter = document.getElementById('commit-counter'); | |
| const submitBtn = document.getElementById('btn-submit'); | |
| if (obs.done || obs.commit_message === "DONE") { | |
| isComplete = true; | |
| container.innerHTML = ` | |
| <div style="color: var(--success-color); font-size: 1.2rem; margin-bottom: 20px;">✓ EPISODE COMPLETE</div> | |
| <div style="color: var(--text-dim);">Task evaluation finished. Click 'Full Session Reset' to start again or try a different mode.</div> | |
| `; | |
| counter.innerText = "COMPLETE"; | |
| submitBtn.disabled = true; | |
| log("Episode concluded successfully.", "success"); | |
| } else { | |
| container.innerText = obs.commit_message; | |
| counter.innerText = `${obs.commit_idx + 1} / ${obs.total_commits}`; | |
| submitBtn.disabled = false; | |
| // Prefill for user | |
| document.getElementById('input-suggestion').value = obs.commit_message; | |
| document.getElementById('input-issues').value = ""; | |
| } | |
| document.getElementById('m-last-reward').innerText = parseFloat(reward).toFixed(2); | |
| } | |
| function updateStats(data) { | |
| const state = data.state || data; | |
| const epiId = state.episode_id || state.session_id || sessionId || 'None'; | |
| if (epiId && epiId !== 'None') { | |
| document.getElementById('disp-session').innerText = String(epiId).substring(0, 16) + '...'; | |
| } | |
| } | |
| function simulateAgent() { | |
| log("AI Agent Simulation started..."); | |
| document.getElementById('input-score').value = 0.85; | |
| document.getElementById('disp-score').innerText = "0.85"; | |
| document.getElementById('input-type-valid').checked = true; | |
| document.getElementById('input-issues').value = "Minor: Summary slightly long"; | |
| setTimeout(submitReview, 800); | |
| } | |
| window.onload = init; | |
| </script> | |
| </body> | |
| </html> | |