feat: 聊天框与视频功能解耦,输入文字即可开始对话

之前必须点击「开始对话」连接 WebSocket 后才能使用聊天框。
现在聊天输入框始终可用,输入文字自动连接 WebSocket 并发送消息;
左侧按钮改为「开始视频通话」,单独控制摄像头/麦克风。

- ChatPanel 移除 !isConnected early return,始终显示输入框
- useVisionSession 新增待发消息队列,sendTextMessage 支持自动连接
- startSession 改为仅负责视频(摄像头 + 麦克风 + VAD)
- 修复 statusRef 在 useWebSocketManager 之前声明导致的 TDZ 错误
- 更新 i18n 翻译(新增 controls.startVideo、video.placeholder)
This commit is contained in:
2026-06-14 15:07:39 +08:00
parent e95b1603c1
commit 15b1dd56fa
6 changed files with 73 additions and 31 deletions

View File

@@ -33,12 +33,14 @@ export const enUS: TranslationMap = {
"video.playing": "🔊 Playing...",
"video.initVad": "Initializing voice detection...",
"video.clickToStart": "Click the button below to start",
"video.placeholder": "Type in the chat panel to start",
"video.cameraOff": "Camera is off",
"video.cameraOff.hint": "You can type in the chat panel",
// Controls
"controls.connecting": "Connecting...",
"controls.start": "🎙️ Start Session",
"controls.startVideo": "🎙️ Start Video Call",
"controls.cameraOff": "Turn off camera",
"controls.cameraOn": "Turn on camera",
"controls.micOff": "Turn off microphone",
@@ -52,8 +54,8 @@ export const enUS: TranslationMap = {
"chat.title": "Chat",
"chat.mode.observation": "Observing",
"chat.reconnecting": "Connection lost, reconnecting...",
"chat.empty.prompt": "Click the button below to start",
"chat.empty.hint": "Type or speak with AI after connecting",
"chat.empty.prompt": "Type below to start chatting",
"chat.empty.hint": "Type to chat with AI, or click the button on the left to start video",
"chat.welcome.prompt": "Type below to start chatting",
"chat.welcome.hint": "Or enable microphone for voice chat",
"chat.userLabel": "You",