mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-27 17:52:16 +00:00
## Summary Backport outputs from new cloud history endpoint Does: 1. Show history in the Queue 2. Show outputs from prompt execution Does not: 1. Handle appending latest images generated to queue history 2. Making sure that workflow data from images is available from load (requires additional API call to fetch) Most of this PR is: 1. Test fixtures (truncated workflow to test). 2. The service worker so I could verify my changes locally. ## Changes - Add `history_v2` to `history` adapter - Add tests for mapping - Do branded validation for promptIds (suggestion from @DrJKL) - Create a dev environment service worker so we can view cloud hosted images in development. ## Review Focus 1. Is the dev-only service work the right way to do it? It was the easiest I could think of. 4. Are the validation changes too heavy? I can rip them out if needed. ## Screenshots 🎃 https://github.com/user-attachments/assets/1787485a-8d27-4abe-abc8-cf133c1a52aa ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6288-Feat-history-v2-outputs-2976d73d365081a99864c40343449dcd) by [Unito](https://www.unito.io) --------- Co-authored-by: bymyself <cbyrne@comfy.org>
376 lines
7.3 KiB
TypeScript
376 lines
7.3 KiB
TypeScript
/**
|
|
* @fileoverview Test fixtures for history tests.
|
|
*/
|
|
import type { HistoryResponseV2 } from '@/platform/remote/comfyui/history/types/historyV2Types'
|
|
import type { HistoryTaskItem } from '@/schemas/apiSchema'
|
|
|
|
/**
|
|
* V1 API raw response format (object with prompt IDs as keys)
|
|
*/
|
|
export const historyV1RawResponse: Record<
|
|
string,
|
|
Omit<HistoryTaskItem, 'taskType'>
|
|
> = {
|
|
'complete-item-id': {
|
|
prompt: [
|
|
24,
|
|
'complete-item-id',
|
|
{},
|
|
{
|
|
client_id: 'test-client',
|
|
extra_pnginfo: {
|
|
workflow: {
|
|
id: '44f0c9f9-b5a7-48de-99fc-7e80c1570241',
|
|
revision: 0,
|
|
last_node_id: 9,
|
|
last_link_id: 9,
|
|
nodes: [],
|
|
links: [],
|
|
groups: [],
|
|
config: {},
|
|
extra: {},
|
|
version: 0.4
|
|
}
|
|
}
|
|
},
|
|
['9']
|
|
],
|
|
outputs: {
|
|
'9': {
|
|
images: [
|
|
{
|
|
filename: 'test.png',
|
|
subfolder: '',
|
|
type: 'output'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'success',
|
|
completed: true,
|
|
messages: [
|
|
[
|
|
'execution_start',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567890 }
|
|
],
|
|
[
|
|
'execution_success',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567900 }
|
|
]
|
|
]
|
|
},
|
|
meta: {
|
|
'9': {
|
|
node_id: '9',
|
|
display_node: '9'
|
|
}
|
|
}
|
|
},
|
|
'no-status-id': {
|
|
prompt: [
|
|
23,
|
|
'no-status-id',
|
|
{},
|
|
{
|
|
client_id: 'inference'
|
|
},
|
|
['10']
|
|
],
|
|
outputs: {
|
|
'10': {
|
|
images: []
|
|
}
|
|
},
|
|
status: undefined,
|
|
meta: {
|
|
'10': {
|
|
node_id: '10',
|
|
display_node: '10'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* V2 response with multiple edge cases:
|
|
* - Item 0: Complete with all fields
|
|
* - Item 1: Missing optional status field
|
|
* - Item 2: Missing optional meta field
|
|
* - Item 3: Multiple output nodes
|
|
*/
|
|
export const historyV2Fixture: HistoryResponseV2 = {
|
|
history: [
|
|
{
|
|
prompt_id: 'complete-item-id',
|
|
prompt: {
|
|
priority: 24,
|
|
prompt_id: 'complete-item-id',
|
|
extra_data: {
|
|
client_id: 'test-client',
|
|
extra_pnginfo: {
|
|
workflow: {
|
|
id: '44f0c9f9-b5a7-48de-99fc-7e80c1570241',
|
|
revision: 0,
|
|
last_node_id: 9,
|
|
last_link_id: 9,
|
|
nodes: [],
|
|
links: [],
|
|
groups: [],
|
|
config: {},
|
|
extra: {},
|
|
version: 0.4
|
|
}
|
|
}
|
|
}
|
|
},
|
|
outputs: {
|
|
'9': {
|
|
images: [
|
|
{
|
|
filename: 'test.png',
|
|
subfolder: '',
|
|
type: 'output'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'success',
|
|
completed: true,
|
|
messages: [
|
|
[
|
|
'execution_start',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567890 }
|
|
],
|
|
[
|
|
'execution_success',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567900 }
|
|
]
|
|
]
|
|
},
|
|
meta: {
|
|
'9': {
|
|
node_id: '9',
|
|
display_node: '9'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
prompt_id: 'no-status-id',
|
|
prompt: {
|
|
priority: 23,
|
|
prompt_id: 'no-status-id',
|
|
extra_data: {
|
|
client_id: 'inference'
|
|
}
|
|
},
|
|
outputs: {
|
|
'10': {
|
|
images: []
|
|
}
|
|
},
|
|
meta: {
|
|
'10': {
|
|
node_id: '10',
|
|
display_node: '10'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
prompt_id: 'no-meta-id',
|
|
prompt: {
|
|
priority: 22,
|
|
prompt_id: 'no-meta-id',
|
|
extra_data: {
|
|
client_id: 'web-ui'
|
|
}
|
|
},
|
|
outputs: {
|
|
'11': {
|
|
audio: []
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'error',
|
|
completed: false,
|
|
messages: []
|
|
}
|
|
},
|
|
{
|
|
prompt_id: 'multi-output-id',
|
|
prompt: {
|
|
priority: 21,
|
|
prompt_id: 'multi-output-id',
|
|
extra_data: {
|
|
client_id: 'batch-processor'
|
|
}
|
|
},
|
|
outputs: {
|
|
'3': {
|
|
images: [{ filename: 'img1.png', type: 'output', subfolder: '' }]
|
|
},
|
|
'9': {
|
|
images: [{ filename: 'img2.png', type: 'output', subfolder: '' }]
|
|
},
|
|
'12': {
|
|
video: [{ filename: 'video.mp4', type: 'output', subfolder: '' }]
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'success',
|
|
completed: true,
|
|
messages: []
|
|
},
|
|
meta: {
|
|
'3': { node_id: '3', display_node: '3' },
|
|
'9': { node_id: '9', display_node: '9' },
|
|
'12': { node_id: '12', display_node: '12' }
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
/**
|
|
* Expected V1 transformation of historyV2Fixture
|
|
*/
|
|
export const expectedV1Fixture: HistoryTaskItem[] = [
|
|
{
|
|
taskType: 'History',
|
|
prompt: [
|
|
24,
|
|
'complete-item-id',
|
|
{},
|
|
{
|
|
client_id: 'test-client',
|
|
extra_pnginfo: {
|
|
workflow: {
|
|
id: '44f0c9f9-b5a7-48de-99fc-7e80c1570241',
|
|
revision: 0,
|
|
last_node_id: 9,
|
|
last_link_id: 9,
|
|
nodes: [],
|
|
links: [],
|
|
groups: [],
|
|
config: {},
|
|
extra: {},
|
|
version: 0.4
|
|
}
|
|
}
|
|
},
|
|
['9']
|
|
],
|
|
outputs: {
|
|
'9': {
|
|
images: [
|
|
{
|
|
filename: 'test.png',
|
|
subfolder: '',
|
|
type: 'output'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'success',
|
|
completed: true,
|
|
messages: [
|
|
[
|
|
'execution_start',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567890 }
|
|
],
|
|
[
|
|
'execution_success',
|
|
{ prompt_id: 'complete-item-id', timestamp: 1234567900 }
|
|
]
|
|
]
|
|
},
|
|
meta: {
|
|
'9': {
|
|
node_id: '9',
|
|
display_node: '9'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
taskType: 'History',
|
|
prompt: [
|
|
23,
|
|
'no-status-id',
|
|
{},
|
|
{
|
|
client_id: 'inference'
|
|
},
|
|
['10']
|
|
],
|
|
outputs: {
|
|
'10': {
|
|
images: []
|
|
}
|
|
},
|
|
status: undefined,
|
|
meta: {
|
|
'10': {
|
|
node_id: '10',
|
|
display_node: '10'
|
|
}
|
|
}
|
|
},
|
|
{
|
|
taskType: 'History',
|
|
prompt: [
|
|
22,
|
|
'no-meta-id',
|
|
{},
|
|
{
|
|
client_id: 'web-ui'
|
|
},
|
|
['11']
|
|
],
|
|
outputs: {
|
|
'11': {
|
|
audio: []
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'error',
|
|
completed: false,
|
|
messages: []
|
|
},
|
|
meta: undefined
|
|
},
|
|
{
|
|
taskType: 'History',
|
|
prompt: [
|
|
21,
|
|
'multi-output-id',
|
|
{},
|
|
{
|
|
client_id: 'batch-processor'
|
|
},
|
|
['3', '9', '12']
|
|
],
|
|
outputs: {
|
|
'3': {
|
|
images: [{ filename: 'img1.png', type: 'output', subfolder: '' }]
|
|
},
|
|
'9': {
|
|
images: [{ filename: 'img2.png', type: 'output', subfolder: '' }]
|
|
},
|
|
'12': {
|
|
video: [{ filename: 'video.mp4', type: 'output', subfolder: '' }]
|
|
}
|
|
},
|
|
status: {
|
|
status_str: 'success',
|
|
completed: true,
|
|
messages: []
|
|
},
|
|
meta: {
|
|
'3': { node_id: '3', display_node: '3' },
|
|
'9': { node_id: '9', display_node: '9' },
|
|
'12': { node_id: '12', display_node: '12' }
|
|
}
|
|
}
|
|
]
|