Files
jeremieLouvaert-ComfyUI-API…/workflows/prompt_studio_styled_generation.json
jeremie louvaert 819843c4ee Add prompt_studio_styled_generation demo workflow
Wires Prompt Studio Settings (new in Gemini-Direct v1.2.0) → Prompt Studio
+ Hash Vault any_input_2 → Hash Vault Check Cache, with the
brief STRING driving both Prompt Studio.brief and Hash Vault.payload_string.
Cache key = (brief + style), so changing either invalidates correctly.
Label Builder auto-formats the sidecar label as 'brief / style'.

Lazy API Switch bypasses the entire Prompt Studio + Gemini + Save chain on
cache hit. Demonstrates the canonical from-scratch generation pattern with
full caching.
2026-04-26 09:52:44 +02:00

279 lines
10 KiB
JSON

{
"id": "akurate-promptstudio-styled-demo",
"revision": 0,
"last_node_id": 11,
"last_link_id": 14,
"nodes": [
{
"id": 1,
"type": "Note",
"pos": [40, 20],
"size": [1900, 220],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {},
"widgets_values": [
"PROMPT STUDIO + GEMINI + HASH VAULT — generate a styled image from a creative brief, with full caching and style-aware cache keys.\n\nFLOW\nThe Prompt Studio Settings node is the single source of truth for the photographer style. Its STRING output drives BOTH Prompt Studio's converted-to-input style slot AND Hash Vault's any_input_2 slot. Brief drives Hash Vault's payload_string. So the cache key = (brief + style). Re-run with the same brief AND same style → hit, $0.00 billed. Change either one → new hash → Prompt Studio enhances, Gemini generates, Save persists.\n\nLAZY BYPASS: on a cache hit, the Lazy API Switch demands ONLY the cached_data branch. Prompt Studio + Gemini + Save never execute, so no Flash and no Pro Image cost.\n\nSTYLE: pick a photographer on the Prompt Studio Settings dropdown. The DNA prompt for that photographer is fed to Gemini Flash via Prompt Studio, which expands your brief into an authentic styled prompt. This is the GENERATION path — use it when you want a fresh image in a photographer's voice. (Style Transfer is the other path: image-in → image-out polish, only works when source DNA is close to target.)\n\nLABEL BUILDER auto-formats the Hash Vault label as 'brief / style' so the Browser shows what was generated. Both inputs are wired upstream so the label always reflects the actual generation parameters — nothing to keep in sync manually.\n\nREQUIRES: ComfyUI-API-Optimizer >= 1.4.2 (Hash Vault + Label Builder), ComfyUI-Gemini-Direct >= 1.2.0 (Prompt Studio + Prompt Studio Settings + Gemini Image Generate), ComfyUI-KJNodes (StringConstantMultiline). Gemini API key in gemini_api_key.txt at ComfyUI root."
]
},
{
"id": 2,
"type": "StringConstantMultiline",
"pos": [40, 260],
"size": [360, 200],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [
{"name": "string", "type": "STRING", "widget": {"name": "string"}, "link": null},
{"name": "strip_newlines", "type": "BOOLEAN", "widget": {"name": "strip_newlines"}, "link": null}
],
"outputs": [
{"name": "STRING", "type": "STRING", "links": [1, 2, 3], "slot_index": 0}
],
"properties": {
"cnr_id": "comfyui-kjnodes",
"Node name for S&R": "StringConstantMultiline"
},
"widgets_values": [
"An elderly Parisian bookseller in his shop, golden hour side light through the window, leather-bound books out of focus behind him",
false
],
"title": "Brief"
},
{
"id": 11,
"type": "PromptStudioSettings",
"pos": [40, 500],
"size": [360, 80],
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{"name": "style", "type": "COMBO", "widget": {"name": "style"}, "link": null}
],
"outputs": [
{"name": "style", "type": "*", "links": [13, 14], "slot_index": 0}
],
"properties": {
"cnr_id": "comfyui-gemini-direct",
"Node name for S&R": "PromptStudioSettings"
},
"widgets_values": ["Alec Soth"]
},
{
"id": 4,
"type": "PromptStudio",
"pos": [440, 240],
"size": [400, 380],
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{"name": "brief", "type": "STRING", "widget": {"name": "brief"}, "link": 1},
{"name": "mode", "type": "COMBO", "widget": {"name": "mode"}, "link": null},
{"name": "model", "type": "COMBO", "widget": {"name": "model"}, "link": null},
{"name": "style", "type": "*", "widget": {"name": "style"}, "link": 13},
{"name": "images", "type": "IMAGE", "shape": 7, "link": null},
{"name": "previous_prompt", "type": "STRING", "shape": 7, "link": null},
{"name": "feedback", "type": "STRING", "widget": {"name": "feedback"}, "shape": 7, "link": null},
{"name": "custom_instructions", "type": "STRING", "widget": {"name": "custom_instructions"}, "shape": 7, "link": null},
{"name": "api_key", "type": "STRING", "widget": {"name": "api_key"}, "shape": 7, "link": null}
],
"outputs": [
{"name": "enhanced_prompt", "type": "STRING", "links": [4], "slot_index": 0},
{"name": "analysis", "type": "STRING", "links": [], "slot_index": 1}
],
"properties": {
"cnr_id": "comfyui-gemini-direct",
"Node name for S&R": "PromptStudio"
},
"widgets_values": [
"",
"Expand",
"gemini-3-flash-preview",
"Alec Soth",
"",
"",
""
]
},
{
"id": 5,
"type": "DeterministicHashVault",
"pos": [440, 660],
"size": [340, 180],
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{"name": "payload_string", "type": "STRING", "link": 2},
{"name": "any_input", "type": "*", "shape": 7, "link": null},
{"name": "any_input_2", "type": "*", "shape": 7, "link": 14},
{"name": "any_input_3", "type": "*", "shape": 7, "link": null},
{"name": "any_input_4", "type": "*", "shape": 7, "link": null},
{"name": "cache_ttl_hours", "type": "FLOAT", "widget": {"name": "cache_ttl_hours"}, "shape": 7, "link": null}
],
"outputs": [
{"name": "cached_data", "type": "*", "links": [5], "slot_index": 0},
{"name": "is_cached", "type": "INT", "links": [6], "slot_index": 1},
{"name": "hash_key", "type": "STRING", "links": [7], "slot_index": 2}
],
"properties": {
"cnr_id": "comfyui-api-optimizer",
"Node name for S&R": "DeterministicHashVault"
},
"widgets_values": [0.0]
},
{
"id": 6,
"type": "GeminiImageGenerate",
"pos": [880, 240],
"size": [380, 320],
"flags": {},
"order": 5,
"mode": 0,
"inputs": [
{"name": "prompt", "type": "STRING", "widget": {"name": "prompt"}, "link": 4},
{"name": "model", "type": "COMBO", "widget": {"name": "model"}, "link": null},
{"name": "seed", "type": "INT", "widget": {"name": "seed"}, "link": null},
{"name": "aspect_ratio", "type": "COMBO", "widget": {"name": "aspect_ratio"}, "link": null},
{"name": "resolution", "type": "COMBO", "widget": {"name": "resolution"}, "link": null},
{"name": "response_modalities", "type": "COMBO", "widget": {"name": "response_modalities"}, "link": null},
{"name": "images", "type": "IMAGE", "shape": 7, "link": null},
{"name": "system_prompt", "type": "STRING", "widget": {"name": "system_prompt"}, "shape": 7, "link": null},
{"name": "api_key", "type": "STRING", "widget": {"name": "api_key"}, "shape": 7, "link": null}
],
"outputs": [
{"name": "images", "type": "IMAGE", "links": [9], "slot_index": 0},
{"name": "text", "type": "STRING", "links": [], "slot_index": 1},
{"name": "cost_info", "type": "STRING", "links": [], "slot_index": 2},
{"name": "cache_key", "type": "STRING", "links": [], "slot_index": 3}
],
"properties": {
"cnr_id": "comfyui-gemini-direct",
"Node name for S&R": "GeminiImageGenerate"
},
"widgets_values": [
"",
"gemini-3-pro-image-preview",
0,
"2:3",
"2K",
"IMAGE+TEXT",
"",
""
]
},
{
"id": 7,
"type": "HashVaultLabelBuilder",
"pos": [880, 600],
"size": [340, 180],
"flags": {},
"order": 6,
"mode": 0,
"inputs": [
{"name": "separator", "type": "STRING", "widget": {"name": "separator"}, "link": null},
{"name": "in_1", "type": "*", "shape": 7, "link": 3},
{"name": "in_2", "type": "*", "shape": 7, "link": 11},
{"name": "in_3", "type": "*", "shape": 7, "link": null},
{"name": "in_4", "type": "*", "shape": 7, "link": null}
],
"outputs": [
{"name": "label", "type": "STRING", "links": [10], "slot_index": 0}
],
"properties": {
"cnr_id": "comfyui-api-optimizer",
"Node name for S&R": "HashVaultLabelBuilder"
},
"widgets_values": [" / "]
},
{
"id": 8,
"type": "HashVaultSave",
"pos": [1300, 240],
"size": [320, 110],
"flags": {},
"order": 7,
"mode": 0,
"inputs": [
{"name": "hash_key", "type": "STRING", "link": 7},
{"name": "api_output", "type": "*", "link": 9},
{"name": "label", "type": "STRING", "widget": {"name": "label"}, "shape": 7, "link": 10}
],
"outputs": [
{"name": "api_output", "type": "*", "links": [12], "slot_index": 0}
],
"properties": {
"cnr_id": "comfyui-api-optimizer",
"Node name for S&R": "HashVaultSave"
},
"widgets_values": [""]
},
{
"id": 9,
"type": "LazyAPISwitch",
"pos": [1660, 240],
"size": [320, 130],
"flags": {},
"order": 8,
"mode": 0,
"inputs": [
{"name": "is_cached", "type": "INT", "link": 6},
{"name": "cached_data", "type": "*", "shape": 7, "link": 5},
{"name": "api_data", "type": "*", "shape": 7, "link": 12}
],
"outputs": [
{"name": "final_output", "type": "*", "links": [8], "slot_index": 0}
],
"properties": {
"cnr_id": "comfyui-api-optimizer",
"Node name for S&R": "LazyAPISwitch"
},
"widgets_values": []
},
{
"id": 10,
"type": "PreviewImage",
"pos": [1660, 420],
"size": [420, 400],
"flags": {},
"order": 9,
"mode": 0,
"inputs": [
{"name": "images", "type": "IMAGE", "link": 8}
],
"outputs": [],
"properties": {
"cnr_id": "comfy-core",
"Node name for S&R": "PreviewImage"
},
"widgets_values": []
}
],
"links": [
[1, 2, 0, 4, 0, "STRING"],
[2, 2, 0, 5, 0, "STRING"],
[3, 2, 0, 7, 1, "*"],
[4, 4, 0, 6, 0, "STRING"],
[5, 5, 0, 9, 1, "*"],
[6, 5, 1, 9, 0, "INT"],
[7, 5, 2, 8, 0, "STRING"],
[8, 9, 0, 10, 0, "IMAGE"],
[9, 6, 0, 8, 1, "*"],
[10, 7, 0, 8, 2, "STRING"],
[11, 11, 0, 7, 2, "*"],
[12, 8, 0, 9, 2, "*"],
[13, 11, 0, 4, 3, "*"],
[14, 11, 0, 5, 2, "*"]
],
"groups": [],
"config": {},
"extra": {},
"version": 0.4
}