fix: dashboard null crash, chat layout, markdown escaping, gzip, gateway banner delay

feat: hosted agent with auto-stop, context compression, visual sliders
feat: auto-reload gateway after config save (debounced 3s)
style: toast solid bg, chat input enlargement, hosted agent panel CSS
chore: fix dev.ps1 encoding, engagement share text
This commit is contained in:
晴天
2026-03-18 15:02:04 +08:00
parent 08031b9dca
commit 7764a32799
11 changed files with 757 additions and 41 deletions

View File

@@ -10,6 +10,8 @@
height: 100%;
overflow: hidden;
padding: 0 !important;
max-width: none !important;
width: 100%;
}
.chat-main {
@@ -376,7 +378,8 @@
color: var(--text-primary);
outline: none;
transition: border-color 0.15s;
max-height: 150px;
min-height: 44px;
max-height: 200px;
font-family: inherit;
}
@@ -996,3 +999,176 @@
padding: 6px;
}
}
/* 托管 Agent */
.chat-hosted-btn {
display: flex;
align-items: center;
gap: 4px;
height: 40px;
border-radius: var(--radius-md, 8px);
padding: 0 10px;
border: 1px solid var(--border);
background: var(--bg-secondary, var(--bg-card));
cursor: pointer;
flex-shrink: 0;
transition: background 0.15s, border-color 0.15s;
}
.chat-hosted-btn:hover {
background: var(--bg-hover);
border-color: var(--border-primary);
}
.chat-hosted-label { font-weight: 600; font-size: 14px; }
.chat-hosted-badge {
font-size: 11px;
padding: 2px 6px;
border-radius: 4px;
font-weight: 500;
}
.chat-hosted-badge.running { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.chat-hosted-badge.waiting { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.chat-hosted-badge.paused { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.chat-hosted-badge.error { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.chat-hosted-badge.idle { background: rgba(100, 116, 139, 0.12); color: #94a3b8; }
.hosted-agent-panel {
position: absolute;
right: 16px;
bottom: 80px;
width: 340px;
background: var(--bg-secondary, #fff);
border: 1px solid var(--border);
border-radius: 12px;
box-shadow: 0 8px 32px rgba(0,0,0,0.18);
z-index: 30;
overflow: hidden;
}
.hosted-agent-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px;
border-bottom: 1px solid var(--border);
font-size: 14px;
}
.hosted-agent-close {
background: none;
border: none;
font-size: 18px;
cursor: pointer;
color: var(--text-secondary);
padding: 4px 8px;
border-radius: 4px;
}
.hosted-agent-close:hover { background: var(--bg-hover); }
.hosted-agent-body {
padding: 12px;
display: flex;
flex-direction: column;
gap: 10px;
max-height: 480px;
overflow-y: auto;
flex: 1;
min-height: 0;
}
.hosted-agent-prompt { min-height: 72px; resize: vertical; }
.hosted-agent-switch {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 0;
font-size: 13px;
cursor: pointer;
}
.hosted-agent-switch input { display: none; }
.hosted-agent-track {
width: 34px;
height: 18px;
border-radius: 9px;
background: var(--bg-tertiary);
position: relative;
transition: background 0.2s;
flex-shrink: 0;
}
.hosted-agent-track::after {
content: '';
position: absolute;
width: 14px;
height: 14px;
border-radius: 50%;
background: #fff;
top: 2px;
left: 2px;
transition: transform 0.2s;
}
.hosted-agent-switch input:checked + .hosted-agent-track { background: var(--accent); }
.hosted-agent-switch input:checked + .hosted-agent-track::after { transform: translateX(16px); }
.hosted-agent-row {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
padding: 2px 0;
}
.hosted-agent-tag { color: var(--text-tertiary); }
.hosted-agent-value { color: var(--text-secondary); font-weight: 500; }
.hosted-agent-advanced {
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: 8px 10px;
}
.hosted-agent-advanced-title {
font-size: 11px;
color: var(--text-tertiary);
margin-bottom: 6px;
text-transform: uppercase;
letter-spacing: 0.3px;
}
/* 滑块控件 */
.ha-slider-group { padding: 4px 0; }
.ha-slider-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; }
.ha-slider-val { font-weight: 700; color: var(--accent); font-size: 14px; }
.ha-slider { width: 100%; height: 6px; -webkit-appearance: none; appearance: none; background: var(--bg-tertiary); border-radius: 3px; outline: none; cursor: pointer; }
.ha-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
.ha-slider:disabled { opacity: 0.4; cursor: not-allowed; }
.ha-slider-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-tertiary); margin-top: 2px; }
/* 定时器 */
.ha-timer-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ha-timer-header { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.ha-toggle { display: inline-flex; cursor: pointer; }
.ha-toggle input { display: none; }
.ha-toggle-track { width: 34px; height: 18px; border-radius: 9px; background: var(--bg-tertiary); position: relative; transition: background 0.2s; }
.ha-toggle-track::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform 0.2s; }
.ha-toggle input:checked + .ha-toggle-track { background: var(--accent); }
.ha-toggle input:checked + .ha-toggle-track::after { transform: translateX(16px); }
.ha-timer-body { margin-top: 8px; }
/* 倒计时 */
.ha-countdown { margin-top: 8px; }
.ha-countdown-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.ha-countdown-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success, #22c55e)); border-radius: 3px; transition: width 1s linear; }
.ha-countdown-text { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; display: block; text-align: right; }
.hosted-agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hosted-agent-actions {
display: flex;
gap: 6px;
padding: 10px 12px;
border-top: 1px solid var(--border);
flex-shrink: 0;
justify-content: center;
}
.hosted-agent-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.hosted-agent-link:hover { text-decoration: underline; }
.hosted-agent-footer {
padding: 8px 12px;
border-top: 1px solid var(--border);
font-size: 11px;
color: var(--text-tertiary);
}
.msg-hosted {
background: rgba(100, 116, 139, 0.08);
border: 1px dashed rgba(148, 163, 184, 0.4);
border-radius: 8px;
padding: 6px 10px;
font-size: 12px;
line-height: 1.5;
}

View File

@@ -187,15 +187,21 @@
padding: var(--space-md) var(--space-lg);
border-radius: var(--radius-md);
font-size: var(--font-size-sm);
backdrop-filter: blur(12px);
background: var(--bg-primary);
border: 1px solid var(--border);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
animation: slideIn 250ms ease;
max-width: 360px;
}
.toast.success { background: var(--success-muted); border: 1px solid rgba(34,197,94,0.3); color: var(--success); }
.toast.error { background: var(--error-muted); border: 1px solid rgba(239,68,68,0.3); color: var(--error); }
.toast.info { background: var(--info-muted); border: 1px solid rgba(59,130,246,0.3); color: var(--info); }
.toast.warning { background: var(--warning-muted); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }
.toast.success { color: var(--success); }
.toast.error { color: var(--error); }
.toast.info { color: var(--info); }
.toast.warning { color: var(--warning); }
[data-theme="dark"] .toast {
background: var(--bg-secondary);
}
@keyframes slideIn {
from { opacity: 0; transform: translateX(20px); }