feat(report): 优化统计报告页面的UI和布局
对生成的HTML统计报告进行了全面的视觉和结构重构,以提供更现代化、更具可读性的用户界面。 - 采用仪表盘式的双栏布局(主内容区和侧边栏),将图表移至侧边栏,使数据表格更聚焦。 - 全面更新了CSS样式,包括配色、字体、卡片、表格和标签页,提升了整体的美观度和用户体验。 - 引入了响应式设计,以更好地适配移动设备。 - 将默认输出文件名从 `maibot_statistics.html` 更改为 `mofox_bot_statistics.html` 以保持项目命名一致性。
This commit is contained in:
@@ -10,7 +10,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./docker-config/core/.env:/app/.env # 持久化env配置文件
|
- ./docker-config/core/.env:/app/.env # 持久化env配置文件
|
||||||
- ./docker-config/core:/app/config # 持久化bot配置文件
|
- ./docker-config/core:/app/config # 持久化bot配置文件
|
||||||
- ./data/core/maibot_statistics.html:/app/maibot_statistics.html #统计数据输出
|
- ./data/core/mofox_bot_statistics.html:/app/mofox_bot_statistics.html #统计数据输出
|
||||||
- ./data/app:/app/data # 共享目录
|
- ./data/app:/app/data # 共享目录
|
||||||
- ./data/core/plugins:/app/plugins # 插件目录
|
- ./data/core/plugins:/app/plugins # 插件目录
|
||||||
- ./data/core/logs:/app/logs # 日志目录
|
- ./data/core/logs:/app/logs # 日志目录
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class StatisticOutputTask(AsyncTask):
|
|||||||
|
|
||||||
SEP_LINE = "-" * 84
|
SEP_LINE = "-" * 84
|
||||||
|
|
||||||
def __init__(self, record_file_path: str = "maibot_statistics.html"):
|
def __init__(self, record_file_path: str = "mofox_bot_statistics.html"):
|
||||||
# 延迟300秒启动,运行间隔300秒
|
# 延迟300秒启动,运行间隔300秒
|
||||||
super().__init__(task_name="Statistics Data Output Task", wait_before_start=0, run_interval=300)
|
super().__init__(task_name="Statistics Data Output Task", wait_before_start=0, run_interval=300)
|
||||||
|
|
||||||
|
|||||||
@@ -1,54 +1,159 @@
|
|||||||
|
/* General Body Styles */
|
||||||
body {
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
background-color: #f4f7f6;
|
background-color: #F8F9FA; /* Light grey background */
|
||||||
color: #333;
|
color: #495057; /* Softer text color */
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Main Container */
|
||||||
.container {
|
.container {
|
||||||
max-width: 900px;
|
max-width: 1200px;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
background-color: #fff;
|
background-color: #FFFFFF; /* Pure white background */
|
||||||
padding: 25px;
|
padding: 30px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
box-shadow: 0 4px 12px rgba(0,0,0,0.05);
|
||||||
|
border: 1px solid #EAEAEA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dashboard Layout */
|
||||||
|
.dashboard-layout {
|
||||||
|
display: flex;
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
flex: 65%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-content {
|
||||||
|
flex: 35%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive Design for Mobile */
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.dashboard-layout {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.main-content, .sidebar-content {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Typography */
|
||||||
h1, h2 {
|
h1, h2 {
|
||||||
color: #2c3e50;
|
color: #212529;
|
||||||
border-bottom: 2px solid #3498db;
|
|
||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2em;
|
font-size: 2.2em;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #4A90E2; /* Main blue for title */
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
margin-top: 30px;
|
margin-top: 40px;
|
||||||
}
|
margin-bottom: 15px;
|
||||||
|
border-bottom: 2px solid #EAEAEA;
|
||||||
p {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Info Banners */
|
||||||
.info-item {
|
.info-item {
|
||||||
background-color: #ecf0f1;
|
background-color: #E9ECEF;
|
||||||
padding: 8px 12px;
|
padding: 10px 15px;
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 20px;
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
|
border: 1px solid #DEE2E6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-item strong {
|
.info-item strong {
|
||||||
color: #2980b9;
|
color: #4A90E2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tabs */
|
||||||
|
.tabs {
|
||||||
|
border-bottom: 2px solid #DEE2E6;
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
padding: 14px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #6C757D;
|
||||||
|
border-bottom: 3px solid transparent;
|
||||||
|
margin-bottom: -2px; /* Align with container border */
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs button:hover {
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs button.active {
|
||||||
|
color: #4A90E2;
|
||||||
|
border-bottom-color: #4A90E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content {
|
||||||
|
display: none;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Summary Cards */
|
||||||
|
.summary-cards {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #EAEAEA;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 6px 15px rgba(0,0,0,0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h3 {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-size: 1em;
|
||||||
|
color: #6C757D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.8em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
table {
|
table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -57,121 +162,40 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
border: 1px solid #ddd;
|
padding: 12px 15px;
|
||||||
padding: 10px;
|
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
border-bottom: 1px solid #EAEAEA;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
background-color: #3498db;
|
background-color: #4A90E2;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
font-size: 0.95em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr:nth-child(even) {
|
tr:nth-child(even) {
|
||||||
background-color: #f9f9f9;
|
background-color: #F8F9FA;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer {
|
tr:hover {
|
||||||
text-align: center;
|
background-color: #E9ECEF;
|
||||||
margin-top: 30px;
|
|
||||||
font-size: 0.8em;
|
|
||||||
color: #7f8c8d;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs {
|
|
||||||
overflow: hidden;
|
|
||||||
background: #ecf0f1;
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button {
|
|
||||||
background: inherit;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
padding: 14px 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: 0.3s;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button:hover {
|
|
||||||
background-color: #d4dbdc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tabs button.active {
|
|
||||||
background-color: #b3bbbd;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-content {
|
|
||||||
display: none;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-content.active {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-cards {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
||||||
gap: 15px;
|
|
||||||
margin: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
background-color: #ecf0f1;
|
|
||||||
padding: 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card h3 {
|
|
||||||
margin: 0 0 10px;
|
|
||||||
font-size: 1em;
|
|
||||||
color: #2c3e50;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card p {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 1.2em;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #34495e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
gap: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Chart Container in Sidebar */
|
||||||
.chart-container {
|
.chart-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 40vh;
|
height: 300px; /* Adjust height as needed */
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.time-range-btn {
|
/* Footer */
|
||||||
background-color: #ecf0f1;
|
.footer {
|
||||||
border: 1px solid #bdc3c7;
|
text-align: center;
|
||||||
color: #2c3e50;
|
margin-top: 40px;
|
||||||
padding: 8px 16px;
|
font-size: 0.85em;
|
||||||
margin: 0 5px;
|
color: #6C757D;
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 14px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-range-btn:hover {
|
|
||||||
background-color: #d5dbdb;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time-range-btn.active {
|
|
||||||
background-color: #3498db;
|
|
||||||
color: white;
|
|
||||||
border-color: #2980b9;
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
<div id="{{ div_id }}" class="tab-content">
|
<div id="{{ div_id }}" class="tab-content">
|
||||||
|
<div class="dashboard-layout">
|
||||||
|
<div class="main-content">
|
||||||
<p class="info-item">
|
<p class="info-item">
|
||||||
<strong>统计时段: </strong>
|
<strong>统计时段: </strong>
|
||||||
{{ start_time }} ~ {{ end_time }}
|
{{ start_time }} ~ {{ end_time }}
|
||||||
</p>
|
</p>
|
||||||
{{ summary_cards }}
|
{{ summary_cards }}
|
||||||
{{ static_charts }}
|
|
||||||
|
|
||||||
<h2>按模型分类统计</h2>
|
<h2>按模型分类统计</h2>
|
||||||
<table>
|
<table>
|
||||||
@@ -42,3 +43,8 @@
|
|||||||
<tbody>{{ chat_rows }}</tbody>
|
<tbody>{{ chat_rows }}</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="sidebar-content">
|
||||||
|
{{ static_charts }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user