feat(assistant): add conversations list, infinite history scroll, and archived tab
This commit is contained in:
@@ -39,12 +39,40 @@ export function cancelAssistantOperation(confirmationId) {
|
||||
// @PURPOSE: Retrieve paginated assistant conversation history.
|
||||
// @PRE: page/pageSize are positive integers.
|
||||
// @POST: Returns a paginated payload with history items.
|
||||
export function getAssistantHistory(page = 1, pageSize = 20, conversationId = null) {
|
||||
export function getAssistantHistory(page = 1, pageSize = 20, conversationId = null, fromLatest = false) {
|
||||
const params = new URLSearchParams({ page: String(page), page_size: String(pageSize) });
|
||||
if (conversationId) {
|
||||
params.append('conversation_id', conversationId);
|
||||
}
|
||||
if (fromLatest) {
|
||||
params.append('from_latest', 'true');
|
||||
}
|
||||
return requestApi(`/assistant/history?${params.toString()}`, 'GET');
|
||||
}
|
||||
// [/DEF:getAssistantHistory:Function]
|
||||
|
||||
// [DEF:getAssistantConversations:Function]
|
||||
// @PURPOSE: Retrieve paginated conversation list for assistant sidebar/history switcher.
|
||||
// @PRE: page/pageSize are positive integers.
|
||||
// @POST: Returns paginated conversation summaries.
|
||||
export function getAssistantConversations(
|
||||
page = 1,
|
||||
pageSize = 20,
|
||||
includeArchived = false,
|
||||
search = '',
|
||||
archivedOnly = false,
|
||||
) {
|
||||
const params = new URLSearchParams({ page: String(page), page_size: String(pageSize) });
|
||||
if (includeArchived) {
|
||||
params.append('include_archived', 'true');
|
||||
}
|
||||
if (archivedOnly) {
|
||||
params.append('archived_only', 'true');
|
||||
}
|
||||
if (search?.trim()) {
|
||||
params.append('search', search.trim());
|
||||
}
|
||||
return requestApi(`/assistant/conversations?${params.toString()}`, 'GET');
|
||||
}
|
||||
// [/DEF:getAssistantConversations:Function]
|
||||
// [/DEF:frontend.src.lib.api.assistant:Module]
|
||||
|
||||
Reference in New Issue
Block a user