xiaoyukkkk commited on
Commit
cbb6522
·
verified ·
1 Parent(s): b197a12

Upload 2 files

Browse files
templates/components/account_table.html ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# 账户表格组件 #}
2
+ {% macro account_table(accounts_data) %}
3
+ <table class="account-table">
4
+ <thead>
5
+ <tr>
6
+ <th>账号ID</th>
7
+ <th>状态</th>
8
+ <th>过期时间</th>
9
+ <th>剩余时长</th>
10
+ <th>累计对话</th>
11
+ <th style="text-align: center;">操作</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ {% if accounts_data %}
16
+ {% for account in accounts_data %}
17
+ <tr style="opacity: {{ account.row_opacity }};">
18
+ <td data-label="账号ID">
19
+ <div style="display: flex; align-items: center; gap: 8px;">
20
+ <span class="status-dot" style="background-color: {{ account.dot_color }};"></span>
21
+ <span style="font-weight: 600;">{{ account.account_id }}</span>
22
+ </div>
23
+ </td>
24
+ <td data-label="状态">
25
+ <span style="color: {{ account.status_color }}; font-weight: 600; font-size: 12px;">{{ account.status_text }}</span>
26
+ </td>
27
+ <td data-label="过期时间">
28
+ <span class="font-mono" style="font-size: 11px; color: #6b6b6b;">{{ account.expires_at or '未设置' }}</span>
29
+ </td>
30
+ <td data-label="剩余时长">
31
+ <span style="color: {{ account.status_color }}; font-weight: 500; font-size: 12px;">{{ account.expire_display }}</span>
32
+ </td>
33
+ <td data-label="累计对话">
34
+ <span style="color: #2563eb; font-weight: 600;">{{ account.conversation_count }}</span>
35
+ </td>
36
+ <td data-label="操作">
37
+ <div style="display: flex; gap: 6px;">
38
+ {% if account.is_expired %}
39
+ <button onclick="deleteAccount('{{ account.account_id }}')" class="btn-sm btn-delete" title="删除">删除</button>
40
+ {% elif account.is_disabled or account.is_permanently_failed %}
41
+ <button onclick="enableAccount('{{ account.account_id }}')" class="btn-sm btn-enable" title="启用">启用</button>
42
+ <button onclick="deleteAccount('{{ account.account_id }}')" class="btn-sm btn-delete" title="删除">删除</button>
43
+ {% else %}
44
+ <button onclick="disableAccount('{{ account.account_id }}')" class="btn-sm btn-disable" title="禁用">禁用</button>
45
+ <button onclick="deleteAccount('{{ account.account_id }}')" class="btn-sm btn-delete" title="删除">删除</button>
46
+ {% endif %}
47
+ </div>
48
+ </td>
49
+ </tr>
50
+ {% endfor %}
51
+ {% else %}
52
+ <tr>
53
+ <td colspan="6" style="text-align: center; color: #6b6b6b; padding: 24px;">暂无账户</td>
54
+ </tr>
55
+ {% endif %}
56
+ </tbody>
57
+ </table>
58
+ {% endmacro %}
templates/components/alerts.html CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# API 密钥状态提示 #}
2
+ {% macro api_key_status(has_api_key) %}
3
+ {% if has_api_key %}
4
+ <div class="alert alert-success">
5
+ <div class="alert-icon">🔒</div>
6
+ <div class="alert-content">
7
+ <strong>API 安全模式已启用</strong>
8
+ <div class="alert-desc">API 端点需要携带 Authorization 密钥才能访问。</div>
9
+ </div>
10
+ </div>
11
+ {% else %}
12
+ <div class="alert alert-warning">
13
+ <div class="alert-icon">⚠️</div>
14
+ <div class="alert-content">
15
+ <strong>API 密钥未设置</strong>
16
+ <div class="alert-desc">API 端点当前允许公开访问。建议在 .env 文件中配置 <code>API_KEY</code> 环境变量以提升安全性。</div>
17
+ </div>
18
+ </div>
19
+ {% endif %}
20
+ {% endmacro %}
21
+
22
+ {# 错误日志提示 #}
23
+ {% macro error_alert(error_count) %}
24
+ {% if error_count > 0 %}
25
+ <div class="alert alert-error">
26
+ <div class="alert-icon">🚨</div>
27
+ <div class="alert-content">
28
+ <strong>检测到 {{ error_count }} 条错误日志</strong>
29
+ <a href="/public/log/html" class="alert-link">查看详情 &rarr;</a>
30
+ </div>
31
+ </div>
32
+ {% endif %}
33
+ {% endmacro %}