luoyutianyang commited on
Commit
3b36a2a
·
verified ·
1 Parent(s): 51cb1cc

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +29 -1
index.html CHANGED
@@ -17,5 +17,33 @@
17
  </head>
18
  <body>
19
  <h1>Face Replacement</h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  </body>
21
- </html>
 
17
  </head>
18
  <body>
19
  <h1>Face Replacement</h1>
20
+ <h2>API 请求统计</h2>
21
+ <table id="api-stats">
22
+ <thead>
23
+ <tr>
24
+ <th>API 名称</th>
25
+ <th>今日请求次数</th>
26
+ </tr>
27
+ </thead>
28
+ <tbody>
29
+ <!-- 动态填充数据 -->
30
+ </tbody>
31
+ </table>
32
+ <script>
33
+ async function fetchApiStats() {
34
+ const response = await fetch('/api-stats');
35
+ const stats = await response.json();
36
+ const tbody = document.querySelector('#api-stats tbody');
37
+ tbody.innerHTML = '';
38
+ for (const [apiName, count] of Object.entries(stats)) {
39
+ const row = document.createElement('tr');
40
+ row.innerHTML = `<td>${apiName}</td><td>${count}</td>`;
41
+ tbody.appendChild(row);
42
+ }
43
+ }
44
+
45
+ fetchApiStats();
46
+ setInterval(fetchApiStats, 60000); // 每分钟刷新一次
47
+ </script>
48
  </body>
49
+ </html>