mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
perf: avoid per-item arrays in journal projection (#20305)
Co-authored-by: Orca Worker <orca-worker@localhost>
This commit is contained in:
@@ -137,10 +137,14 @@ const projectedItems = new WeakMap<AgentJournalRenderItem, NativeChatMessage | n
|
||||
export function projectStructuredItemsToNativeChat(
|
||||
items: readonly AgentJournalRenderItem[]
|
||||
): NativeChatMessage[] {
|
||||
return items.flatMap((item) => {
|
||||
const messages: NativeChatMessage[] = []
|
||||
items.forEach((item) => {
|
||||
const projected = projectStructuredItemToNativeChat(item)
|
||||
return projected ? [projected] : []
|
||||
if (projected) {
|
||||
messages.push(projected)
|
||||
}
|
||||
})
|
||||
return messages
|
||||
}
|
||||
|
||||
export function projectStructuredItemToNativeChat(
|
||||
|
||||
Reference in New Issue
Block a user