clear buffer

This commit is contained in:
Russell Ballestrini 2023-10-29 21:09:08 -04:00
parent 63b0c3926f
commit 6a2db62801
2 changed files with 6 additions and 3 deletions

4
app.py
View file

@ -218,7 +218,7 @@ def chat_claude(username, room, message):
db.session.add(new_message)
db.session.commit()
socketio.emit("delete_processing_message", "", room=room)
socketio.emit("delete_processing_message", msg_id, room=room)
def chat_gpt(username, room, message):
@ -291,7 +291,7 @@ def chat_gpt(username, room, message):
db.session.add(new_message)
db.session.commit()
socketio.emit("delete_processing_message", "", room=room)
socketio.emit("delete_processing_message", msg_id, room=room)
if __name__ == "__main__":

View file

@ -166,14 +166,17 @@ socket.on('previous_messages', (data) => {
});
socket.on('delete_processing_message', (data) => {
socket.on('delete_processing_message', (msg_id) => {
const tempMessages = document.querySelectorAll("#message-null");
tempMessages.forEach((tempMessage) => {
tempMessage.remove();
});
// Clear the message buffer for the corresponding message ID
delete messageBuffers[msg_id];
});
// A dictionary to hold buffers for each message ID
const messageBuffers = {};