feat(historyV2): load workflows for images (#6384)

## Summary

Hooked up the "Load Workflow" action to our `history_v2` API.

Note: Our cloud envs were being stress tested right now so images are
loading at time of recording. Images were loading for me during
development before I had time to create the video.


## Screenshots 📷 



https://github.com/user-attachments/assets/02145504-ceae-497b-9049-553796d698da



┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6384-Feat-history-v2-workflows-29b6d73d365081bcb706fe799b8ce66a)
by [Unito](https://www.unito.io)
This commit is contained in:
Arjan Singh
2025-10-29 18:35:42 -07:00
committed by GitHub
parent 6f068c87da
commit f2355a6ad1
9 changed files with 384 additions and 64 deletions

View File

@@ -21,8 +21,8 @@ function createHistoryItem(promptId: string, queueIndex = 0): TaskItem {
}
}
function getAllPromptIds(result: { items: TaskItem[] }): string[] {
return result.items.map((item) => item.prompt[1])
function getAllPromptIds(result: TaskItem[]): string[] {
return result.map((item) => item.prompt[1])
}
describe('reconcileHistory (V1)', () => {
@@ -74,9 +74,9 @@ describe('reconcileHistory (V1)', () => {
const result = reconcileHistory(serverHistory, [], 10, undefined)
expect(result.items).toHaveLength(2)
expect(result.items[0].prompt[1]).toBe('item-1')
expect(result.items[1].prompt[1]).toBe('item-2')
expect(result).toHaveLength(2)
expect(result[0].prompt[1]).toBe('item-1')
expect(result[1].prompt[1]).toBe('item-2')
})
})
@@ -144,9 +144,9 @@ describe('reconcileHistory (V1)', () => {
const result = reconcileHistory(serverHistory, clientHistory, 2, 10)
expect(result.items).toHaveLength(2)
expect(result.items[0].prompt[1]).toBe('new-1')
expect(result.items[1].prompt[1]).toBe('new-2')
expect(result).toHaveLength(2)
expect(result[0].prompt[1]).toBe('new-1')
expect(result[1].prompt[1]).toBe('new-2')
})
})
@@ -168,13 +168,13 @@ describe('reconcileHistory (V1)', () => {
const result = reconcileHistory([], clientHistory, 10, 5)
expect(result.items).toHaveLength(0)
expect(result).toHaveLength(0)
})
it('should return empty result when both collections are empty', () => {
const result = reconcileHistory([], [], 10, undefined)
expect(result.items).toHaveLength(0)
expect(result).toHaveLength(0)
})
})
})
@@ -295,9 +295,9 @@ describe('reconcileHistory (V2/Cloud)', () => {
const result = reconcileHistory(serverHistory, clientHistory, 2)
expect(result.items).toHaveLength(2)
expect(result.items[0].prompt[1]).toBe('new-1')
expect(result.items[1].prompt[1]).toBe('new-2')
expect(result).toHaveLength(2)
expect(result[0].prompt[1]).toBe('new-1')
expect(result[1].prompt[1]).toBe('new-2')
})
})
@@ -310,9 +310,9 @@ describe('reconcileHistory (V2/Cloud)', () => {
const result = reconcileHistory(serverHistory, [], 10)
expect(result.items).toHaveLength(2)
expect(result.items[0].prompt[1]).toBe('item-1')
expect(result.items[1].prompt[1]).toBe('item-2')
expect(result).toHaveLength(2)
expect(result[0].prompt[1]).toBe('item-1')
expect(result[1].prompt[1]).toBe('item-2')
})
it('should return empty result when server history is empty', () => {
@@ -323,13 +323,13 @@ describe('reconcileHistory (V2/Cloud)', () => {
const result = reconcileHistory([], clientHistory, 10)
expect(result.items).toHaveLength(0)
expect(result).toHaveLength(0)
})
it('should return empty result when both collections are empty', () => {
const result = reconcileHistory([], [], 10)
expect(result.items).toHaveLength(0)
expect(result).toHaveLength(0)
})
})
})