mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-22 10:32:00 +00:00
fix(dashboard): sort chat session switcher by most-recent activity (#49104)
The Chat-tab session switcher rendered rows in the API's default order="created" (original start time) while each row displays last_active — so a session you just messaged in could sit below an older one, and the list looked unsorted against its own timestamps. Pass order="recent" from ChatSessionList so the switcher sorts by latest activity across the compression chain (most-recently-used at top, ChatGPT-style; long conversations that auto-compressed into a new continuation id stay on the first page). Adds an optional, defaulted `order` arg to api.getSessions; the paginated Sessions page keeps the stable created order.
This commit is contained in:
parent
1b04e4ede5
commit
0d7abd555c
2 changed files with 11 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ export function ChatSessionList({
|
|||
setLoading(true);
|
||||
setError(null);
|
||||
api
|
||||
.getSessions(SESSION_LIMIT, 0, scopeKey)
|
||||
.getSessions(SESSION_LIMIT, 0, scopeKey, "recent")
|
||||
.then((res) => {
|
||||
if (reqRef.current !== myReq) return;
|
||||
setSessions(res.sessions);
|
||||
|
|
|
|||
|
|
@ -344,9 +344,17 @@ export const api = {
|
|||
window.location.assign("/login");
|
||||
return r;
|
||||
}),
|
||||
getSessions: (limit = 20, offset = 0, profile = getManagementProfile()) =>
|
||||
getSessions: (
|
||||
limit = 20,
|
||||
offset = 0,
|
||||
profile = getManagementProfile(),
|
||||
order: "created" | "recent" = "created",
|
||||
) =>
|
||||
fetchJSON<PaginatedSessions>(
|
||||
appendProfileParam(`/api/sessions?limit=${limit}&offset=${offset}`, profile),
|
||||
appendProfileParam(
|
||||
`/api/sessions?limit=${limit}&offset=${offset}&order=${order}`,
|
||||
profile,
|
||||
),
|
||||
),
|
||||
getSessionMessages: (id: string, profile = getManagementProfile()) =>
|
||||
fetchJSON<SessionMessagesResponse>(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue