Skip to content

Commit 92b2ae2

Browse files
committed
fix: rename conv logic
1 parent 38a3968 commit 92b2ae2

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

libs/ktem/ktem/pages/chat/control.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,25 +372,21 @@ def select_conv(self, conversation_id, user_id):
372372

373373
def rename_conv(self, conversation_id, new_name, is_renamed, user_id):
374374
"""Rename the conversation"""
375-
if not is_renamed or KH_DEMO_MODE:
375+
if not is_renamed or KH_DEMO_MODE or user_id is None or not conversation_id:
376376
return (
377377
gr.update(),
378378
conversation_id,
379379
gr.update(visible=False),
380380
)
381381

382-
if user_id is None:
383-
gr.Warning("Please sign in first (Settings → User Settings)")
384-
return gr.update(), ""
385-
386-
if not conversation_id:
387-
gr.Warning("No conversation selected.")
388-
return gr.update(), ""
389-
390382
errors = is_conv_name_valid(new_name)
391383
if errors:
392384
gr.Warning(errors)
393-
return gr.update(), conversation_id
385+
return (
386+
gr.update(),
387+
conversation_id,
388+
gr.update(visible=False),
389+
)
394390

395391
with Session(engine) as session:
396392
statement = select(Conversation).where(Conversation.id == conversation_id)

0 commit comments

Comments
 (0)