wip: refactoring tui

This commit is contained in:
adamdottv
2025-06-02 12:00:21 -05:00
parent da92ee5f09
commit 8b5394e031
2 changed files with 8 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package app
import (
"context"
"fmt"
"sort"
"log/slog"
@@ -137,8 +138,13 @@ func (a *App) ListSessions(ctx context.Context) ([]client.SessionInfo, error) {
if resp.JSON200 == nil {
return []client.SessionInfo{}, nil
}
sessions := *resp.JSON200
// sort sessions by last message time
sort.Slice(sessions, func(i, j int) bool {
return sessions[i].Time.Created-sessions[j].Time.Created > 0
})
return sessions, nil
}