This commit is contained in:
XOF
2025-11-20 12:24:05 +08:00
commit f28bdc751f
164 changed files with 64248 additions and 0 deletions

184
web/templates/logs.html Normal file
View File

@@ -0,0 +1,184 @@
{% extends "base.html" %}
{% block title %}日志管理 - GEMINI BALANCER{% endblock %}
{% block content %}
<div class="w-full h-full flex flex-col pl-0 pr-3 lg:px-0" data-page-id="logs">
<!-- =================================================================== -->
<!-- 1. 页面顶栏:标题与全局控制器 -->
<!-- =================================================================== -->
<div class="flex items-center justify-between mb-4 shrink-0">
<div>
<h2 class="text-3xl font-bold tracking-tight">日志管理</h2>
<p class="text-sm text-zinc-500 dark:text-zinc-400 mt-1">查看、筛选和分析所有通过系统的请求记录。</p>
</div>
<div class="flex items-center space-x-2">
<!-- [新] 日志系统参数管理图标 -->
<button class="btn btn-icon" aria-label="日志设置">
<i class="fas fa-cog text-lg"></i>
</button>
</div>
</div>
<!-- =================================================================== -->
<!-- 2. 导航标签 -->
<!-- =================================================================== -->
<div class="py-2 shrink-0">
<div class="w-full overflow-x-auto scrollbar-hide">
<div role="tablist" class="relative inline-flex h-10 items-center justify-center inset-shadow-sm/25 rounded-lg bg-zinc-800/50 dark:bg-zinc-950 p-1" data-sliding-tabs-container>
<div class="absolute left-0 h-[calc(100%-0.5rem)] rounded-md bg-white dark:bg-zinc-700 shadow-sm" data-tab-indicator style="transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);"></div>
<a href="#" role="tab" class="tab-item tab-active" data-tab-item>错误日志</a>
<a href="#" role="tab" class="tab-item" data-tab-item>系统日志</a>
<a href="#" role="tab" class="tab-item" data-tab-item>保留标签</a>
<a href="#" role="tab" class="tab-item" data-tab-item>保留标签</a>
</div>
</div>
</div>
<!-- =================================================================== -->
<!-- 3. 主内容区:过滤器 + 表格 (精确复刻版) -->
<!-- =================================================================== -->
<div class="flex items-center justify-between shrink-0 py-4">
<div class="flex flex-1 items-center space-x-2">
<input class="input h-8 w-[150px] lg:w-[250px]" placeholder="筛选密钥..." value="">
<button class="btn btn-outline border-dashed h-8 px-3 text-xs">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
<circle cx="12" cy="12" r="10"></circle><path d="M8 12h8"></path><path d="M12 8v8"></path>
</svg>
错误类型
</button>
<button class="btn btn-outline border-dashed h-8 px-3 text-xs">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
<circle cx="12" cy="12" r="10"></circle><path d="M8 12h8"></path><path d="M12 8v8"></path>
</svg>
错误码
</button>
<button class="btn btn-outline border-dashed h-8 px-3 text-xs">
<i class="fas fa-calendar-alt mr-2 h-4 w-4"></i>
时间范围
</button>
</div>
<!-- [应用] .btn .btn-outline, 并覆盖高度/字体 -->
<button class="btn btn-outline hidden lg:flex h-8 px-3 text-xs">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-4 w-4">
<path d="M20 7h-9"></path><path d="M14 17H5"></path><circle cx="17" cy="17" r="3"></circle><circle cx="7" cy="7" r="3"></circle>
</svg>
批量操作
</button>
</div>
<!-- 3.2 数据表格容器 (带边框和圆角) -->
<div class="rounded-lg border border-zinc-200 dark:border-zinc-700 flex-grow overflow-hidden flex flex-col">
<!-- 容器需要 overflow-auto 以便表格内容超出时滚动 -->
<div class="relative w-full overflow-auto flex-grow main-content-scroll">
<table class="w-full caption-bottom text-sm">
<thead class="[&_tr]:border-b border-b-zinc-200 dark:border-b-zinc-800 sticky top-0 bg-zinc-50 dark:bg-zinc-900 z-10">
<tr class="transition-colors hover:bg-zinc-100/50 dark:hover:bg-zinc-800/50">
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400 w-4">
<input type="checkbox" class="checkbox">
</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">ID</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">Gemini 密钥</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">错误类型</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">错误码</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">模型名称</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">请求时间</th>
<th class="h-12 px-4 text-left align-middle font-medium text-zinc-500 dark:text-zinc-400">操作</th>
</tr>
</thead>
<tbody class="[&_tr:last-child]:border-0" id="logs-table-body">
<tr class="border-b border-b-zinc-200 dark:border-b-zinc-700 transition-colors hover:bg-zinc-100/50 dark:hover:bg-zinc-800/50">
<td class="p-4 align-middle"><input type="checkbox" class="h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500"></td>
<td class="p-4 align-middle font-mono text-zinc-600 dark:text-zinc-300">#12346</td>
<td class="p-4 align-middle font-medium font-mono">AIza...s7f1</td>
<td class="p-4 align-middle text-zinc-600 dark:text-zinc-300">API Key Invalid</td>
<td class="p-4 align-middle"><span class="inline-flex items-center rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive">429</span></td>
<td class="p-4 align-middle font-mono">gemini-1.5-pro-latest</td>
<td class="p-4 align-middle text-zinc-500 dark:text-zinc-400">2024-05-21 10:31:15</td>
<td class="p-4 align-middle">
<button class="btn btn-ghost btn-icon btn-sm" aria-label="更多操作"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg></button>
</td>
</tr>
<!-- [示例] 您可以复制粘贴下面这行来增加更多数据行进行测试 -->
<tr class="border-b border-b-zinc-200 dark:border-b-zinc-700 transition-colors hover:bg-zinc-100/50 dark:hover:bg-zinc-800/50">
<td class="p-4 align-middle"><input type="checkbox" class="h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500"></td>
<td class="p-4 align-middle font-mono text-zinc-600 dark:text-zinc-300">#12347</td>
<td class="p-4 align-middle font-medium font-mono">AIza...s7f2</td>
<td class="p-4 align-middle text-zinc-600 dark:text-zinc-300">Quota Exceeded</td>
<td class="p-4 align-middle"><span class="inline-flex items-center rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive">429</span></td>
<td class="p-4 align-middle font-mono">gemini-1.0-pro</td>
<td class="p-4 align-middle text-zinc-500 dark:text-zinc-400">2024-05-21 10:32:15</td>
<td class="p-4 align-middle">
<button class="btn btn-ghost btn-icon btn-sm" aria-label="更多操作"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg></button>
</td>
</tr>
<tr class="border-b border-b-zinc-200 dark:border-b-zinc-700 transition-colors hover:bg-zinc-100/50 dark:hover:bg-zinc-800/50">
<td class="p-4 align-middle"><input type="checkbox" class="h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500"></td>
<td class="p-4 align-middle font-mono text-zinc-600 dark:text-zinc-300">#12348</td>
<td class="p-4 align-middle font-medium font-mono">AIza...s7f3</td>
<td class="p-4 align-middle text-zinc-600 dark:text-zinc-300">Server Error</td>
<td class="p-4 align-middle"><span class="inline-flex items-center rounded-md bg-yellow-500/20 px-2 py-1 text-xs font-medium text-yellow-700 dark:text-yellow-400">500</span></td>
<td class="p-4 align-middle font-mono">gemini-1.5-pro-latest</td>
<td class="p-4 align-middle text-zinc-500 dark:text-zinc-400">2024-05-21 10:33:15</td>
<td class="p-4 align-middle">
<button class="btn btn-ghost btn-icon btn-sm" aria-label="更多操作"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg></button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- 3.3 分页控制器 -->
<div class="flex items-center justify-between p-2 shrink-0 border-t border-zinc-200 dark:border-zinc-700">
<div class="flex-1 text-sm text-zinc-500 dark:text-zinc-400">
已选择 <span class="font-semibold text-zinc-900 dark:text-white">0</span> / <span class="font-semibold text-zinc-900 dark:text-white">100</span>
</div>
<div class="flex items-center space-x-6 lg:space-x-8">
<div class="flex items-center space-x-2">
<p class="text-sm font-medium">每页行数</p>
<button type="button" class="btn btn-secondary h-8 w-[70px] flex justify-between items-center px-2">
<span>10</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4 opacity-50"><path d="m6 9 6 6 6-6"></path></svg>
</button>
</div>
<div class="flex w-[100px] items-center justify-center text-sm font-medium">
第 1 / 10 页
</div>
<div class="flex items-center space-x-2">
<button class="btn btn-secondary h-8 w-8 p-0 hidden lg:flex" disabled>
<span class="sr-only">Go to first page</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="m11 17-5-5 5-5"></path><path d="m18 17-5-5 5-5"></path></svg>
</button>
<button class="btn btn-secondary h-8 w-8 p-0" disabled>
<span class="sr-only">Go to previous page</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="m15 18-6-6 6-6"></path></svg>
</button>
<button class="btn btn-secondary h-8 w-8 p-0">
<span class="sr-only">Go to next page</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="m9 18 6-6-6-6"></path></svg>
</button>
<button class="btn btn-secondary h-8 w-8 p-0 hidden lg:flex">
<span class="sr-only">Go to last page</span>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4"><path d="m6 17 5-5-5-5"></path><path d="m13 17 5-5-5-5"></path></svg>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block modals %}
<!-- 日志详情模态框将在此处定义 -->
{% endblock modals %}
{% block page_scripts %}
{% endblock page_scripts %}