Spaces:
Running
Running
| {# API 密钥状态提示 #} | |
| {% macro api_key_status(has_api_key) %} | |
| {% if has_api_key %} | |
| <div class="alert alert-success"> | |
| <div class="alert-icon">🔒</div> | |
| <div class="alert-content"> | |
| <strong>API 安全模式已启用</strong> | |
| <div class="alert-desc">API 端点需要携带 Authorization 密钥才能访问。</div> | |
| </div> | |
| </div> | |
| {% else %} | |
| <div class="alert alert-warning"> | |
| <div class="alert-icon">⚠️</div> | |
| <div class="alert-content"> | |
| <strong>API 密钥未设置</strong> | |
| <div class="alert-desc">API 端点当前允许公开访问。建议在 .env 文件中配置 <code>API_KEY</code> 环境变量以提升安全性。</div> | |
| </div> | |
| </div> | |
| {% endif %} | |
| {% endmacro %} | |
| {# 错误日志提示 #} | |
| {% macro error_alert(error_count, admin_path_segment) %} | |
| {% if error_count > 0 %} | |
| <div class="alert alert-error" id="error-alert"> | |
| <div class="alert-icon">🚨</div> | |
| <div class="alert-content"> | |
| <strong>检测到 {{ error_count }} 条错误日志</strong> | |
| <a href="/{{ admin_path_segment }}/log/html" class="alert-link" target="_blank">查看详情 →</a> | |
| <div class="alert-desc">建议及时查看并处理错误日志,确保系统正常运行</div> | |
| </div> | |
| <button class="alert-close" onclick="document.getElementById('error-alert').style.display='none'" title="关闭">×</button> | |
| </div> | |
| {% endif %} | |
| {% endmacro %} | |
| {# 无账户提示 #} | |
| {% macro no_accounts_alert() %} | |
| <div class="alert alert-info"> | |
| <div class="alert-icon">💡</div> | |
| <div class="alert-content"> | |
| <strong>暂无账户配置</strong> | |
| <div class="alert-desc" style="margin-top: 8px; line-height: 1.6;"> | |
| 请添加 Gemini Business 账户以开始使用 API 服务。支持以下方式:<br> | |
| <strong style="margin-top: 6px; display: inline-block;">1. 使用浏览器脚本自动提取</strong> - 安装 <code style="font-size: 11px;">script/copy-config.js</code> 或 <code style="font-size: 11px;">script/download-config.js</code> 到 Tampermonkey,访问 Gemini Business 页面自动提取配置<br> | |
| <strong>2. 批量上传</strong> - 点击上方"📥 批量上传"按钮,上传 JSON 配置文件<br> | |
| <strong>3. 手动编辑</strong> - 点击上方"✏️ 编辑配置"按钮,直接编辑 JSON 配置 | |
| </div> | |
| </div> | |
| </div> | |
| {% endmacro %} | |