mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-20 06:44:32 +00:00
[feat] Update history API to v2 array format and add comprehensive tests
- Migrate from object-based to array-based history response format - Update /history endpoint to /history_v2 with max_items parameter - Add lazy loading of workflows via /history_v2/:prompt_id endpoint - Implement comprehensive browser tests for history API functionality - Add unit tests for API methods and queue store - Update TaskItemImpl to support history workflow loading - Add proper error handling and edge case coverage - Follow established test patterns for better maintainability This change improves performance by reducing initial payload size and enables on-demand workflow loading for history items.
This commit is contained in:
committed by
Jennifer Weber
parent
c27edb7e94
commit
7649feb47f
@@ -276,23 +276,15 @@ export class TaskItemImpl {
|
||||
}
|
||||
|
||||
get queueIndex() {
|
||||
return this.prompt[0]
|
||||
return this.prompt.priority
|
||||
}
|
||||
|
||||
get promptId() {
|
||||
return this.prompt[1]
|
||||
}
|
||||
|
||||
get promptInputs() {
|
||||
return this.prompt[2]
|
||||
return this.prompt.prompt_id
|
||||
}
|
||||
|
||||
get extraData() {
|
||||
return this.prompt[3]
|
||||
}
|
||||
|
||||
get outputsToExecute() {
|
||||
return this.prompt[4]
|
||||
return this.prompt.extra_data
|
||||
}
|
||||
|
||||
get extraPngInfo() {
|
||||
@@ -408,13 +400,11 @@ export class TaskItemImpl {
|
||||
(output: ResultItemImpl, i: number) =>
|
||||
new TaskItemImpl(
|
||||
this.taskType,
|
||||
[
|
||||
this.queueIndex,
|
||||
`${this.promptId}-${i}`,
|
||||
this.promptInputs,
|
||||
this.extraData,
|
||||
this.outputsToExecute
|
||||
],
|
||||
{
|
||||
priority: this.queueIndex,
|
||||
prompt_id: `${this.promptId}-${i}`,
|
||||
extra_data: this.extraData
|
||||
},
|
||||
this.status,
|
||||
{
|
||||
[output.nodeId]: {
|
||||
@@ -479,11 +469,11 @@ export const useQueueStore = defineStore('queue', () => {
|
||||
pendingTasks.value = toClassAll(queue.Pending)
|
||||
|
||||
const allIndex = new Set<number>(
|
||||
history.History.map((item: TaskItem) => item.prompt[0])
|
||||
history.History.map((item: TaskItem) => item.prompt.priority)
|
||||
)
|
||||
const newHistoryItems = toClassAll(
|
||||
history.History.filter(
|
||||
(item) => item.prompt[0] > lastHistoryQueueIndex.value
|
||||
(item) => item.prompt.priority > lastHistoryQueueIndex.value
|
||||
)
|
||||
)
|
||||
const existingHistoryItems = historyTasks.value.filter((item) =>
|
||||
|
||||
Reference in New Issue
Block a user