Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- core/templates.py +43 -0
core/templates.py
CHANGED
|
@@ -73,6 +73,47 @@ def generate_admin_html(request: Request, multi_account_mgr, show_hide_tip: bool
|
|
| 73 |
</div>
|
| 74 |
"""
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# --- 2. 构建账户卡片 ---
|
| 77 |
accounts_html = ""
|
| 78 |
for account_id, account_manager in multi_account_mgr.accounts.items():
|
|
@@ -272,6 +313,7 @@ def generate_admin_html(request: Request, multi_account_mgr, show_hide_tip: bool
|
|
| 272 |
.alert-success {{ background: #eafbf0; border-color: #d3f3dd; color: #15682e; }}
|
| 273 |
.alert-warning {{ background: #fff8e6; border-color: #fcebc2; color: #9c6e03; }}
|
| 274 |
.alert-error {{ background: #ffebeb; border-color: #fddddd; color: #c41e1e; }}
|
|
|
|
| 275 |
|
| 276 |
/* Sections & Grids */
|
| 277 |
.section {{ margin-bottom: 30px; }}
|
|
@@ -581,6 +623,7 @@ def generate_admin_html(request: Request, multi_account_mgr, show_hide_tip: bool
|
|
| 581 |
{hide_tip}
|
| 582 |
{api_key_status}
|
| 583 |
{error_alert}
|
|
|
|
| 584 |
|
| 585 |
<div class="section">
|
| 586 |
<div class="section-title">账户状态 ({len(multi_account_mgr.accounts)} 个)</div>
|
|
|
|
| 73 |
</div>
|
| 74 |
"""
|
| 75 |
|
| 76 |
+
# API接口信息提示
|
| 77 |
+
api_endpoint = f"{current_url}/{main.PATH_PREFIX}/v1/chat/completions"
|
| 78 |
+
api_key_display = main.API_KEY if main.API_KEY else '<span style="color: #ff9500;">未设置(公开访问)</span>'
|
| 79 |
+
|
| 80 |
+
api_info_tip = f"""
|
| 81 |
+
<div class="alert alert-primary">
|
| 82 |
+
<div class="alert-icon">🔗</div>
|
| 83 |
+
<div class="alert-content">
|
| 84 |
+
<strong>API 接口信息</strong>
|
| 85 |
+
<div style="margin-top: 10px;">
|
| 86 |
+
<div style="margin-bottom: 12px;">
|
| 87 |
+
<div style="color: #86868b; font-size: 11px; margin-bottom: 4px;">聊天接口</div>
|
| 88 |
+
<code style="font-size: 11px; background: rgba(0,0,0,0.05); padding: 4px 8px; border-radius: 4px; display: inline-block; word-break: break-all;">{api_endpoint}</code>
|
| 89 |
+
</div>
|
| 90 |
+
<div style="margin-bottom: 12px;">
|
| 91 |
+
<div style="color: #86868b; font-size: 11px; margin-bottom: 4px;">API 密钥</div>
|
| 92 |
+
<code style="font-size: 11px; background: rgba(0,0,0,0.05); padding: 4px 8px; border-radius: 4px; display: inline-block;">{api_key_display}</code>
|
| 93 |
+
</div>
|
| 94 |
+
<div style="margin-bottom: 12px;">
|
| 95 |
+
<div style="color: #86868b; font-size: 11px; margin-bottom: 6px;">支持的模型</div>
|
| 96 |
+
<div style="display: flex; flex-wrap: wrap; gap: 6px;">
|
| 97 |
+
<span style="background: #f0f0f2; color: #1d1d1f; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;">gemini-auto</span>
|
| 98 |
+
<span style="background: #f0f0f2; color: #1d1d1f; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;">gemini-2.5-flash</span>
|
| 99 |
+
<span style="background: #f0f0f2; color: #1d1d1f; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;">gemini-2.5-pro</span>
|
| 100 |
+
<span style="background: #f0f0f2; color: #1d1d1f; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;">gemini-3-flash-preview</span>
|
| 101 |
+
<span style="background: #eef7ff; color: #0071e3; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: 'SF Mono', SFMono-Regular, Consolas, monospace; border: 1px solid #dcebfb; font-weight: 500;">gemini-3-pro-preview</span>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
<div style="background: rgba(0,0,0,0.03); padding: 10px; border-radius: 6px;">
|
| 105 |
+
<div style="font-size: 11px; color: #1d1d1f; margin-bottom: 4px; font-weight: 600;">📸 图片生成说明</div>
|
| 106 |
+
<div style="font-size: 11px; color: #86868b; line-height: 1.6;">
|
| 107 |
+
• 仅 <code style="font-size: 10px; background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 3px;">gemini-3-pro-preview</code> 支持绘图<br>
|
| 108 |
+
• 存储路径:<code style="font-size: 10px; background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 3px;">./images</code><br>
|
| 109 |
+
• 存储类型:临时(服务重启后丢失)
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
"""
|
| 116 |
+
|
| 117 |
# --- 2. 构建账户卡片 ---
|
| 118 |
accounts_html = ""
|
| 119 |
for account_id, account_manager in multi_account_mgr.accounts.items():
|
|
|
|
| 313 |
.alert-success {{ background: #eafbf0; border-color: #d3f3dd; color: #15682e; }}
|
| 314 |
.alert-warning {{ background: #fff8e6; border-color: #fcebc2; color: #9c6e03; }}
|
| 315 |
.alert-error {{ background: #ffebeb; border-color: #fddddd; color: #c41e1e; }}
|
| 316 |
+
.alert-primary {{ background: #f9fafb; border-color: #e5e7eb; color: #374151; }}
|
| 317 |
|
| 318 |
/* Sections & Grids */
|
| 319 |
.section {{ margin-bottom: 30px; }}
|
|
|
|
| 623 |
{hide_tip}
|
| 624 |
{api_key_status}
|
| 625 |
{error_alert}
|
| 626 |
+
{api_info_tip}
|
| 627 |
|
| 628 |
<div class="section">
|
| 629 |
<div class="section-title">账户状态 ({len(multi_account_mgr.accounts)} 个)</div>
|