hf-demo-linux commited on
Commit
23eaaa5
·
verified ·
1 Parent(s): ed5b1fa

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +218 -0
templates/index.html ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI API Dashboard</title>
7
+ <!-- 引入 Bootstrap 5 与 Bootstrap Icons -->
8
+ <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
9
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css">
10
+ <!-- 引入 Google Fonts: Poppins -->
11
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap" rel="stylesheet">
12
+ <style>
13
+ /* 基本样式 */
14
+ body {
15
+ font-family: 'Poppins', sans-serif;
16
+ background: linear-gradient(135deg, #f5f7fa, #e9eff5);
17
+ color: #333;
18
+ line-height: 1.7;
19
+ -webkit-font-smoothing: antialiased;
20
+ -moz-osx-font-smoothing: grayscale;
21
+ }
22
+ .container {
23
+ max-width: 1100px;
24
+ padding: 20px;
25
+ }
26
+ h1 {
27
+ font-weight: 700;
28
+ color: #3f51b5; /* Material Indigo 500 */
29
+ text-align: center;
30
+ margin-bottom: 0.6em;
31
+ letter-spacing: -0.5px;
32
+ }
33
+ p.lead {
34
+ text-align: center;
35
+ font-size: 1.2rem;
36
+ color: #606c76;
37
+ }
38
+ /* Dashboard Section 样式 */
39
+ .dashboard-section {
40
+ background-color: #fff;
41
+ border-radius: 12px;
42
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
43
+ margin-bottom: 40px;
44
+ padding: 30px;
45
+ border: none;
46
+ transition: transform 0.3s ease;
47
+ }
48
+ .dashboard-section:hover {
49
+ transform: translateY(-5px);
50
+ }
51
+ .dashboard-section h2 {
52
+ font-weight: 600;
53
+ color: #424242;
54
+ margin-bottom: 1.6rem;
55
+ padding-bottom: 10px;
56
+ border-bottom: 2px solid #e0e0e0;
57
+ }
58
+ /* 卡片样式 */
59
+ .metrics-card {
60
+ background-color: #fff;
61
+ border: none;
62
+ border-radius: 10px;
63
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
64
+ padding: 25px;
65
+ margin-bottom: 20px;
66
+ transition: transform 0.3s ease, box-shadow 0.3s ease;
67
+ }
68
+ .metrics-card:hover {
69
+ transform: translateY(-3px);
70
+ box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
71
+ border-top: 3px solid #3f51b5;
72
+ }
73
+ .card-title {
74
+ display: flex;
75
+ align-items: center;
76
+ font-size: 1.1rem;
77
+ font-weight: 600;
78
+ color: #37474f;
79
+ margin-bottom: 1.2rem;
80
+ }
81
+ .card-title i {
82
+ margin-right: 8px;
83
+ font-size: 1.3rem;
84
+ color: #8e44ad;
85
+ }
86
+ .metrics-card p {
87
+ font-size: 1rem;
88
+ margin-bottom: 0.8rem;
89
+ }
90
+ .badge {
91
+ font-size: 1rem;
92
+ font-weight: 600;
93
+ padding: 0.5rem 0.75rem;
94
+ border-radius: 0.5rem;
95
+ }
96
+ /* 表格样式 */
97
+ .key-balances-table {
98
+ width: 100%;
99
+ border-collapse: collapse;
100
+ margin-top: 20px;
101
+ border: 1px solid #e8e8e8;
102
+ border-radius: 8px;
103
+ overflow: hidden;
104
+ }
105
+ .key-balances-table th,
106
+ .key-balances-table td {
107
+ padding: 12px 15px;
108
+ text-align: left;
109
+ border-bottom: 1px solid #ecf0f1;
110
+ font-size: 0.95rem;
111
+ }
112
+ .key-balances-table thead {
113
+ background-color: #ecf0f1;
114
+ }
115
+ .key-balances-table th {
116
+ font-weight: 600;
117
+ text-transform: uppercase;
118
+ letter-spacing: 0.03em;
119
+ color: #2c3e50;
120
+ }
121
+ .key-balances-table tbody tr:nth-child(even) {
122
+ background-color: #f8f9fa;
123
+ }
124
+ .key-balances-table tbody tr:hover {
125
+ background-color: #f1f3f5;
126
+ }
127
+ .text-break {
128
+ word-break: break-word;
129
+ }
130
+ /* 页脚样式 */
131
+ .footer {
132
+ text-align: center;
133
+ padding: 20px 0;
134
+ font-size: 0.9rem;
135
+ color: #888;
136
+ border-top: 1px solid #eee;
137
+ margin-top: 40px;
138
+ }
139
+ .footer a {
140
+ color: #888;
141
+ text-decoration: none;
142
+ }
143
+ .footer a:hover {
144
+ color: #2c3e50;
145
+ }
146
+ /* 响应式调节 */
147
+ @media (max-width: 576px) {
148
+ h1 { font-size: 1.8rem; }
149
+ .card-title { font-size: 1rem; }
150
+ }
151
+ </style>
152
+ </head>
153
+ <body>
154
+ <div class="container mt-5">
155
+ <h1 class="text-center">AI API Dashboard</h1>
156
+ <p class="lead text-center">实时监控您的 API 代理服务状态</p>
157
+
158
+ <!-- 实时性能指标 -->
159
+ <section class="dashboard-section">
160
+ <h2><i class="bi bi-speedometer2"></i> 实时性能指标</h2>
161
+ <div class="row">
162
+ <div class="col-md-6 mb-4">
163
+ <div class="card metrics-card">
164
+ <div class="card-body">
165
+ <h5 class="card-title"><i class="bi bi-lightning-fill"></i> 请求速率</h5>
166
+ <p>每分钟请求数 (RPM): <span class="badge bg-primary">{{ rpm }}</span></p>
167
+ <p>每日请求数 (RPD): <span class="badge bg-secondary">{{ rpd }}</span></p>
168
+ </div>
169
+ </div>
170
+ </div>
171
+ <div class="col-md-6">
172
+ <div class="card metrics-card">
173
+ <div class="card-body">
174
+ <h5 class="card-title"><i class="bi bi-graph-up-arrow"></i> Token 使用量</h5>
175
+ <p>每分钟 Token 数 (TPM): <span class="badge bg-success">{{ tpm }}</span></p>
176
+ <p>每日 Token 数 (TPD): <span class="badge bg-info">{{ tpd }}</span></p>
177
+ </div>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </section>
182
+
183
+ <!-- API 密钥余额 -->
184
+ <section class="dashboard-section">
185
+ <h2><i class="bi bi-key-fill"></i> API 密钥余额</h2>
186
+ <div class="table-responsive">
187
+ <table class="table key-balances-table">
188
+ <thead>
189
+ <tr>
190
+ <th>API 密钥 (已打码)</th>
191
+ <th>余额</th>
192
+ </tr>
193
+ </thead>
194
+ <tbody>
195
+ {% for key_balance in key_balances %}
196
+ <tr>
197
+ <td class="text-break">{{ key_balance.key }}</td>
198
+ <td>{{ key_balance.balance }}</td>
199
+ </tr>
200
+ {% endfor %}
201
+ {% if not key_balances %}
202
+ <tr>
203
+ <td colspan="2">没有可用的 API 密钥信息。</td>
204
+ </tr>
205
+ {% endif %}
206
+ </tbody>
207
+ </table>
208
+ </div>
209
+ </section>
210
+
211
+ <div class="footer">
212
+ <p>Dashboard created at {{ now }} &middot; Powered by <a href="https://vercel.com" target="_blank" rel="noopener noreferrer">Vercel</a></p>
213
+ </div>
214
+ </div>
215
+
216
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
217
+ </body>
218
+ </html>