From 81bb38010ba72e957fa3dcc3f9dfd07e9334cfab Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Fri, 10 Jul 2026 11:55:47 -0500 Subject: [PATCH] refac --- cptr/utils/chat_task.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cptr/utils/chat_task.py b/cptr/utils/chat_task.py index f3e7119..a94d6ad 100644 --- a/cptr/utils/chat_task.py +++ b/cptr/utils/chat_task.py @@ -626,6 +626,12 @@ async def generate_chat_title( if not title: return + # Do not overwrite a title manually set while this request was running. + chat = await Chat.get_by_id(chat_id) + fallback = user_content[:50].strip() or "New Chat" + if not chat or chat.title != fallback: + return + # Persist and notify await Chat.update_title(chat_id, title, now_ms()) await emit_to_user(user_id, {"chat_id": chat_id, "title": title})