mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-05-11 18:09:55 +08:00
主要变更:
1. **API 请求重试机制:**
* 在配置 (`.env.example`, `config.py`, `constants.py`) 中添加 `MAX_RETRIES` 设置,用于控制 API 请求失败后的最大重试次数 (默认为 3)。
* 更新 `RetryHandler` (`retry_handler.py`) 以使用此配置。
* 将 `RetryHandler` 应用于 Gemini 和 OpenAI 的内容生成路由 (`gemini_routes.py`, `openai_routes.py`),使其能够根据配置进行重试。
* 在配置编辑器页面 (`config_editor.html`) 添加 `MAX_RETRIES` 的输入字段。
2. **密钥状态页面 (Keys Status) UI/UX 改进:**
* 默认隐藏 API 密钥的完整内容,仅显示部分字符 (`keys_status.html`),提高安全性。
* 添加了切换按钮和相应的 JavaScript (`keys_status.js`) 及 CSS (`keys_status.css`),允许用户点击查看或隐藏完整的密钥。
* 更新了“复制密钥”功能 (`keys_status.js`),确保复制的是完整的密钥而非掩码后的部分。
3. **错误日志页面 (Error Logs) 重构与改进:**
* 重构了 HTML 结构 (`error_logs.html`),使用更一致和语义化的 class(如 `config-section`, `controls-container`, `styled-table`, `status-indicator`),并移除了 Bootstrap 依赖。
* 更新了 CSS (`error_logs.css`) 以匹配新的 HTML 结构,改进了页面布局和视觉样式。
* 改进了 JavaScript (`error_logs.js`),优化了加载、无数据、错误状态的显示逻辑,改进了分页功能,并添加了通用的通知显示函数 (`showNotification`)。
* 在错误日志表格和详情弹窗中添加了“错误类型”列/字段。
4. **其他:**
* 对聊天服务 (`gemini_chat_service.py`, `openai_chat_service.py`) 和密钥管理器 (`key_manager.py`) 进行了相关更新
564 lines
11 KiB
CSS
564 lines
11 KiB
CSS
body {
|
|
font-family: 'Roboto', sans-serif;
|
|
line-height: 1.6;
|
|
margin: 0;
|
|
padding: 20px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.container {
|
|
max-width: 900px;
|
|
width: 95%;
|
|
background: rgba(255, 255, 255, 0.95);
|
|
padding: 40px;
|
|
border-radius: 20px;
|
|
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
|
|
backdrop-filter: blur(10px);
|
|
position: relative;
|
|
margin: 20px auto;
|
|
overflow-y: auto;
|
|
max-height: calc(100vh - 40px);
|
|
scrollbar-width: none;
|
|
-ms-overflow-style: none;
|
|
}
|
|
|
|
.container::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
h1 {
|
|
color: #2c3e50;
|
|
text-align: center;
|
|
margin-bottom: 15px;
|
|
font-weight: 700;
|
|
font-size: 32px;
|
|
position: relative;
|
|
padding-bottom: 15px;
|
|
}
|
|
|
|
h1::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
width: 100px;
|
|
height: 4px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
/* 导航标签样式 */
|
|
.nav-tabs {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-bottom: 30px;
|
|
border-bottom: 2px solid rgba(0,0,0,0.1);
|
|
padding-bottom: 10px;
|
|
width: 100%;
|
|
max-width: 500px;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
}
|
|
|
|
.tab-link {
|
|
color: #2c3e50;
|
|
text-decoration: none;
|
|
padding: 12px 25px;
|
|
border-radius: 8px 8px 0 0;
|
|
font-weight: bold;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
position: relative;
|
|
margin: 0 5px;
|
|
flex: 1;
|
|
text-align: center;
|
|
}
|
|
|
|
.tab-link:hover {
|
|
background: rgba(102, 126, 234, 0.1);
|
|
}
|
|
|
|
.tab-link.active {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3);
|
|
}
|
|
|
|
.tab-link.active::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -12px;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 4px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
.tab-link i {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.key-list {
|
|
margin-bottom: 30px;
|
|
background: rgba(248, 249, 250, 0.9);
|
|
padding: 25px;
|
|
border-radius: 15px;
|
|
transition: all 0.3s ease;
|
|
border: 1px solid rgba(0,0,0,0.1);
|
|
animation: fadeIn 0.5s ease forwards;
|
|
}
|
|
|
|
.key-list:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.key-list:nth-child(2) {
|
|
animation-delay: 0.2s;
|
|
}
|
|
|
|
.key-list h2 {
|
|
color: #2c3e50;
|
|
margin-bottom: 20px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-size: 1.5em;
|
|
padding-bottom: 10px;
|
|
border-bottom: 2px solid rgba(0,0,0,0.1);
|
|
cursor: pointer;
|
|
}
|
|
|
|
.key-list h2 .toggle-icon {
|
|
margin-right: 10px;
|
|
transition: transform 0.3s ease;
|
|
}
|
|
|
|
.key-list h2 .toggle-icon.collapsed {
|
|
transform: rotate(-90deg);
|
|
}
|
|
|
|
.key-list .key-content {
|
|
transition: all 0.3s ease-out;
|
|
overflow: hidden;
|
|
height: auto;
|
|
opacity: 1;
|
|
}
|
|
|
|
.key-list .key-content.collapsed {
|
|
height: 0;
|
|
opacity: 0;
|
|
padding-top: 0;
|
|
padding-bottom: 0;
|
|
}
|
|
|
|
ul {
|
|
list-style-type: none;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
|
|
li {
|
|
background: white;
|
|
border: 1px solid rgba(0,0,0,0.1);
|
|
margin-bottom: 12px;
|
|
padding: 15px;
|
|
border-radius: 10px;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
|
|
}
|
|
|
|
li:hover {
|
|
transform: translateX(5px);
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.key-info {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
flex: 1; /* Allow key-info to take up available space */
|
|
min-width: 0; /* Prevent flex item from overflowing */
|
|
}
|
|
|
|
.key-text {
|
|
font-family: 'Roboto Mono', monospace;
|
|
color: #2c3e50;
|
|
word-break: break-all; /* Ensure long keys wrap */
|
|
flex-shrink: 1; /* Allow key text to shrink if needed */
|
|
margin-right: 10px; /* Add space between key text and toggle button */
|
|
}
|
|
|
|
.fail-count {
|
|
background: rgba(231, 76, 60, 0.1);
|
|
color: #e74c3c;
|
|
padding: 4px 10px;
|
|
border-radius: 15px;
|
|
font-size: 0.85em;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 5px;
|
|
}
|
|
|
|
.fail-count i {
|
|
font-size: 12px;
|
|
}
|
|
|
|
.key-actions {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
}
|
|
|
|
.verify-btn, .copy-btn {
|
|
color: white;
|
|
border: none;
|
|
padding: 8px 15px;
|
|
border-radius: 30px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
font-weight: bold;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 5px;
|
|
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.verify-btn {
|
|
background: linear-gradient(135deg, #2ecc71, #27ae60);
|
|
}
|
|
|
|
.verify-btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
|
|
}
|
|
|
|
.verify-btn:disabled {
|
|
opacity: 0.7;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.verify-btn i {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.copy-btn {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
}
|
|
|
|
.copy-btn:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3);
|
|
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
|
|
}
|
|
|
|
.copy-btn:active {
|
|
transform: translateY(1px);
|
|
box-shadow: 0 5px 10px rgba(118, 75, 162, 0.2);
|
|
}
|
|
|
|
.copy-btn i {
|
|
font-size: 14px;
|
|
}
|
|
|
|
.total {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 15px 25px;
|
|
border-radius: 10px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
font-size: 1.2em;
|
|
margin-top: 30px;
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
#copyStatus {
|
|
position: fixed;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
padding: 15px 30px;
|
|
border-radius: 25px;
|
|
font-weight: bold;
|
|
opacity: 0;
|
|
transition: all 0.3s ease;
|
|
backdrop-filter: blur(5px);
|
|
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
|
z-index: 1000;
|
|
text-align: center;
|
|
min-width: 200px;
|
|
color: white;
|
|
}
|
|
|
|
#copyStatus.success {
|
|
background: rgba(39, 174, 96, 0.95);
|
|
}
|
|
|
|
#copyStatus.error {
|
|
background: rgba(231, 76, 60, 0.95);
|
|
}
|
|
|
|
.status-badge {
|
|
padding: 4px 12px;
|
|
border-radius: 15px;
|
|
font-size: 0.9em;
|
|
font-weight: bold;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.status-valid {
|
|
background: rgba(39, 174, 96, 0.1);
|
|
color: #27ae60;
|
|
}
|
|
|
|
.status-invalid {
|
|
background: rgba(231, 76, 60, 0.1);
|
|
color: #e74c3c;
|
|
}
|
|
|
|
.scroll-buttons {
|
|
position: fixed;
|
|
right: 20px;
|
|
bottom: 20px;
|
|
display: none;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.scroll-btn {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
width: 40px;
|
|
height: 40px;
|
|
border: none;
|
|
border-radius: 50%;
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 20px;
|
|
transition: all 0.3s ease;
|
|
backdrop-filter: blur(5px);
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
|
|
}
|
|
|
|
.scroll-btn:hover {
|
|
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
|
|
transform: scale(1.1);
|
|
}
|
|
|
|
.scroll-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.refresh-btn {
|
|
position: fixed;
|
|
top: 20px;
|
|
right: 20px;
|
|
z-index: 1000;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: #fff;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 25px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
font-weight: bold;
|
|
transition: all 0.3s ease;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.refresh-btn:hover {
|
|
transform: scale(1.05);
|
|
box-shadow: 0 8px 20px rgba(118, 75, 162, 0.3);
|
|
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
|
|
}
|
|
|
|
.refresh-btn:active {
|
|
transform: scale(0.95);
|
|
}
|
|
|
|
.refresh-btn i {
|
|
transition: transform 0.5s ease;
|
|
}
|
|
|
|
.refresh-btn.loading i {
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
.copyright {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
background: rgba(255, 255, 255, 0.9);
|
|
padding: 10px 0;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
color: #2c3e50;
|
|
backdrop-filter: blur(5px);
|
|
border-top: 1px solid rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.copyright a {
|
|
color: #764ba2;
|
|
text-decoration: none;
|
|
transition: color 0.3s ease;
|
|
}
|
|
|
|
.copyright a:hover {
|
|
color: #667eea;
|
|
}
|
|
|
|
.copyright img {
|
|
width: 20px;
|
|
height: 20px;
|
|
border-radius: 50%;
|
|
vertical-align: middle;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(20px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
|
|
@keyframes spin {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Toggle Visibility Button Styles */
|
|
.toggle-vis-btn {
|
|
background: none;
|
|
border: none;
|
|
color: #7f8c8d; /* Subtle color */
|
|
cursor: pointer;
|
|
padding: 5px;
|
|
font-size: 16px;
|
|
transition: color 0.3s ease;
|
|
margin-left: 5px; /* Space from key text */
|
|
flex-shrink: 0; /* Prevent button from shrinking */
|
|
}
|
|
|
|
.toggle-vis-btn:hover {
|
|
color: #34495e; /* Darker color on hover */
|
|
}
|
|
|
|
.toggle-vis-btn i {
|
|
vertical-align: middle;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.container {
|
|
width: 100%;
|
|
padding: 20px;
|
|
margin: 10px auto;
|
|
}
|
|
body {
|
|
padding: 10px;
|
|
}
|
|
h1 {
|
|
font-size: 24px;
|
|
}
|
|
.nav-tabs {
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
.tab-link {
|
|
width: 100%;
|
|
justify-content: center;
|
|
border-radius: 8px;
|
|
}
|
|
.tab-link.active::after {
|
|
display: none;
|
|
}
|
|
.key-list h2 {
|
|
font-size: 1.2em;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
align-items: flex-start;
|
|
}
|
|
.key-info {
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
gap: 8px;
|
|
width: 100%; /* Ensure key-info takes full width */
|
|
}
|
|
li {
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
}
|
|
.key-actions {
|
|
width: 100%;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.verify-btn, .copy-btn {
|
|
width: 100%;
|
|
justify-content: center;
|
|
}
|
|
.key-text {
|
|
/* word-break: break-all; */ /* Already applied above */
|
|
margin-right: 0; /* Remove right margin on smaller screens */
|
|
}
|
|
.scroll-buttons {
|
|
right: 10px;
|
|
bottom: 10px;
|
|
}
|
|
.scroll-btn {
|
|
width: 35px;
|
|
height: 35px;
|
|
font-size: 16px;
|
|
}
|
|
.refresh-btn {
|
|
top: 10px;
|
|
right: 10px;
|
|
padding: 8px 16px;
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
.container {
|
|
padding: 15px;
|
|
}
|
|
h1 {
|
|
font-size: 20px;
|
|
}
|
|
.key-list {
|
|
padding: 15px;
|
|
}
|
|
.status-badge {
|
|
padding: 3px 8px;
|
|
font-size: 0.8em;
|
|
}
|
|
.fail-count {
|
|
font-size: 0.8em;
|
|
}
|
|
.total {
|
|
font-size: 1em;
|
|
padding: 12px 20px;
|
|
}
|
|
}
|