From 00f10088d00f51360959d2833711f6edf530cd5c Mon Sep 17 00:00:00 2001 From: cfy666 <3087823110@qq.com> Date: Sat, 13 Jun 2026 20:01:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BA=95=E9=83=A8=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E6=A0=8F=E6=B7=BB=E5=8A=A0=E6=91=84=E5=83=8F=E5=A4=B4/?= =?UTF-8?q?=E9=BA=A6=E5=85=8B=E9=A3=8E=E5=BC=80=E5=85=B3=EF=BC=8C=E8=AF=B4?= =?UTF-8?q?=E8=AF=9D=E6=97=B6=E9=BA=A6=E5=85=8B=E9=A3=8E=E8=84=89=E5=86=B2?= =?UTF-8?q?=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - useVisionSession 新增 isCameraOn/isMicOn 状态 + toggleCamera/toggleMic - 底部控制栏添加 📷🎤 图标按钮,开启绿色/关闭红色 - 说话时麦克风按钮绿色脉冲缩放动画(micPulse) - 按钮样式优化:nowrap 防换行,flex-wrap 自适应 Co-Authored-By: Claude --- frontend/src/App.css | 43 +++++++++++++++++++++++++- frontend/src/App.tsx | 33 +++++++++++--------- frontend/src/hooks/useVisionSession.ts | 32 +++++++++++++++++++ 3 files changed, 92 insertions(+), 16 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index bddd055..330c48c 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -332,7 +332,48 @@ body { .video-controls__row { display: flex; - gap: 8px; + gap: 6px; + flex-wrap: wrap; + justify-content: center; +} + +.btn--ctrl { + padding: 6px 12px; + font-size: 0.78rem; + border-radius: var(--radius-sm); + border: 1px solid var(--color-border); + background: var(--color-surface-2); + color: var(--color-text-muted); + cursor: pointer; + transition: all 0.15s; + white-space: nowrap; +} + +.btn--ctrl:hover { + background: var(--color-border); + color: var(--color-text); +} + +.btn--ctrl-on { + background: rgba(34, 197, 94, 0.15); + color: var(--color-success); + border-color: rgba(34, 197, 94, 0.3); +} + +.btn--ctrl-off { + background: rgba(239, 68, 68, 0.1); + color: var(--color-error); + border-color: rgba(239, 68, 68, 0.2); +} + +.btn--speaking { + animation: micPulse 0.8s ease-in-out infinite; + box-shadow: 0 0 12px rgba(34, 197, 94, 0.5); +} + +@keyframes micPulse { + 0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); transform: scale(1); } + 50% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.8); transform: scale(1.05); } } /* ---- 右侧聊天面板 ---- */ diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 4fcea63..ffd567b 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -54,6 +54,10 @@ function App() { startSession, stopSession, interrupt, + isCameraOn, + isMicOn, + toggleCamera, + toggleMic, } = useVisionSession(); const isConnected = connectionStatus === "connected"; @@ -97,21 +101,6 @@ function App() { {stats.queryCount} 次请求 · {stats.totalTokens} tokens )} -
- {[ - { code: "zh-CN", label: "中文" }, - { code: "en-US", label: "EN" }, - { code: "ja-JP", label: "日" }, - ].map((l) => ( - - ))} -
{isConnected ? "已连接" : connectionStatus === "connecting" ? "连接中..." : "未连接"} @@ -186,6 +175,20 @@ function App() { ) : (
+ +