- 新增 useObservationMode Hook:定时 5s 采帧,similarity < 0.85 触发变化回调 - useVisionSession 新增 dialogue/observation 模式切换 - App Footer 加观察模式切换按钮(激活时蓝色脉冲) - 视频区左上角显示'👁️ 观察中'绿色角标 - 观察模式下画面变化自动发送 query Co-Authored-By: Claude <noreply@anthropic.com>
486 lines
8.2 KiB
CSS
486 lines
8.2 KiB
CSS
/* ============================================================
|
|
CamTalk — 主应用样式
|
|
============================================================ */
|
|
|
|
:root {
|
|
--color-primary: #2563eb;
|
|
--color-primary-hover: #1d4ed8;
|
|
--color-bg: #0f172a;
|
|
--color-surface: #1e293b;
|
|
--color-text: #f1f5f9;
|
|
--color-text-muted: #94a3b8;
|
|
--color-border: #334155;
|
|
--color-success: #22c55e;
|
|
--color-warning: #f59e0b;
|
|
--color-error: #ef4444;
|
|
--radius: 8px;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
background: var(--color-bg);
|
|
color: var(--color-text);
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.app {
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 100vh;
|
|
max-width: 900px;
|
|
margin: 0 auto;
|
|
padding: 0 16px;
|
|
}
|
|
|
|
/* ---- Header ---- */
|
|
|
|
.app-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 16px 0;
|
|
border-bottom: 1px solid var(--color-border);
|
|
}
|
|
|
|
.app-header h1 {
|
|
font-size: 1.5rem;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.header-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.btn-icon {
|
|
background: none;
|
|
border: none;
|
|
font-size: 1.2rem;
|
|
cursor: pointer;
|
|
padding: 4px;
|
|
border-radius: 4px;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.btn-icon:hover {
|
|
background: var(--color-surface);
|
|
}
|
|
|
|
.status {
|
|
font-size: 0.85rem;
|
|
padding: 4px 12px;
|
|
border-radius: 12px;
|
|
background: var(--color-surface);
|
|
}
|
|
|
|
.status--connected {
|
|
color: var(--color-success);
|
|
border: 1px solid var(--color-success);
|
|
}
|
|
|
|
.status--connecting {
|
|
color: var(--color-warning);
|
|
border: 1px solid var(--color-warning);
|
|
}
|
|
|
|
.status--disconnected {
|
|
color: var(--color-text-muted);
|
|
border: 1px solid var(--color-border);
|
|
}
|
|
|
|
/* ---- Main ---- */
|
|
|
|
.app-main {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
padding: 16px 0;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.video-section {
|
|
position: relative;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.vad-indicator {
|
|
position: absolute;
|
|
bottom: 12px;
|
|
left: 12px;
|
|
background: rgba(0, 0, 0, 0.7);
|
|
color: var(--color-success);
|
|
padding: 6px 12px;
|
|
border-radius: var(--radius);
|
|
font-size: 0.85rem;
|
|
animation: pulse 1.5s ease-in-out infinite;
|
|
}
|
|
|
|
.vad-indicator--loading {
|
|
color: var(--color-warning);
|
|
}
|
|
|
|
.vad-indicator--error {
|
|
color: var(--color-error);
|
|
animation: none;
|
|
}
|
|
|
|
.vad-indicator--audio {
|
|
left: auto;
|
|
right: 12px;
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
@keyframes pulse {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0.6; }
|
|
}
|
|
|
|
.chat-section {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
/* ---- Video Preview ---- */
|
|
|
|
.video-preview {
|
|
position: relative;
|
|
width: 100%;
|
|
aspect-ratio: 4 / 3;
|
|
background: var(--color-surface);
|
|
border-radius: var(--radius);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.video-preview__video {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.video-preview__placeholder {
|
|
position: absolute;
|
|
inset: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--color-text-muted);
|
|
}
|
|
|
|
/* ---- Chat Panel ---- */
|
|
|
|
.chat-panel {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 12px;
|
|
overflow-y: auto;
|
|
flex: 1;
|
|
}
|
|
|
|
.chat-panel--empty {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 48px 0;
|
|
color: var(--color-text-muted);
|
|
}
|
|
|
|
.chat-message {
|
|
padding: 12px 16px;
|
|
border-radius: var(--radius);
|
|
background: var(--color-surface);
|
|
}
|
|
|
|
.chat-message--user {
|
|
border-left: 3px solid var(--color-primary);
|
|
}
|
|
|
|
.chat-message--assistant {
|
|
border-left: 3px solid var(--color-success);
|
|
}
|
|
|
|
.chat-message--streaming {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.chat-message__role {
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
color: var(--color-text-muted);
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.chat-message__content {
|
|
font-size: 0.95rem;
|
|
line-height: 1.5;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
/* ---- Footer ---- */
|
|
|
|
.app-footer {
|
|
display: flex;
|
|
gap: 12px;
|
|
justify-content: center;
|
|
padding: 16px 0;
|
|
border-top: 1px solid var(--color-border);
|
|
}
|
|
|
|
/* ---- Stats Bar ---- */
|
|
|
|
.stats-bar {
|
|
text-align: center;
|
|
padding: 4px 0;
|
|
font-size: 0.75rem;
|
|
color: var(--color-text-muted);
|
|
border-top: 1px solid var(--color-border);
|
|
}
|
|
|
|
/* ---- Buttons ---- */
|
|
|
|
.btn {
|
|
padding: 10px 24px;
|
|
border: none;
|
|
border-radius: var(--radius);
|
|
font-size: 0.95rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.btn--primary {
|
|
background: var(--color-primary);
|
|
color: white;
|
|
}
|
|
|
|
.btn--primary:hover {
|
|
background: var(--color-primary-hover);
|
|
}
|
|
|
|
.btn--secondary {
|
|
background: var(--color-surface);
|
|
color: var(--color-text);
|
|
border: 1px solid var(--color-border);
|
|
}
|
|
|
|
.btn--secondary:hover {
|
|
background: var(--color-border);
|
|
}
|
|
|
|
.btn--warning {
|
|
background: var(--color-warning);
|
|
color: #000;
|
|
}
|
|
|
|
.btn--warning:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.btn--active {
|
|
background: var(--color-primary);
|
|
color: white;
|
|
box-shadow: 0 0 8px rgba(37, 99, 235, 0.5);
|
|
animation: pulseBtn 2s ease-in-out infinite;
|
|
}
|
|
|
|
@keyframes pulseBtn {
|
|
0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.5); }
|
|
50% { box-shadow: 0 0 16px rgba(37, 99, 235, 0.8); }
|
|
}
|
|
|
|
/* ---- Streaming Cursor ---- */
|
|
|
|
.cursor {
|
|
display: inline;
|
|
animation: blink 0.8s step-end infinite;
|
|
color: var(--color-success);
|
|
}
|
|
|
|
@keyframes blink {
|
|
0%, 100% { opacity: 1; }
|
|
50% { opacity: 0; }
|
|
}
|
|
|
|
/* ---- Message Meta ---- */
|
|
|
|
.chat-message__meta {
|
|
margin-top: 6px;
|
|
font-size: 0.75rem;
|
|
color: var(--color-text-muted);
|
|
}
|
|
|
|
/* ---- System Message ---- */
|
|
|
|
.system-message {
|
|
text-align: center;
|
|
padding: 8px 16px;
|
|
border-radius: var(--radius);
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.system-message--warning {
|
|
background: rgba(245, 158, 11, 0.15);
|
|
color: var(--color-warning);
|
|
border: 1px solid rgba(245, 158, 11, 0.3);
|
|
}
|
|
|
|
/* ---- Toast ---- */
|
|
|
|
.toast-container {
|
|
position: fixed;
|
|
top: 16px;
|
|
right: 16px;
|
|
z-index: 1000;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.toast {
|
|
padding: 10px 16px;
|
|
border-radius: var(--radius);
|
|
font-size: 0.85rem;
|
|
cursor: pointer;
|
|
animation: slideIn 0.3s ease-out;
|
|
max-width: 320px;
|
|
}
|
|
|
|
.toast--error {
|
|
background: rgba(239, 68, 68, 0.9);
|
|
color: white;
|
|
}
|
|
|
|
.toast--warning {
|
|
background: rgba(245, 158, 11, 0.9);
|
|
color: #000;
|
|
}
|
|
|
|
.toast--info {
|
|
background: rgba(37, 99, 235, 0.9);
|
|
color: white;
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateX(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
}
|
|
|
|
/* ---- Video Overlay ---- */
|
|
|
|
.video-overlay {
|
|
position: absolute;
|
|
inset: 0;
|
|
background: rgba(0, 0, 0, 0.3);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: var(--radius);
|
|
}
|
|
|
|
.video-overlay__spinner {
|
|
width: 32px;
|
|
height: 32px;
|
|
border: 3px solid rgba(255, 255, 255, 0.3);
|
|
border-top-color: white;
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* ---- Config Panel ---- */
|
|
|
|
.config-panel {
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius);
|
|
padding: 16px;
|
|
margin: 8px 0;
|
|
}
|
|
|
|
.config-panel__header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.config-panel__close {
|
|
background: none;
|
|
border: none;
|
|
color: var(--color-text-muted);
|
|
cursor: pointer;
|
|
font-size: 1rem;
|
|
padding: 2px 6px;
|
|
}
|
|
|
|
.config-panel__close:hover {
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.config-row {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 8px 0;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.config-row select,
|
|
.config-row input[type="checkbox"] {
|
|
background: var(--color-bg);
|
|
color: var(--color-text);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 4px;
|
|
padding: 4px 8px;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
/* ---- Detail Badge ---- */
|
|
|
|
.detail-badge {
|
|
position: absolute;
|
|
top: 8px;
|
|
right: 8px;
|
|
background: rgba(37, 99, 235, 0.8);
|
|
color: white;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 0.7rem;
|
|
font-weight: 700;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.observation-badge {
|
|
position: absolute;
|
|
top: 8px;
|
|
left: 8px;
|
|
background: rgba(34, 197, 94, 0.8);
|
|
color: white;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 0.7rem;
|
|
font-weight: 700;
|
|
animation: pulse 2s ease-in-out infinite;
|
|
}
|