mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
tweak: ensure most recently interacted with session appears at the top (#1239)
This commit is contained in:
parent
d0721a9157
commit
590ef89b3d
3 changed files with 3 additions and 4 deletions
|
|
@ -201,6 +201,7 @@ export namespace Server {
|
|||
}),
|
||||
async (c) => {
|
||||
const sessions = await Array.fromAsync(Session.list())
|
||||
sessions.sort((a, b) => b.time.updated - a.time.updated)
|
||||
return c.json(sessions)
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -509,6 +509,8 @@ export namespace Session {
|
|||
for (const part of userParts) {
|
||||
await updatePart(part)
|
||||
}
|
||||
// mark session as updated since a message has been added to it
|
||||
await update(input.sessionID, (_draft) => {})
|
||||
|
||||
if (isLocked(input.sessionID)) {
|
||||
return new Promise((resolve) => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"log/slog"
|
||||
|
|
@ -532,9 +531,6 @@ func (a *App) ListSessions(ctx context.Context) ([]opencode.Session, error) {
|
|||
return []opencode.Session{}, nil
|
||||
}
|
||||
sessions := *response
|
||||
sort.Slice(sessions, func(i, j int) bool {
|
||||
return sessions[i].Time.Created-sessions[j].Time.Created > 0
|
||||
})
|
||||
return sessions, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue