style: 重构为 Web 端双栏布局,突出对话展示

- 重构 App.tsx 为双栏布局:左侧视频面板 + 右侧聊天面板
- 左侧 340px 固定宽度视频区(4:3 比例)
- 右侧对话区 flex:1 占满剩余空间
- Header 改为导航栏风格:标题+副标题+状态标签+设置按钮
- 视频下方控制栏:观察模式/打断/结束对话按钮
- 优化间距、字号、配色,适配桌面端

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-13 16:16:37 +08:00
parent 7e2537104d
commit dd64ed23ee
3 changed files with 506 additions and 402 deletions

View File

@@ -1,19 +1,22 @@
/* ============================================================ /* ============================================================
CamTalk — 应用样式 CamTalk — Web 端应用样式
双栏布局:左侧视频面板 + 右侧聊天面板
============================================================ */ ============================================================ */
:root { :root {
--color-primary: #2563eb; --color-primary: #2563eb;
--color-primary-hover: #1d4ed8; --color-primary-hover: #1d4ed8;
--color-bg: #0f172a; --color-bg: #0b0f1a;
--color-surface: #1e293b; --color-surface: #151b2b;
--color-text: #f1f5f9; --color-surface-2: #1c2438;
--color-text-muted: #94a3b8; --color-text: #e2e8f0;
--color-border: #334155; --color-text-muted: #64748b;
--color-border: #1e293b;
--color-success: #22c55e; --color-success: #22c55e;
--color-warning: #f59e0b; --color-warning: #f59e0b;
--color-error: #ef4444; --color-error: #ef4444;
--radius: 8px; --radius: 10px;
--radius-sm: 6px;
} }
* { * {
@@ -22,241 +25,469 @@
box-sizing: border-box; box-sizing: border-box;
} }
html, body, #root {
height: 100%;
}
body { body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
background: var(--color-bg); background: var(--color-bg);
color: var(--color-text); color: var(--color-text);
min-height: 100vh;
} }
/* ---- App Shell ---- */
.app { .app {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 100vh; height: 100vh;
max-width: 900px; overflow: hidden;
margin: 0 auto;
padding: 0 16px;
} }
/* ---- Header ---- */ /* ---- Header ---- */
.app-header { .header {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 16px 0; padding: 0 20px;
height: 48px;
background: var(--color-surface);
border-bottom: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border);
flex-shrink: 0;
} }
.app-header h1 { .header__left {
font-size: 1.5rem; display: flex;
align-items: baseline;
gap: 12px;
}
.header__title {
font-size: 1.2rem;
font-weight: 700; font-weight: 700;
color: var(--color-text);
} }
.header-right { .header__subtitle {
font-size: 0.8rem;
color: var(--color-text-muted);
}
.header__right {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 12px;
}
.header__stats {
font-size: 0.75rem;
color: var(--color-text-muted);
padding: 4px 10px;
background: var(--color-surface-2);
border-radius: 12px;
}
.badge {
font-size: 0.75rem;
padding: 3px 10px;
border-radius: 12px;
font-weight: 500;
}
.badge--connected {
color: var(--color-success);
background: rgba(34, 197, 94, 0.1);
border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge--connecting {
color: var(--color-warning);
background: rgba(245, 158, 11, 0.1);
border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge--disconnected {
color: var(--color-text-muted);
background: var(--color-surface-2);
border: 1px solid var(--color-border);
} }
.btn-icon { .btn-icon {
background: none; background: none;
border: none; border: none;
font-size: 1.2rem; font-size: 1.1rem;
cursor: pointer; cursor: pointer;
padding: 4px; padding: 6px;
border-radius: 4px; border-radius: var(--radius-sm);
transition: background 0.2s; transition: background 0.15s;
color: var(--color-text-muted);
} }
.btn-icon:hover { .btn-icon:hover {
background: var(--color-surface); background: var(--color-surface-2);
color: var(--color-text);
} }
.status { /* ---- Workspace (双栏) ---- */
font-size: 0.85rem;
padding: 4px 12px; .workspace {
border-radius: 12px; flex: 1;
background: var(--color-surface); display: flex;
overflow: hidden;
} }
.status--connected { /* ---- 左侧视频面板 ---- */
color: var(--color-success);
border: 1px solid var(--color-success); .video-panel {
width: 340px;
flex-shrink: 0;
display: flex;
flex-direction: column;
padding: 16px;
gap: 12px;
} }
.status--connecting { .video-container {
color: var(--color-warning); position: relative;
border: 1px solid var(--color-warning); aspect-ratio: 4 / 3;
} background: #0a0e17;
border-radius: var(--radius);
.status--disconnected { overflow: hidden;
color: var(--color-text-muted);
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
} }
/* ---- Main ---- */ .video-container .video-preview {
.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%; width: 100%;
aspect-ratio: 4 / 3; height: 100%;
background: var(--color-surface); border-radius: 0;
border-radius: var(--radius);
overflow: hidden;
} }
.video-preview__video { .video-container .video-preview__video {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
background: #000;
} }
.video-preview__placeholder { .video-placeholder {
position: absolute; position: absolute;
inset: 0; inset: 0;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 8px;
color: var(--color-text-muted);
font-size: 0.82rem;
}
.video-placeholder__icon {
font-size: 2.4rem;
opacity: 0.2;
margin-bottom: 4px;
}
.video-indicator {
position: absolute;
bottom: 16px;
left: 16px;
background: rgba(0, 0, 0, 0.75);
backdrop-filter: blur(8px);
color: var(--color-success);
padding: 6px 14px;
border-radius: var(--radius-sm);
font-size: 0.8rem;
font-weight: 500;
animation: pulse 1.5s ease-in-out infinite;
}
.video-indicator--loading { color: var(--color-warning); }
.video-indicator--audio { left: auto; right: 16px; color: var(--color-primary); }
.video-indicator--error { color: var(--color-error); animation: none; }
.detail-badge {
position: absolute;
top: 12px;
right: 12px;
background: rgba(37, 99, 235, 0.85);
backdrop-filter: blur(8px);
color: white;
padding: 3px 10px;
border-radius: var(--radius-sm);
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.5px;
}
.observation-badge {
position: absolute;
top: 12px;
left: 12px;
background: rgba(34, 197, 94, 0.85);
backdrop-filter: blur(8px);
color: white;
padding: 3px 10px;
border-radius: var(--radius-sm);
font-size: 0.7rem;
font-weight: 700;
animation: pulse 2s ease-in-out infinite;
}
.video-overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.35);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(2px);
}
.video-overlay__spinner {
width: 36px;
height: 36px;
border: 3px solid rgba(255, 255, 255, 0.2);
border-top-color: white;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
/* ---- 视频控制栏 ---- */
.video-controls {
flex-shrink: 0;
display: flex;
justify-content: center;
padding: 4px 0;
}
.video-controls__row {
display: flex;
gap: 8px;
}
/* ---- 右侧聊天面板 ---- */
.chat-panel-wrapper {
flex: 1;
display: flex;
flex-direction: column;
background: var(--color-surface);
border-left: 1px solid var(--color-border);
min-width: 0;
}
.chat-panel-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
font-weight: 600;
font-size: 0.85rem;
border-bottom: 1px solid var(--color-border);
flex-shrink: 0;
color: var(--color-text-muted); color: var(--color-text-muted);
} }
/* ---- Chat Panel ---- */ .chat-panel-header__mode {
font-size: 0.7rem;
font-weight: 500;
color: var(--color-success);
background: rgba(34, 197, 94, 0.1);
padding: 2px 8px;
border-radius: 10px;
}
.chat-panel { .chat-panel-body {
flex: 1;
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; }
overflow-y: auto;
/* ---- Chat Panel (覆盖子组件样式) ---- */
.chat-panel {
flex: 1; flex: 1;
overflow-y: auto;
padding: 12px 16px;
display: flex;
flex-direction: column;
gap: 10px;
} }
.chat-panel--empty { .chat-panel--empty {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 48px 0; flex: 1;
color: var(--color-text-muted); color: var(--color-text-muted);
font-size: 0.85rem;
} }
.chat-message { .chat-message {
padding: 12px 16px; padding: 10px 14px;
border-radius: var(--radius); border-radius: var(--radius-sm);
background: var(--color-surface); background: var(--color-surface-2);
max-width: 92%;
} }
.chat-message--user { .chat-message--user {
border-left: 3px solid var(--color-primary); border-left: 2px solid var(--color-primary);
align-self: flex-end;
background: rgba(37, 99, 235, 0.08);
} }
.chat-message--assistant { .chat-message--assistant {
border-left: 3px solid var(--color-success); border-left: 2px solid var(--color-success);
} }
.chat-message--streaming { .chat-message--streaming {
opacity: 0.8; opacity: 0.85;
} }
.chat-message__role { .chat-message__role {
font-size: 0.75rem; font-size: 0.65rem;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--color-text-muted); color: var(--color-text-muted);
margin-bottom: 4px; margin-bottom: 3px;
} }
.chat-message__content { .chat-message__content {
font-size: 0.95rem; font-size: 0.82rem;
line-height: 1.5; line-height: 1.55;
white-space: pre-wrap; white-space: pre-wrap;
} }
/* ---- Footer ---- */ .chat-message__meta {
margin-top: 6px;
.app-footer { font-size: 0.65rem;
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); color: var(--color-text-muted);
border-top: 1px solid var(--color-border);
} }
/* ---- Streaming Cursor ---- */
.cursor {
display: inline;
animation: blink 0.8s step-end infinite;
color: var(--color-success);
}
/* ---- System Message ---- */
.system-message {
text-align: center;
padding: 8px 16px;
margin: 0 20px;
border-radius: var(--radius-sm);
font-size: 0.8rem;
}
.system-message--warning {
background: rgba(245, 158, 11, 0.1);
color: var(--color-warning);
border: 1px solid rgba(245, 158, 11, 0.2);
}
/* ---- Config Panel ---- */
.config-panel {
background: var(--color-surface);
border-bottom: 1px solid var(--color-border);
padding: 16px 24px;
display: flex;
align-items: center;
gap: 24px;
flex-shrink: 0;
}
.config-panel__header {
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
font-size: 0.85rem;
}
.config-panel__close {
background: none;
border: none;
color: var(--color-text-muted);
cursor: pointer;
font-size: 0.9rem;
padding: 2px 6px;
}
.config-panel__close:hover {
color: var(--color-text);
}
.config-row {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.82rem;
color: var(--color-text-muted);
}
.config-row select,
.config-row input[type="checkbox"] {
background: var(--color-surface-2);
color: var(--color-text);
border: 1px solid var(--color-border);
border-radius: var(--radius-sm);
padding: 4px 8px;
font-size: 0.8rem;
}
/* ---- Toast ---- */
.toast-container {
position: fixed;
top: 68px;
right: 20px;
z-index: 1000;
display: flex;
flex-direction: column;
gap: 8px;
}
.toast {
padding: 10px 16px;
border-radius: var(--radius-sm);
font-size: 0.82rem;
cursor: pointer;
animation: slideIn 0.3s ease-out;
max-width: 320px;
backdrop-filter: blur(8px);
}
.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; }
/* ---- Buttons ---- */ /* ---- Buttons ---- */
.btn { .btn {
padding: 10px 24px; padding: 8px 20px;
border: none; border: none;
border-radius: var(--radius); border-radius: var(--radius-sm);
font-size: 0.95rem; font-size: 0.85rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: background 0.2s; transition: all 0.15s;
display: inline-flex;
align-items: center;
gap: 6px;
}
.btn--lg {
padding: 12px 32px;
font-size: 0.95rem;
border-radius: var(--radius);
} }
.btn--primary { .btn--primary {
@@ -269,7 +500,7 @@ body {
} }
.btn--secondary { .btn--secondary {
background: var(--color-surface); background: var(--color-surface-2);
color: var(--color-text); color: var(--color-text);
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
} }
@@ -283,28 +514,35 @@ body {
color: #000; color: #000;
} }
.btn--warning:hover { .btn--warning:hover { opacity: 0.9; }
opacity: 0.9;
.btn--danger {
background: rgba(239, 68, 68, 0.15);
color: var(--color-error);
border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn--danger:hover {
background: rgba(239, 68, 68, 0.25);
} }
.btn--active { .btn--active {
background: var(--color-primary); background: var(--color-primary);
color: white; color: white;
box-shadow: 0 0 8px rgba(37, 99, 235, 0.5); box-shadow: 0 0 12px rgba(37, 99, 235, 0.4);
animation: pulseBtn 2s ease-in-out infinite; animation: pulseBtn 2s ease-in-out infinite;
} }
@keyframes pulseBtn { /* ---- Animations ---- */
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); } @keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.6; }
} }
/* ---- Streaming Cursor ---- */ @keyframes pulseBtn {
0%, 100% { box-shadow: 0 0 12px rgba(37, 99, 235, 0.4); }
.cursor { 50% { box-shadow: 0 0 20px rgba(37, 99, 235, 0.7); }
display: inline;
animation: blink 0.8s step-end infinite;
color: var(--color-success);
} }
@keyframes blink { @keyframes blink {
@@ -312,174 +550,30 @@ body {
50% { opacity: 0; } 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 { @keyframes spin {
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
/* ---- Config Panel ---- */ @keyframes slideIn {
from { opacity: 0; transform: translateX(20px); }
.config-panel { to { opacity: 1; transform: translateX(0); }
background: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: var(--radius);
padding: 16px;
margin: 8px 0;
} }
.config-panel__header { /* ---- Scrollbar ---- */
display: flex;
justify-content: space-between; ::-webkit-scrollbar {
align-items: center; width: 6px;
margin-bottom: 12px;
font-weight: 600;
} }
.config-panel__close { ::-webkit-scrollbar-track {
background: none; background: transparent;
border: none;
color: var(--color-text-muted);
cursor: pointer;
font-size: 1rem;
padding: 2px 6px;
} }
.config-panel__close:hover { ::-webkit-scrollbar-thumb {
color: var(--color-text); background: var(--color-border);
border-radius: 3px;
} }
.config-row { ::-webkit-scrollbar-thumb:hover {
display: flex; background: var(--color-text-muted);
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;
} }

View File

@@ -1,5 +1,5 @@
// ============================================================ // ============================================================
// CamTalk — 主应用组件 // CamTalk — 主应用组件Web 端双栏布局)
// ============================================================ // ============================================================
import { useState } from "react"; import { useState } from "react";
@@ -39,15 +39,20 @@ function App() {
return ( return (
<div className="app"> <div className="app">
<header className="app-header"> {/* ---- 顶部导航栏 ---- */}
<h1>CamTalk</h1> <header className="header">
<div className="header-right"> <div className="header__left">
<span className={`status status--${connectionStatus}`}> <h1 className="header__title">CamTalk</h1>
{isConnected <span className="header__subtitle">AI </span>
? "已连接" </div>
: connectionStatus === "connecting" <div className="header__right">
? "连接中..." {isConnected && (stats.queryCount > 0 || stats.totalTokens > 0) && (
: "未连接"} <span className="header__stats">
{stats.queryCount} · {stats.totalTokens} tokens
</span>
)}
<span className={`badge badge--${connectionStatus}`}>
{isConnected ? "已连接" : connectionStatus === "connecting" ? "连接中..." : "未连接"}
</span> </span>
{isConnected && ( {isConnected && (
<button <button
@@ -69,81 +74,92 @@ function App() {
/> />
)} )}
<main className="app-main"> {/* ---- 主体:左侧视频 + 右侧聊天 ---- */}
<div className="video-section"> <div className="workspace">
<VideoPreview ref={videoRef} isStreaming={!!stream} /> {/* 左侧:视频预览 + 控制栏 */}
{config.detailLevel === "high" && ( <div className="video-panel">
<div className="detail-badge">HD</div> <div className="video-container">
)} <VideoPreview ref={videoRef} isStreaming={!!stream} />
{isObserving && ( {config.detailLevel === "high" && (
<div className="observation-badge">👁 </div> <div className="detail-badge">HD</div>
)}
{isSpeaking && <div className="vad-indicator">🎤 ...</div>}
{isAudioPlaying && config.ttsEnabled && (
<div className="vad-indicator vad-indicator--audio">🔊 ...</div>
)}
{isConnected && !isVADReady && !vadError && (
<div className="vad-indicator vad-indicator--loading">
...
</div>
)}
{vadError && (
<div className="vad-indicator vad-indicator--error">
{vadError}
</div>
)}
{isProcessing && (
<div className="video-overlay">
<div className="video-overlay__spinner" />
</div>
)}
</div>
<div className="chat-section">
{connectionStatus === "disconnected" && messages.length > 0 && (
<div className="system-message system-message--warning">
...
</div>
)}
<ChatPanel
messages={messages}
currentReply={currentReply}
connectionStatus={connectionStatus}
/>
</div>
</main>
{isConnected && (stats.queryCount > 0 || stats.totalTokens > 0) && (
<div className="stats-bar">
{stats.queryCount > 0 && <span>{stats.queryCount} </span>}
{stats.totalTokens > 0 && <span>· {stats.totalTokens} tokens</span>}
</div>
)}
<footer className="app-footer">
{!isConnected ? (
<button className="btn btn--primary" onClick={startSession}>
{connectionStatus === "connecting" ? "连接中..." : "开始对话"}
</button>
) : (
<>
<button
className={`btn ${mode === "observation" ? "btn--active" : "btn--secondary"}`}
onClick={toggleMode}
>
{mode === "observation" ? "👁️ 观察中" : "👁️ 观察模式"}
</button>
<button className="btn btn--secondary" onClick={stopSession}>
</button>
{isProcessing && (
<button className="btn btn--warning" onClick={interrupt}>
</button>
)} )}
</> {isObserving && (
)} <div className="observation-badge">👁 </div>
</footer> )}
{isSpeaking && (
<div className="video-indicator">🎤 ...</div>
)}
{isAudioPlaying && config.ttsEnabled && (
<div className="video-indicator video-indicator--audio">🔊 ...</div>
)}
{isConnected && !isVADReady && !vadError && (
<div className="video-indicator video-indicator--loading">...</div>
)}
{vadError && (
<div className="video-indicator video-indicator--error"> {vadError}</div>
)}
{isProcessing && (
<div className="video-overlay">
<div className="video-overlay__spinner" />
</div>
)}
{!isConnected && !stream && (
<div className="video-placeholder">
<span className="video-placeholder__icon">📷</span>
<span></span>
</div>
)}
</div>
{/* 视频下方控制栏 */}
<div className="video-controls">
{!isConnected ? (
<button className="btn btn--primary btn--lg" onClick={startSession}>
{connectionStatus === "connecting" ? "连接中..." : "🎙️ 开始对话"}
</button>
) : (
<div className="video-controls__row">
<button
className={`btn ${mode === "observation" ? "btn--active" : "btn--secondary"}`}
onClick={toggleMode}
>
{mode === "observation" ? "👁️ 观察中" : "👁️ 观察模式"}
</button>
{isProcessing && (
<button className="btn btn--warning" onClick={interrupt}>
</button>
)}
<button className="btn btn--danger" onClick={stopSession}>
</button>
</div>
)}
</div>
</div>
{/* 右侧:聊天面板 */}
<div className="chat-panel-wrapper">
<div className="chat-panel-header">
<span></span>
{isConnected && mode === "observation" && (
<span className="chat-panel-header__mode"></span>
)}
</div>
<div className="chat-panel-body">
{connectionStatus === "disconnected" && messages.length > 0 && (
<div className="system-message system-message--warning">
...
</div>
)}
<ChatPanel
messages={messages}
currentReply={currentReply}
connectionStatus={connectionStatus}
/>
</div>
</div>
</div>
<ToastContainer /> <ToastContainer />
</div> </div>

View File

@@ -1,7 +1 @@
/* 全局重置 — 详细样式在 App.css 中定义 */ /* 全局重置 — 详细样式在 App.css 中定义 */
#root {
min-height: 100vh;
display: flex;
flex-direction: column;
}