mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 17:38:10 +00:00
- webui handler: 新增 sseEventRing 环状缓冲区(200条),断线重连按 Last-Event-ID 重放遗漏事件 - GUI app.js: doRenderAll 检测连接表单打开时改走 refreshDataOnly,修复 15s 定时器擦掉用户输入的 bug - 附带 dashboard.html/index.html 前端调整 + handler_sse_test.go 单测
320 lines
10 KiB
HTML
320 lines
10 KiB
HTML
<!doctype html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>HomeAgent</title>
|
|
<link rel="icon" type="image/svg+xml" href="icon.svg" />
|
|
<link rel="stylesheet" href="style.css" />
|
|
<script
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"
|
|
onerror="window._THREE_FAILED = true"
|
|
></script>
|
|
<script
|
|
src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"
|
|
onerror="window._THREE_FAILED = true"
|
|
></script>
|
|
<script
|
|
src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"
|
|
onerror="console.warn('marked CDN failed')"
|
|
></script>
|
|
<script
|
|
src="https://cdn.jsdelivr.net/npm/dompurify@3.2.4/dist/purify.min.js"
|
|
onerror="console.warn('DOMPurify CDN failed')"
|
|
></script>
|
|
<script>
|
|
setTimeout(function () {
|
|
if (!window.THREE) window._THREE_FAILED = true;
|
|
}, 8000);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="bg-layer"></div>
|
|
|
|
<div class="titlebar" id="titlebar">
|
|
<div class="titlebar-controls">
|
|
<button
|
|
class="tb-btn"
|
|
id="tb-min"
|
|
title="最小化"
|
|
onclick="window.homeagent && homeagent.win.minimize()"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
width="14"
|
|
height="14"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.6"
|
|
stroke-linecap="round"
|
|
>
|
|
<line x1="4" y1="12" x2="20" y2="12" />
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="tb-btn"
|
|
id="tb-max"
|
|
title="最大化"
|
|
onclick="window.homeagent && homeagent.win.toggleMaximize()"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
width="13"
|
|
height="13"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.6"
|
|
stroke-linecap="round"
|
|
>
|
|
<rect x="5" y="5" width="14" height="14" rx="1.5" />
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="tb-btn tb-close"
|
|
id="tb-close"
|
|
title="关闭"
|
|
onclick="window.homeagent && homeagent.win.close()"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
width="14"
|
|
height="14"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.6"
|
|
stroke-linecap="round"
|
|
>
|
|
<path d="M6 6l12 12M18 6L6 18" />
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="app">
|
|
<!-- 左侧图标栏:主页=对话,其余为二级页面 -->
|
|
<aside class="rail" id="rail">
|
|
<div class="rail-logo"><img src="icon.svg" alt="HomeAgent" /></div>
|
|
<button
|
|
class="rail-btn active"
|
|
id="rail-chat"
|
|
onclick="switchView('chat')"
|
|
title="对话"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<path
|
|
d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-overview"
|
|
onclick="switchView('overview')"
|
|
title="概览"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<path d="M22 12h-4l-3 9L9 3l-3 9H2" />
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-plugins"
|
|
onclick="switchView('plugins')"
|
|
title="插件"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-adapters"
|
|
onclick="switchView('adapters')"
|
|
title="适配器"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<path
|
|
d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-kernel"
|
|
onclick="switchView('kernel')"
|
|
title="内核"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<rect x="4" y="4" width="16" height="16" rx="2" />
|
|
<rect x="9" y="9" width="6" height="6" />
|
|
<path
|
|
d="M9 1v4M15 1v4M9 19v4M15 19v4M1 9h4M1 15h4M19 9h4M19 15h4"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-devices"
|
|
onclick="switchView('devices')"
|
|
title="设备"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<circle cx="7" cy="7" r="3" />
|
|
<circle cx="17" cy="17" r="3" />
|
|
<circle cx="17" cy="7" r="3" />
|
|
<path d="M7 7h7a3 3 0 0 1 3 3v4" />
|
|
</svg>
|
|
</button>
|
|
<div class="rail-spacer"></div>
|
|
<button
|
|
class="rail-btn"
|
|
id="rail-settings"
|
|
onclick="switchView('settings')"
|
|
title="设置"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<circle cx="12" cy="12" r="3" />
|
|
<path
|
|
d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
<button
|
|
class="rail-btn"
|
|
onclick="toggleTheme()"
|
|
title="切换亮色/暗色模式"
|
|
id="theme-btn"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
width="15"
|
|
height="15"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
>
|
|
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
</svg>
|
|
</button>
|
|
<div class="palette-pop" id="palette-pop" title="外观"></div>
|
|
<button
|
|
class="rail-btn"
|
|
onclick="toggleAppearance()"
|
|
id="palette-btn"
|
|
title="外观:主题色 / 背景图"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
width="15"
|
|
height="15"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
>
|
|
<path
|
|
d="M12 22a10 10 0 1 1 10-10c0 2.2-1.8 4-4 4h-2a3 3 0 0 0-3 3c0 1.1.9 2 2 2 1.4 0 2.5-1.1 3.6-2.1C19.3 18.5 20 20 21.5 20.5A1 1 0 0 0 22 19c0-4-3.6-7-10-7-5.5 0-9 3.8-9 9z"
|
|
/>
|
|
<circle cx="7.5" cy="10.5" r="1" />
|
|
<circle cx="12" cy="7.5" r="1" />
|
|
<circle cx="16.5" cy="10.5" r="1" />
|
|
</svg>
|
|
</button>
|
|
<span
|
|
class="conn-dot dot-gray"
|
|
id="rail-conn-dot"
|
|
title="连接状态"
|
|
></span>
|
|
</aside>
|
|
|
|
<div class="main">
|
|
<div class="topbar">
|
|
<h1>HomeAgent</h1>
|
|
<span
|
|
class="conn-indicator"
|
|
id="conn-indicator"
|
|
onclick="goSettingsConn()"
|
|
title="点击管理后端连接"
|
|
>
|
|
<span class="status-dot dot-gray" id="conn-dot"></span>
|
|
<span id="conn-name-display">未连接</span>
|
|
<span style="font-size: 10px; margin-left: 4px; opacity: 0.6"
|
|
>▼</span
|
|
>
|
|
</span>
|
|
<div class="spacer"></div>
|
|
<button class="lang-btn" onclick="toggleLang()" id="lang-btn">
|
|
EN
|
|
</button>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div id="view-chat" class="view active"></div>
|
|
<div id="view-overview" class="view"></div>
|
|
<div id="view-plugins" class="view"></div>
|
|
<div id="view-adapters" class="view"></div>
|
|
<div id="view-kernel" class="view"></div>
|
|
<div id="view-devices" class="view"></div>
|
|
<div id="view-settings" class="view"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="toast" class="toast"></div>
|
|
<div id="confirm-overlay" class="confirm-overlay"></div>
|
|
|
|
<script src="app.js"></script>
|
|
</body>
|
|
</html>
|