Spaces:
Sleeping
Sleeping
Download frontend/admin.html from bevisssssss/AI: direct link, hf CLI and curl.
- Browser
- Download file 17.3 kB
-
https://huggingface.co/spaces/bevisssssss/AI/resolve/main/frontend/admin.html
- Command line
-
hf download hf://spaces/bevisssssss/AI/frontend/admin.html
-
curl -L -o admin.html https://huggingface.co/spaces/bevisssssss/AI/resolve/main/frontend/admin.html
17.3 kB
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | |
| <title>知识库管理后台</title> | |
| <link rel="stylesheet" href="style.css" /> | |
| </head> | |
| <body class="admin-page"> | |
| <div class="grid-bg"></div> | |
| <canvas id="particles"></canvas> | |
| <div class="glow-wave"></div> | |
| <main class="admin-shell"> | |
| <!-- 登录面板 --> | |
| <section class="admin-card" id="loginPanel"> | |
| <div style="display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:40px"> | |
| <div class="login-logo-wrap" style="margin-bottom:0"> | |
| <div class="logo-icon" style="width:56px;height:56px;border-radius:18px"> | |
| <div class="logo-bars"> | |
| <span></span> | |
| <span></span> | |
| <span></span> | |
| </div> | |
| </div> | |
| <div> | |
| <div class="brand-title" style="font-size:28px">知识库管理后台</div> | |
| <div class="brand-sub">管理员登录后可以进行维护操作</div> | |
| </div> | |
| </div> | |
| <button id="adminThemeToggle" class="theme-btn" title="切换主题" style="flex-shrink:0"> | |
| <svg class="sun-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <circle cx="12" cy="12" r="5"/> | |
| <line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/> | |
| <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/> | |
| <line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/> | |
| <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/> | |
| </svg> | |
| <svg class="moon-icon" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"> | |
| <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/> | |
| </svg> | |
| </button> | |
| </div> | |
| </div> | |
| <form id="loginForm"> | |
| <div class="input-group"> | |
| <label>用户名</label> | |
| <input id="usernameInput" type="text" autocomplete="username" placeholder="请输入用户名" /> | |
| </div> | |
| <div class="input-group"> | |
| <label>密码</label> | |
| <input id="passwordInput" type="password" autocomplete="current-password" placeholder="请输入密码" /> | |
| </div> | |
| <button class="btn" type="submit">登录</button> | |
| </form> | |
| <p id="loginMessage" class="status"></p> | |
| </section> | |
| <!-- 管理面板(登录后显示) --> | |
| <section class="admin-card hidden" id="managePanel"> | |
| <div class="admin-title"> | |
| <div> | |
| <h1>知识库维护</h1> | |
| <p class="muted" id="adminUserInfo"></p> | |
| </div> | |
| <div style="display:flex;gap:8px;align-items:center"> | |
| <button id="manageThemeToggle" class="theme-btn" title="切换主题" style="width:34px;height:34px"> | |
| <svg class="sun-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | |
| <circle cx="12" cy="12" r="5"/> | |
| <line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/> | |
| <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/> | |
| <line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/> | |
| <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/> | |
| </svg> | |
| <svg class="moon-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:none"> | |
| <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/> | |
| </svg> | |
| </button> | |
| <button id="logoutButton" class="secondary">退出登录</button> | |
| </div> | |
| </div> | |
| <!-- 服务状态 --> | |
| <section class="panel"> | |
| <h2>服务器状态</h2> | |
| <div id="adminStatus" class="status">正在读取...</div> | |
| </section> | |
| <!-- 知识库概览 --> | |
| <section class="panel"> | |
| <h2>知识库概览</h2> | |
| <div id="kbInfo" class="status">正在读取...</div> | |
| </section> | |
| <!-- 模型配置 --> | |
| <section class="panel" id="modelConfigPanel"> | |
| <h2>模型配置</h2> | |
| <div id="modelConfigForm" class="admin-form"> | |
| <label> | |
| LLM 提供者 | |
| <select id="modelProvider"> | |
| <option value="ollama">Ollama(本地)</option> | |
| <option value="openai">OpenAI 兼容 API</option> | |
| </select> | |
| </label> | |
| <label> | |
| LLM 模型 | |
| <input id="modelName" type="text" placeholder="如 qwen2.5-coder:14b" /> | |
| </label> | |
| <label> | |
| 嵌入模型 | |
| <input id="embedModelName" type="text" placeholder="如 bge-m3" /> | |
| </label> | |
| <label> | |
| API 地址(OpenAI 模式时填写) | |
| <input id="modelApiBase" type="text" placeholder="https://api.openai.com/v1" /> | |
| </label> | |
| <label> | |
| API Key(OpenAI 模式时填写) | |
| <input id="modelApiKey" type="password" placeholder="sk-..." /> | |
| </label> | |
| <button id="saveModelConfig" class="primary">保存模型配置</button> | |
| <p id="modelConfigMessage" class="status"></p> | |
| </div> | |
| </section> | |
| <!-- 文件上传 --> | |
| <section class="panel"> | |
| <h2>上传更新</h2> | |
| <label class="upload-box"> | |
| <input id="fileInput" type="file" accept=".xlsx,.xls,.csv" /> | |
| <span>选择产品电源参数表</span> | |
| </label> | |
| <button id="uploadButton" class="primary">更新知识库</button> | |
| <p id="uploadMessage" class="status"></p> | |
| </section> | |
| <!-- 公告管理 --> | |
| <section class="panel"> | |
| <div class="admin-title"> | |
| <h2>公告推送</h2> | |
| <button id="newAnnouncementButton" class="secondary">新建公告</button> | |
| </div> | |
| <form id="announcementForm" class="admin-form announcement-form"> | |
| <input id="announcementId" type="hidden" /> | |
| <label> | |
| 类型 | |
| <select id="announcementKindInput"> | |
| <option value="升级公告">升级公告</option> | |
| <option value="更新日志">更新日志</option> | |
| <option value="重要通知">重要通知</option> | |
| <option value="使用提醒">使用提醒</option> | |
| </select> | |
| </label> | |
| <label> | |
| 标题 | |
| <input id="announcementTitleInput" type="text" placeholder="例如:知识库更新公告" /> | |
| </label> | |
| <label class="wide-field"> | |
| 内容 | |
| <textarea id="announcementContentInput" rows="4" placeholder="输入公告内容"></textarea> | |
| </label> | |
| <label class="checkbox-field"> | |
| <input id="announcementActiveInput" type="checkbox" checked /> | |
| 启用并在销售端弹出 | |
| </label> | |
| <button class="primary" type="submit">发布公告</button> | |
| </form> | |
| <p id="announcementMessage" class="status"></p> | |
| <div class="admin-title"> | |
| <h3>历史公告</h3> | |
| <p id="announcementSummary" class="status"></p> | |
| </div> | |
| <div id="announcementList" class="announcement-list"></div> | |
| </section> | |
| <!-- 账号管理 --> | |
| <section class="panel"> | |
| <div class="admin-title"> | |
| <h2>账号管理</h2> | |
| <button id="newAccountButton" class="secondary">新增账号</button> | |
| </div> | |
| <form id="accountForm" class="admin-form hidden"> | |
| <input id="accountEditId" type="hidden" /> | |
| <label> | |
| 用户名 | |
| <input id="accountUsernameInput" type="text" placeholder="输入用户名" /> | |
| </label> | |
| <label> | |
| 密码 | |
| <input id="accountPasswordInput" type="text" placeholder="输入密码" /> | |
| </label> | |
| <label> | |
| 角色 | |
| <select id="accountRoleInput"> | |
| <option value="user">user(普通用户)</option> | |
| <option value="admin">admin(管理员)</option> | |
| <option value="superadmin">superadmin(超级管理员)</option> | |
| </select> | |
| </label> | |
| <label class="checkbox-field"> | |
| <input id="accountActiveInput" type="checkbox" checked /> | |
| 启用 | |
| </label> | |
| <div style="display:flex;gap:8px"> | |
| <button class="primary" type="submit">保存</button> | |
| <button id="cancelAccountForm" class="secondary" type="button">取消</button> | |
| </div> | |
| </form> | |
| <p id="accountMessage" class="status"></p> | |
| <div id="accountList" class="account-list"></div> | |
| </section> | |
| <!-- 用户反馈 --> | |
| <section class="panel"> | |
| <div class="admin-title"> | |
| <h2>用户反馈</h2> | |
| <div style="display:flex;gap:6px"> | |
| <select id="fbFilterStatus" style="font-size:13px;padding:4px 8px"> | |
| <option value="">全部</option> | |
| <option value="pending">待处理</option> | |
| <option value="resolved">已处理</option> | |
| </select> | |
| <button id="fbRefreshBtn" class="secondary" style="font-size:13px;padding:4px 12px">刷新</button> | |
| </div> | |
| </div> | |
| <p id="feedbackMessage" class="status"></p> | |
| <div id="feedbackList" class="feedback-list"></div> | |
| </section> | |
| <!-- 规格书上传 --> | |
| <section class="panel"> | |
| <h2>上传规格书</h2> | |
| <form id="specUploadForm" class="admin-form"> | |
| <label> | |
| 产品型号(如 V10J) | |
| <input id="specModelInput" type="text" placeholder="输入产品型号" required /> | |
| </label> | |
| <label> | |
| 规格书文件(支持 .xlsx / .xls / .pdf / .docx) | |
| <input id="specFileInput" type="file" accept=".xlsx,.xls,.pdf,.docx" /> | |
| </label> | |
| <button type="submit" class="primary">上传规格书</button> | |
| </form> | |
| <p id="specUploadMessage" class="status"></p> | |
| </section> | |
| <!-- 知识库文档上传 --> | |
| <section class="panel"> | |
| <h2>上传知识库文档</h2> | |
| <p class="muted">非规格书的通用知识文件(产品手册、说明文档等),上传后点击「重新加载」使其生效</p> | |
| <form id="kbUploadForm" class="admin-form"> | |
| <label> | |
| 知识库文件(支持 .pdf / .docx / .txt) | |
| <input id="kbFileInput" type="file" accept=".pdf,.docx,.txt" /> | |
| </label> | |
| <button type="submit" class="primary">上传文档</button> | |
| </form> | |
| <p id="kbUploadMessage" class="status"></p> | |
| </section> | |
| <!-- 重新加载 --> | |
| <section class="panel"> | |
| <h2>重新加载</h2> | |
| <div style="display:flex;gap:8px;flex-wrap:wrap"> | |
| <button id="reloadButton" class="primary">全量重新加载</button> | |
| <button id="quickReloadButton" class="secondary">仅增量更新</button> | |
| </div> | |
| <p id="reloadMessage" class="status"></p> | |
| </section> | |
| <a class="back-link" href="index.html">返回销售问答页</a> | |
| </section> | |
| </main> | |
| <script> | |
| const canvas = document.getElementById('particles'); | |
| const ctx = canvas.getContext('2d'); | |
| let particles = []; | |
| const particleCount = 80; | |
| function resize(){ | |
| canvas.width = window.innerWidth; | |
| canvas.height = window.innerHeight; | |
| } | |
| window.addEventListener('resize', resize); | |
| resize(); | |
| class Particle{ | |
| constructor(){this.reset();} | |
| reset(){ | |
| this.x = Math.random() * canvas.width; | |
| this.y = Math.random() * canvas.height; | |
| this.size = Math.random() * 2 + 0.5; | |
| this.speedX = (Math.random() - 0.5) * 0.3; | |
| this.speedY = (Math.random() - 0.5) * 0.3; | |
| this.opacity = Math.random() * 0.6; | |
| } | |
| update(){ | |
| this.x += this.speedX; | |
| this.y += this.speedY; | |
| if(this.x < 0 || this.x > canvas.width || this.y < 0 || this.y > canvas.height) this.reset(); | |
| } | |
| draw(){ | |
| ctx.beginPath(); | |
| ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2); | |
| ctx.fillStyle = `rgba(0,180,255,${this.opacity})`; | |
| ctx.fill(); | |
| } | |
| } | |
| for(let i=0;i<particleCount;i++) particles.push(new Particle()); | |
| function connectParticles(){ | |
| for(let a=0;a<particles.length;a++){ | |
| for(let b=a;b<particles.length;b++){ | |
| let dx = particles[a].x - particles[b].x; | |
| let dy = particles[a].y - particles[b].y; | |
| let distance = dx*dx + dy*dy; | |
| if(distance < 10000){ | |
| ctx.beginPath(); | |
| ctx.strokeStyle = "rgba(0,150,255,0.05)"; | |
| ctx.lineWidth = 1; | |
| ctx.moveTo(particles[a].x, particles[a].y); | |
| ctx.lineTo(particles[b].x, particles[b].y); | |
| ctx.stroke(); | |
| } | |
| } | |
| } | |
| } | |
| function animate(){ | |
| ctx.clearRect(0,0,canvas.width,canvas.height); | |
| particles.forEach(p=>{p.update();p.draw();}); | |
| connectParticles(); | |
| requestAnimationFrame(animate); | |
| } | |
| animate(); | |
| // 主题切换 | |
| (function(){ | |
| const savedTheme = localStorage.getItem('qa_theme'); | |
| const applyTheme = (isWarm) => { | |
| document.querySelector('.admin-shell')?.classList.toggle('warm-theme', isWarm); | |
| document.body.classList.toggle('warm-bg', isWarm); | |
| document.querySelectorAll('.theme-btn').forEach(btn => { | |
| btn.querySelector('.sun-icon').style.display = isWarm ? 'none' : ''; | |
| btn.querySelector('.moon-icon').style.display = isWarm ? '' : 'none'; | |
| }); | |
| }; | |
| applyTheme(savedTheme === 'warm'); | |
| document.addEventListener('click', function(e){ | |
| const btn = e.target.closest('.theme-btn'); | |
| if(!btn) return; | |
| const shell = document.querySelector('.admin-shell'); | |
| const isWarm = !shell?.classList.contains('warm-theme'); | |
| localStorage.setItem('qa_theme', isWarm ? 'warm' : 'dark'); | |
| applyTheme(isWarm); | |
| }); | |
| })(); | |
| </script> | |
| <script src="admin.js"></script> | |
| </body> | |
| </html> | |