Demo Update 14
This commit is contained in:
@@ -119,7 +119,7 @@ def health_check():
|
||||
|
||||
# Socket event handlers
|
||||
@socketio.on('connect')
|
||||
def handle_connect():
|
||||
def handle_connect(auth=None):
|
||||
session_id = request.sid
|
||||
logger.info(f"Client connected: {session_id}")
|
||||
|
||||
@@ -137,9 +137,9 @@ def handle_connect():
|
||||
emit('connection_status', {'status': 'connected'})
|
||||
|
||||
@socketio.on('disconnect')
|
||||
def handle_disconnect():
|
||||
def handle_disconnect(reason=None):
|
||||
session_id = request.sid
|
||||
logger.info(f"Client disconnected: {session_id}")
|
||||
logger.info(f"Client disconnected: {session_id}. Reason: {reason}")
|
||||
|
||||
# Cleanup
|
||||
if session_id in active_conversations:
|
||||
|
||||
@@ -574,6 +574,41 @@ function toggleVisualizerVisibility() {
|
||||
elements.visualizerCanvas.style.opacity = isVisible ? '1' : '0';
|
||||
}
|
||||
|
||||
// Add a message to the conversation
|
||||
function addMessage(text, type) {
|
||||
if (!elements.conversation) return;
|
||||
|
||||
const messageDiv = document.createElement('div');
|
||||
messageDiv.className = `message ${type}`;
|
||||
|
||||
const textElement = document.createElement('p');
|
||||
textElement.textContent = text;
|
||||
messageDiv.appendChild(textElement);
|
||||
|
||||
elements.conversation.appendChild(messageDiv);
|
||||
|
||||
// Auto-scroll to the bottom
|
||||
elements.conversation.scrollTop = elements.conversation.scrollHeight;
|
||||
|
||||
return messageDiv;
|
||||
}
|
||||
|
||||
// Add a system message to the conversation
|
||||
function addSystemMessage(text) {
|
||||
if (!elements.conversation) return;
|
||||
|
||||
const messageDiv = document.createElement('div');
|
||||
messageDiv.className = 'message system';
|
||||
messageDiv.textContent = text;
|
||||
|
||||
elements.conversation.appendChild(messageDiv);
|
||||
|
||||
// Auto-scroll to the bottom
|
||||
elements.conversation.scrollTop = elements.conversation.scrollHeight;
|
||||
|
||||
return messageDiv;
|
||||
}
|
||||
|
||||
// Handle transcription response from server
|
||||
function handleTranscription(data) {
|
||||
const speaker = data.speaker === 0 ? 'user' : 'ai';
|
||||
|
||||
Reference in New Issue
Block a user