remove workflow json from history_v2 response - client will need to use /history_v2/:prompt_id

This commit is contained in:
Richard Yu 2025-07-10 15:49:27 -07:00
parent a2b8688e20
commit fdc2a53653
2 changed files with 17 additions and 2 deletions

View File

@ -1135,6 +1135,9 @@ class PromptQueue:
# Extract and filter prompt data
if "prompt" in history_entry:
priority, prompt_id, _, extra_data, _ = history_entry["prompt"]
# Remove workflow from extra_pnginfo
if "extra_pnginfo" in extra_data:
extra_data["extra_pnginfo"].pop("workflow", None)
filtered_prompt = [priority, prompt_id, extra_data]
else:
filtered_prompt = None

View File

@ -759,7 +759,13 @@ class TestExecution:
12345, # priority/timestamp
'test-prompt-123', # prompt_id
{'nodes': {'1': {'class_type': 'SaveImage'}}}, # workflow (should be filtered)
{'client_id': 'test-client'}, # extra_data
{ # extra_data
'client_id': 'test-client',
'extra_pnginfo': {
'workflow': {'nodes': {'1': {'class_type': 'SaveImage'}}}, # Should be filtered out
'version': '1.0' # Should be preserved
}
},
['1'] # execute_outputs (should be filtered)
)
@ -798,7 +804,13 @@ class TestExecution:
# Verify correct elements are preserved
assert filtered_prompt[0] == 12345, "Priority should be preserved"
assert filtered_prompt[1] == 'test-prompt-123', "Prompt ID should be preserved"
assert filtered_prompt[2] == {'client_id': 'test-client'}, "Extra data should be preserved"
# Verify extra_data filtering
extra_data = filtered_prompt[2]
assert extra_data['client_id'] == 'test-client', "Client ID should be preserved"
assert 'extra_pnginfo' in extra_data, "extra_pnginfo should be present"
assert 'workflow' not in extra_data['extra_pnginfo'], "Workflow should be filtered out"
assert extra_data['extra_pnginfo']['version'] == '1.0', "Other extra_pnginfo data should be preserved"
# Verify other fields are unchanged
assert history_item["outputs"] == {'1': {'images': []}}, "Outputs should be unchanged"