Skip to content

Commit e7ac151

Browse files
refactor: sort conversations by start time in display function
* Implemented sorting of conversations by their start time before displaying them in the console UI. * This change ensures that conversations are presented in chronological order, enhancing user experience.
1 parent 42bf755 commit e7ac151

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

summarizer/console_ui.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ def display_conversations(
6666
console.print("[yellow]No conversations found.[/]")
6767
return
6868

69-
for convo in conversations:
69+
# Sort conversations by start time (earliest to latest)
70+
sorted_conversations = sorted(
71+
conversations, key=lambda conv: conv.start_time or datetime.min
72+
)
73+
74+
for convo in sorted_conversations:
7075
# Header with stats
7176
start_fmt = _format_time(convo.start_time, time_display_format)
7277
end_fmt = _format_time(convo.end_time, time_display_format)

0 commit comments

Comments
 (0)