fmt(js): `npm run fix` on merge (#81589)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a8ccd52123
commit
2d5e93161b
|
|
@ -97,6 +97,7 @@ describe('loadArtifactsForSessions', () => {
|
|||
makeSession({ id: 'session-2' }),
|
||||
makeSession({ id: 'session-3' })
|
||||
]
|
||||
|
||||
const callOrder: string[] = []
|
||||
let activeLoads = 0
|
||||
let maxActiveLoads = 0
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ export function ArtifactsView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
|
|||
|
||||
try {
|
||||
const sessions = (await listAllProfileSessions(30, 1)).sessions
|
||||
|
||||
const { artifacts: nextArtifacts, failures } = await loadArtifactsForSessions(
|
||||
sessions,
|
||||
async session => (await getAllSessionMessages(session.id, session.profile)).messages
|
||||
|
|
@ -145,7 +146,9 @@ export function ArtifactsView({ setStatusbarItemGroup: _setStatusbarItemGroup, .
|
|||
const safeLimitFailures = failures.filter(({ error }) =>
|
||||
String(error instanceof Error ? error.message : error).includes('safe-load limit')
|
||||
).length
|
||||
|
||||
const otherFailures = failures.length - safeLimitFailures
|
||||
|
||||
const detail = [
|
||||
safeLimitFailures ? `${safeLimitFailures} exceeded the safe transcript load limit.` : '',
|
||||
otherFailures ? `${otherFailures} could not be read.` : ''
|
||||
|
|
|
|||
|
|
@ -3,12 +3,7 @@ import { type MutableRefObject, useCallback, useEffect, useRef } from 'react'
|
|||
import type { NavigateFunction } from 'react-router'
|
||||
|
||||
import { revealTreePane } from '@/components/pane-shell/tree/store'
|
||||
import {
|
||||
deleteSession,
|
||||
getAllSessionMessages,
|
||||
getLatestSessionMessages,
|
||||
setSessionArchived
|
||||
} from '@/hermes'
|
||||
import { deleteSession, getAllSessionMessages, getLatestSessionMessages, setSessionArchived } from '@/hermes'
|
||||
import { useI18n } from '@/i18n'
|
||||
import { type ChatMessage, preserveLocalAssistantErrors, toChatMessages } from '@/lib/chat-messages'
|
||||
import { isMissingRpcMethod } from '@/lib/gateway-rpc'
|
||||
|
|
|
|||
|
|
@ -666,15 +666,19 @@ export function getSessionMessages(
|
|||
if (profile) {
|
||||
query.set('profile', profile)
|
||||
}
|
||||
|
||||
if (page.limit !== undefined) {
|
||||
query.set('limit', String(page.limit))
|
||||
}
|
||||
|
||||
if (page.offset !== undefined) {
|
||||
query.set('offset', String(page.offset))
|
||||
}
|
||||
|
||||
if (page.order) {
|
||||
query.set('order', page.order)
|
||||
}
|
||||
|
||||
const suffix = query.size ? `?${query.toString()}` : ''
|
||||
|
||||
return window.hermesDesktop.api<SessionMessagesResponse>({
|
||||
|
|
@ -683,10 +687,7 @@ export function getSessionMessages(
|
|||
})
|
||||
}
|
||||
|
||||
export function getLatestSessionMessages(
|
||||
id: string,
|
||||
profile?: string | null
|
||||
): Promise<SessionMessagesResponse> {
|
||||
export function getLatestSessionMessages(id: string, profile?: string | null): Promise<SessionMessagesResponse> {
|
||||
return getSessionMessages(id, profile, { limit: 500, order: 'latest' })
|
||||
}
|
||||
|
||||
|
|
@ -708,23 +709,23 @@ export async function getAllSessionMessages(
|
|||
offset,
|
||||
order: 'oldest'
|
||||
})
|
||||
|
||||
resolvedSessionId = page.session_id
|
||||
jsonChars += (JSON.stringify(page.messages) ?? '').length
|
||||
|
||||
if (jsonChars > maxJsonChars) {
|
||||
throw new Error(
|
||||
'Session transcript exceeds the Desktop safe-load limit; use the Web Dashboard export for this session.'
|
||||
)
|
||||
}
|
||||
|
||||
messages.push(...page.messages)
|
||||
|
||||
// Legacy backends ignore pagination and return the full transcript.
|
||||
if (
|
||||
!page.pagination ||
|
||||
page.messages.length === 0 ||
|
||||
page.messages.length < page.pagination.limit
|
||||
) {
|
||||
if (!page.pagination || page.messages.length === 0 || page.messages.length < page.pagination.limit) {
|
||||
break
|
||||
}
|
||||
|
||||
offset += page.messages.length
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue