1. 版本管理增加执行程序(binaries)管理: 每个版本可管理llama-server/llama-cli/llama-bench等程序 - 参数管理中增加执行程序选择器, 可按程序筛选参数 - 参数可绑定到特定执行程序或适用所有程序 2. 模型管理重构: 一个模型统一参数(区分dense/MoE), 量化版本作为子表管理 - models表增加model_type(dense/moe)和num_experts字段 - 新增model_quants表, 每个模型可有多个量化版本 - 前端模型选择改为: 选模型 -> 选量化版本 3. 修复系统设置中默认GPU下拉为空: 异步加载GPU后再渲染设置
209 lines
11 KiB
HTML
209 lines
11 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>后台管理</title>
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
</head>
|
|
<body>
|
|
<div id="admin-app">
|
|
<!-- Login Screen -->
|
|
<div id="login-screen" class="login-screen">
|
|
<div class="login-box">
|
|
<h2>🔒 后台管理登录</h2>
|
|
<input type="password" id="login-password" placeholder="请输入密码" onkeydown="if(event.key==='Enter')doLogin()">
|
|
<button onclick="doLogin()" class="btn-primary">登录</button>
|
|
<div id="login-error" class="login-error"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Admin Content (hidden until login) -->
|
|
<div id="admin-content" class="hidden">
|
|
<header>
|
|
<h1>⚙️ 后台管理</h1>
|
|
<div class="header-right">
|
|
<a href="/" class="admin-link">← 返回主界面</a>
|
|
<button onclick="doLogout()" class="btn-logout">退出登录</button>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="admin-tabs">
|
|
<button class="admin-tab active" data-tab="gpus" onclick="adminSwitchTab('gpus')">GPU 管理</button>
|
|
<button class="admin-tab" data-tab="versions" onclick="adminSwitchTab('versions')">版本管理</button>
|
|
<button class="admin-tab" data-tab="params" onclick="adminSwitchTab('params')">参数管理</button>
|
|
<button class="admin-tab" data-tab="models" onclick="adminSwitchTab('models')">模型管理</button>
|
|
<button class="admin-tab" data-tab="settings" onclick="adminSwitchTab('settings')">系统设置</button>
|
|
</div>
|
|
|
|
<!-- GPU Management -->
|
|
<section class="admin-section active" id="admin-gpus">
|
|
<h2>GPU 管理</h2>
|
|
<div class="admin-add-form">
|
|
<h3>添加新 GPU</h3>
|
|
<div class="form-row">
|
|
<input type="text" id="gpu-name" placeholder="GPU名称 (如: RTX 5090)">
|
|
<input type="number" id="gpu-vram" placeholder="显存MB" min="0">
|
|
<input type="text" id="gpu-cc" placeholder="计算能力 (如: 12.0)">
|
|
<input type="text" id="gpu-desc" placeholder="描述">
|
|
<input type="number" id="gpu-order" placeholder="排序" value="0">
|
|
<button onclick="addGpu()" class="btn-primary">添加</button>
|
|
</div>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>名称</th><th>显存(MB)</th><th>计算能力</th><th>描述</th><th>排序</th><th>操作</th></tr></thead>
|
|
<tbody id="gpu-table-body"></tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<!-- Version Management -->
|
|
<section class="admin-section" id="admin-versions">
|
|
<h2>llama.cpp 版本管理</h2>
|
|
<div class="admin-add-form">
|
|
<h3>添加新版本</h3>
|
|
<div class="form-row">
|
|
<input type="text" id="ver-tag" placeholder="版本标签 (如: b12000)">
|
|
<input type="text" id="ver-desc" placeholder="描述">
|
|
<input type="date" id="ver-date">
|
|
<input type="number" id="ver-order" placeholder="排序" value="0">
|
|
<button onclick="addVersion()" class="btn-primary">添加</button>
|
|
</div>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>版本</th><th>描述</th><th>发布日期</th><th>活跃</th><th>排序</th><th>操作</th></tr></thead>
|
|
<tbody id="version-table-body"></tbody>
|
|
</table>
|
|
|
|
<!-- Binaries Management -->
|
|
<div class="admin-add-form" style="margin-top: 20px;">
|
|
<h3>执行程序管理</h3>
|
|
<div class="control-group" style="margin-bottom: 10px;">
|
|
<label>选择版本</label>
|
|
<select id="admin-binary-version" onchange="loadAdminBinaries()"></select>
|
|
</div>
|
|
<div class="form-row">
|
|
<input type="text" id="binary-name" placeholder="程序名称 (如: llama-server)">
|
|
<input type="text" id="binary-desc" placeholder="描述">
|
|
<input type="number" id="binary-order" placeholder="排序" value="0">
|
|
<button onclick="addBinary()" class="btn-primary">添加</button>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>程序名称</th><th>描述</th><th>排序</th><th>操作</th></tr></thead>
|
|
<tbody id="binary-table-body"></tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Parameter Management -->
|
|
<section class="admin-section" id="admin-params">
|
|
<h2>参数管理</h2>
|
|
<div class="control-group" style="margin-bottom: 10px;">
|
|
<label>选择版本</label>
|
|
<select id="admin-param-version" onchange="onParamVersionChange()"></select>
|
|
</div>
|
|
<div class="control-group" style="margin-bottom: 10px;">
|
|
<label>选择执行程序</label>
|
|
<select id="admin-param-binary" onchange="loadAdminParams()">
|
|
<option value="">全部程序</option>
|
|
</select>
|
|
</div>
|
|
<div class="admin-add-form">
|
|
<h3>添加新参数</h3>
|
|
<div class="form-grid">
|
|
<input type="text" id="param-key" placeholder="参数键 (如: ctx_size)">
|
|
<input type="text" id="param-short" placeholder="短标志 (如: -c)">
|
|
<input type="text" id="param-long" placeholder="长标志 (如: --ctx-size)">
|
|
<input type="text" id="param-desc" placeholder="描述">
|
|
<select id="param-category">
|
|
<option value="common">通用</option><option value="sampling">采样</option>
|
|
<option value="server">服务器</option><option value="model_source">模型来源</option>
|
|
<option value="lora">LoRA</option><option value="logging">日志</option>
|
|
<option value="advanced">高级</option>
|
|
</select>
|
|
<select id="param-type">
|
|
<option value="string">字符串</option><option value="number">数字</option>
|
|
<option value="boolean">布尔</option><option value="select">下拉选择</option>
|
|
</select>
|
|
<input type="text" id="param-default" placeholder="默认值">
|
|
<input type="text" id="param-options" placeholder="选项 (逗号分隔, 仅select类型)">
|
|
<input type="number" id="param-min" placeholder="最小值" step="any">
|
|
<input type="number" id="param-max" placeholder="最大值" step="any">
|
|
<input type="number" id="param-step" placeholder="步长" step="any">
|
|
<input type="text" id="param-unit" placeholder="单位">
|
|
<select id="param-binary-bind">
|
|
<option value="">适用所有程序</option>
|
|
</select>
|
|
<input type="number" id="param-important" placeholder="重要" min="0" max="1" value="0">
|
|
<input type="number" id="param-vram" placeholder="影响显存" min="0" max="1" value="0">
|
|
<input type="number" id="param-order" placeholder="排序" value="0">
|
|
<button onclick="addParam()" class="btn-primary">添加参数</button>
|
|
</div>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>键</th><th>标志</th><th>描述</th><th>分类</th><th>类型</th><th>默认值</th><th>程序</th><th>重要</th><th>影响显存</th><th>操作</th></tr></thead>
|
|
<tbody id="param-table-body"></tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<!-- Model Management -->
|
|
<section class="admin-section" id="admin-models">
|
|
<h2>模型管理</h2>
|
|
<div class="admin-add-form">
|
|
<h3>添加新模型</h3>
|
|
<div class="form-grid">
|
|
<input type="text" id="model-basemodel" placeholder="基模型 (如: Llama-3-8B-Instruct)">
|
|
<input type="text" id="model-name" placeholder="显示名称 (默认同基模型)">
|
|
<select id="model-type">
|
|
<option value="dense">Dense (稠密模型)</option>
|
|
<option value="moe">MoE (稀疏专家模型)</option>
|
|
</select>
|
|
<input type="number" id="model-experts" placeholder="专家数 (MoE)" min="0" value="0">
|
|
<input type="number" id="model-layers" placeholder="层数">
|
|
<input type="number" id="model-embd" placeholder="嵌入维度">
|
|
<input type="number" id="model-kv" placeholder="KV Heads">
|
|
<input type="number" id="model-hdim" placeholder="Head Dim">
|
|
<input type="number" id="model-heads" placeholder="Attention Heads">
|
|
<input type="number" id="model-ctx" placeholder="默认上下文" value="0">
|
|
<input type="text" id="model-desc" placeholder="描述">
|
|
<input type="number" id="model-order" placeholder="排序" value="0">
|
|
<button onclick="addModel()" class="btn-primary">添加模型</button>
|
|
</div>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>基模型</th><th>名称</th><th>类型</th><th>专家数</th><th>层数</th><th>EMBD</th><th>KV</th><th>HD</th><th>Heads</th><th>默认CTX</th><th>排序</th><th>操作</th></tr></thead>
|
|
<tbody id="model-table-body"></tbody>
|
|
</table>
|
|
|
|
<!-- Quant Variants Management -->
|
|
<div class="admin-add-form" style="margin-top: 20px;">
|
|
<h3>量化版本管理</h3>
|
|
<div class="control-group" style="margin-bottom: 10px;">
|
|
<label>选择模型</label>
|
|
<select id="admin-quant-model" onchange="loadAdminQuants()"></select>
|
|
</div>
|
|
<div class="form-row">
|
|
<input type="text" id="quant-type" placeholder="量化类型 (如: Q4_K_M)">
|
|
<input type="number" id="quant-size" placeholder="大小(GB)" step="0.1">
|
|
<input type="number" id="quant-order" placeholder="排序" value="0">
|
|
<button onclick="addQuant()" class="btn-primary">添加量化版本</button>
|
|
</div>
|
|
<table class="admin-table">
|
|
<thead><tr><th>ID</th><th>量化类型</th><th>大小(GB)</th><th>排序</th><th>操作</th></tr></thead>
|
|
<tbody id="quant-table-body"></tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Settings -->
|
|
<section class="admin-section" id="admin-settings">
|
|
<h2>系统设置</h2>
|
|
<div class="settings-form" id="settings-form"></div>
|
|
<button onclick="saveSettings()" class="btn-primary">💾 保存设置</button>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/js/admin.js"></script>
|
|
</body>
|
|
</html>
|