    },
                            method: 'POST'
                        });
                        
                        addChatMessage(recognizedText, 'user');
                        $('#chat-message').val('');
                    }
                }, 500); 
            }

            // WebRTC 相关功能
            if (typeof window.onWebRTCConnected === 'function') {
                const originalOnConnected = window.onWebRTCConnected;
                window.onWebRTCConnected = function() {
   