fix(workbench): return latest messages by default (#2015)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user