diff --git a/app.py b/app.py index 54b79d0..dbd0d14 100644 --- a/app.py +++ b/app.py @@ -542,7 +542,13 @@ def on_disconnect(): room = Room.query.filter_by(name=room_name).first() room.remove_user(username) leave_room(room_name) + # Broadcast to all clients in the room that a user has left the room. emit("active_users", {"users": room.get_active_users()}, room=room_name) + emit( + "chat_message", + {"id": None, "content": f"{username} has left the room."}, + room=room.name, + ) # Remove session data from the database db.session.delete(user_session) db.session.commit() diff --git a/templates/chat.html b/templates/chat.html index 7acbf6b..0c01b97 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -36,6 +36,7 @@ +
@@ -70,7 +71,7 @@ const VALID_VOICES = ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']; const VALID_MODELS = [ 'None', 'gemini-flash', 'gemini-flash-8b', 'gemini-pro', 'grok-beta', 'vllm/hermes-llama-3', 'gpt-4', 'gpt-4o-2024-08-06', 'gpt-mini', - 'gpt-o1-mini', 'claude-haiku', 'claude-sonnet', 'claude-opus' + 'gpt-o1-mini', 'claude-haiku', 'claude-sonnet', 'claude-opus', 'dall-e-3' ]; // Configuration for DOMPurify to specify which tags and attributes are allowed