From 03b11ff4c49bbd06138cd0ccc9116c55334a613d Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 10 Nov 2023 15:02:02 -0500 Subject: [PATCH] modified: app.py --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 79fbde4..b447078 100644 --- a/app.py +++ b/app.py @@ -320,7 +320,8 @@ def chat_gpt(username, room_name, message, model_name="gpt-3.5-turbo"): .limit(limit) .all() ) - if len(last_messages) % 6 == 0 or room.title is None: + message_count = len(last_messages) + if message_count % 6 == 0 or (room.title is None and message_count > 2): room.title = gpt_generate_room_title(last_messages, model_name) db.session.add(room) db.session.commit()