Robot / frontend /index.html
C2-151's picture
Done
a20b02d
Raw History Blame Contribute Delete
15.9 kB
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLM-Panda Web-Embedded PyBullet Simulation</title>
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LLM-Panda Web-Embedded PyBullet Simulation</title>
<!-- Google Fonts - Outfit Font Only -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- Three.js libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/loaders/MTLLoader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/loaders/OBJLoader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/loaders/GLTFLoader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/TransformControls.js"></script>
<!-- Main Style -->
<link rel="stylesheet" href="/static/index.css?v=11">
<body>
<!-- Real-Time PyBullet Streaming Viewport -->
<div id="viewport-container">
<canvas id="pybullet-viewport"></canvas>
</div>
<!-- Status & Logs Sidebar -->
<div class="sidebar glass">
<div class="sidebar-header">
<div class="brand">
<!-- Bot SVG Icon -->
<svg class="brand-icon" viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="11" width="18" height="10" rx="2"></rect>
<circle cx="12" cy="5" r="2"></circle>
<path d="M12 7v4M8 8h8M2 14h1M21 14h1"></path>
</svg>
<h2>LLM-Panda</h2>
</div>
<span class="badge offline" id="connection-badge">Disconnected</span>
</div>
<!-- Sidebar Navigation Tabs -->
<div class="sidebar-tabs">
<button class="tab-btn active" data-tab="pipeline" title="Pipeline">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="8" y1="6" x2="21" y2="6"></line>
<line x1="8" y1="12" x2="21" y2="12"></line>
<line x1="8" y1="18" x2="21" y2="18"></line>
<line x1="3" y1="6" x2="3.01" y2="6"></line>
<line x1="3" y1="12" x2="3.01" y2="12"></line>
<line x1="3" y1="18" x2="3.01" y2="18"></line>
</svg>
</button>
<button class="tab-btn" data-tab="objects" title="Vật thể">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
<polyline points="3.27 6.96 12 12.01 20.73 6.96"></polyline>
<line x1="12" y1="22.08" x2="12" y2="12"></line>
</svg>
</button>
<button class="tab-btn" data-tab="history" title="Lịch sử">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
</button>
<button class="tab-btn" data-tab="analytics" title="Báo cáo">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="18" y1="20" x2="18" y2="10"></line>
<line x1="12" y1="20" x2="12" y2="4"></line>
<line x1="6" y1="20" x2="6" y2="14"></line>
</svg>
</button>
<button class="tab-btn" data-tab="system" title="Hệ thống">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="4" y1="21" x2="4" y2="14"></line>
<line x1="4" y1="10" x2="4" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12" y2="3"></line>
<line x1="20" y1="21" x2="20" y2="16"></line>
<line x1="20" y1="12" x2="20" y2="3"></line>
<line x1="1" y1="14" x2="7" y2="14"></line>
<line x1="9" y1="8" x2="15" y2="8"></line>
<line x1="17" y1="16" x2="23" y2="16"></line>
</svg>
</button>
</div>
<!-- 1. OPERATIONS TAB PANEL -->
<div class="tab-panel active" id="panel-pipeline">
<div class="sidebar-section">
<h3>Pipeline Status</h3>
<div class="status-steps">
<div class="status-step" id="step-llm">
<span class="dot"></span>
<span class="step-label">1. Planning</span>
</div>
<div class="status-step" id="step-val">
<span class="dot"></span>
<span class="step-label">2. Validation</span>
</div>
<div class="status-step" id="step-exec">
<span class="dot"></span>
<span class="step-label">3. Robot Execution</span>
</div>
</div>
</div>
<div class="sidebar-section">
<h3>Task Plan</h3>
<div id="plan-list" class="plan-list">
<p class="placeholder-text">Chưa có kế hoạch...</p>
</div>
</div>
<div class="sidebar-section flex-grow">
<h3>Execution Log</h3>
<div id="log-console" class="log-console">
<p class="placeholder-text">Đang đợi yêu cầu...</p>
</div>
</div>
</div>
<!-- 3. OBJECTS TAB PANEL -->
<div class="tab-panel" id="panel-objects">
<div class="sidebar-section">
<h3>Thư viện vật thể hoạt động</h3>
<div class="table-container">
<table class="objects-table">
<thead>
<tr>
<th>Hình ảnh</th>
<th>Vật thể</th>
</tr>
</thead>
<tbody id="objects-table-body">
<!-- Populated dynamically via JS -->
</tbody>
</table>
</div>
</div>
</div>
<!-- 4. HISTORY TAB PANEL -->
<div class="tab-panel" id="panel-history">
<div class="sidebar-section flex-grow">
<h3>Nhật ký hoạt động hệ thống</h3>
<div id="history-list" class="history-list">
<!-- Populated dynamically via JS -->
</div>
</div>
</div>
<!-- 5. ANALYTICS TAB PANEL -->
<div class="tab-panel" id="panel-analytics">
<div class="sidebar-section">
<h3>Chỉ số hiệu suất (KPIs)</h3>
<div class="kpi-grid">
<div class="kpi-card">
<span class="kpi-value" id="kpi-success-rate">—</span>
<span class="kpi-label">Thành công</span>
</div>
<div class="kpi-card">
<span class="kpi-value" id="kpi-avg-llm-time">—</span>
<span class="kpi-label">Thời gian suy nghĩ TB</span>
</div>
<div class="kpi-card">
<span class="kpi-value" id="kpi-total-runs">0</span>
<span class="kpi-label">Tổng số lệnh</span>
</div>
</div>
</div>
<div class="sidebar-section">
<h3>Phân bố nguyên nhân lỗi vận hành</h3>
<div class="analytics-chart">
<div class="chart-bar-group">
<div class="chart-label-row">
<span class="chart-label">Ngoài tầm với robot (IK)</span>
<span class="chart-value" id="chart-ik-val">0%</span>
</div>
<div class="chart-track">
<div class="chart-bar" id="chart-ik-bar" style="width: 0%; background: #3b82f6;"></div>
</div>
</div>
<div class="chart-bar-group">
<div class="chart-label-row">
<span class="chart-label">Vật bị trượt khỏi tay kẹp</span>
<span class="chart-value" id="chart-slip-val">0%</span>
</div>
<div class="chart-track">
<div class="chart-bar" id="chart-slip-bar" style="width: 0%; background: #ef4444;"></div>
</div>
</div>
<div class="chart-bar-group">
<div class="chart-label-row">
<span class="chart-label">LLM lập kế hoạch sai</span>
<span class="chart-value" id="chart-llm-val">0%</span>
</div>
<div class="chart-track">
<div class="chart-bar" id="chart-llm-bar" style="width: 0%; background: #f59e0b;"></div>
</div>
</div>
</div>
</div>
</div>
<!-- 6. SYSTEM SETTINGS TAB PANEL -->
<div class="tab-panel" id="panel-system">
<div class="sidebar-section">
<h3>Chọn môi trường vận hành</h3>
<div class="form-group">
<label class="form-label" for="env-select">Chọn môi trường</label>
<div class="select-wrapper">
<select id="env-select" class="glass-select">
<!-- Populated dynamically via JS -->
</select>
</div>
</div>
</div>
<div class="sidebar-section">
<h3>Cấu hình âm thanh phản hồi</h3>
<div class="form-group">
<label class="toggle-switch">
<input type="checkbox" id="tts-toggle" checked>
<span class="slider"></span>
<span class="toggle-label">Bật phản hồi giọng nói (TTS)</span>
</label>
</div>
</div>
</div>
</div>
<!-- Floating Chat Window (Glassmorphic Overlay) -->
<div class="chat-container glass">
<form id="chat-form">
<!-- Autocomplete Suggestions Panel -->
<div id="autocomplete-panel" class="autocomplete-panel hidden"></div>
<button type="button" id="mic-btn" class="chat-action-btn" title="Ghi âm giọng nói">
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path>
<path d="M19 10v1a7 7 0 0 1-14 0v-1M12 19v4M8 23h8"></path>
</svg>
</button>
<input
type="text"
id="chat-input"
placeholder="Nhập câu lệnh của bạn cho robot"
autocomplete="off"
>
<button type="submit" id="submit-btn" class="chat-action-btn" title="Gửi yêu cầu">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="22" y1="2" x2="11" y2="13"></line>
<polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
</svg>
</button>
</form>
<div class="chat-options">
<button id="reset-btn" class="text-btn">
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align: middle; margin-right: 4px;">
<polyline points="23 4 23 10 17 10"></polyline>
<polyline points="1 20 1 14 7 14"></polyline>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
</svg>Reset Scene
</button>
</div>
</div>
<!-- Top Instructions Overlay -->
<div class="header-overlay">
<h1>Mô phỏng điều khiển Franka Panda</h1>
</div>
<!-- Server Busy Overlay -->
<div id="server-busy-overlay" class="glass" style="display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; justify-content: center; align-items: center; background: rgba(0,0,0,0.7); backdrop-filter: blur(10px);">
<div style="background: var(--bg-card, #fff); padding: 40px; border-radius: 12px; text-align: center; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.5);">
<svg viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="#ef4444" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom: 20px;">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="8" x2="12" y2="12"></line>
<line x1="12" y1="16" x2="12.01" y2="16"></line>
</svg>
<h2 style="margin-top: 0; color: var(--text-primary, #1e293b);">Hệ thống quá tải</h2>
<p id="server-busy-message" style="color: var(--text-secondary, #64748b); line-height: 1.5; margin-bottom: 24px;">Hệ thống đang có nhiều người dùng vui lòng truy cập sau.</p>
<button onclick="location.reload()" style="background: var(--primary-color, #3b82f6); color: white; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer;">Thử lại</button>
</div>
</div>
<!-- Application Script -->
<script src="/static/app.js?v=41"></script>
</body>
</html>