fix(workbench): return latest messages by default (#2015)

This commit is contained in:
Lyon
2026-06-24 05:15:01 +08:00
committed by GitHub
parent d0a00abfce
commit 7ad24b56c8
+3 -1
View File
@@ -1446,7 +1446,9 @@ async function handleWorkbenchMessagePage(request, response, url, options, actor
}
const messages = factMessagesForSession(session, result.facts);
const limit = boundedLimit(url.searchParams.get("limit"));
const offset = cursorOffset(url.searchParams.get("cursor") ?? url.searchParams.get("after"));
const cursorParam = url.searchParams.get("cursor") ?? url.searchParams.get("after");
const hasCursor = Boolean(textValue(cursorParam));
const offset = hasCursor ? cursorOffset(cursorParam) : Math.max(0, messages.length - limit);
const page = messages.slice(offset, offset + limit);
const nextOffset = offset + page.length;
const resolvedSessionId = factSessionId(session);