$ cat workspace-template.yaml

S

Social Content generator

// generate social media content post

Document Generation
#social#content generation

// Canvas Preview

canvas.flow

// Instruction

instruction.md

社交媒体产品图片生成器

Overview

This workflow generates a comprehensive set of social media marketing images for a product, categorized into "Scene," "Close-up," and "With Person" styles. It requires a source product image from Google Drive and optional reference images to produce a user-defined number of variations per category, with unique prompt variations for each node to ensure visual diversity.

Workflow Chain

[File]  -> [Drive Image Reader]    -> [Image Edit (场景1, 2, 3...)]    -> [Image Edit (特写1, 2, 3...)]    -> [Image Edit (潮人图片1, 2, 3...)][场景参考图 / 特写参考图]  -> [Image Edit (对应节点)][Load avatar image from drive / Create new avatar image / Pick avatar from another workspace]  -> [Image Edit (潮人图片1, 2, 3...)]

Node Reference

  • File: Selects the source product image from Drive; feeds Drive Image Reader.
  • Drive Image Reader: Converts the selected file into an image format; feeds all Image Edit nodes.
  • Image Edit: Processes reference images with a unique prompt to generate stylized output; configurable via prompt, aspect_ratio, and seed.
  • Image Creation: Generates a new avatar image from a text prompt; feeds With Person nodes.
  • Workspace Picker: Selects an external workspace to source an avatar; feeds With Person nodes.
  • Reference Image Readers: Optional nodes to provide specific style guidance for Scene or Close-up generations.

Execution Strategy

You MUST complete all 3 phases in order: Phase 1 -> Phase 2 -> Phase 3. Do NOT skip any phase.

Phase 1: Initialization and User Input

  1. Call requestUserDecision to gather:
    • "What is the core theme/environment for the images?" (Context: Base theme for all prompts).
    • "How many images per group (1-5)?" (Context: Determines node count).
    • "What is the source product image?" (Context: Sets driveItemId).
    • "Do you want to publish these images to social media upon completion?" (Context: Terminal side-effect).
  2. Phase 1 complete. Now proceed to Phase 2. Do NOT skip to Phase 3.

Phase 2: Configuration and Node Management 3. Use nodeFinder to locate the File node and upsertNode to set the driveItemId. 4. For each category (Scene, Close-up, With Person), compare the current node count against the user's requested number:

  • If current count < requested: Use batchCloneNodes to add missing nodes.
  • If current count > requested: Use nodeFinder to identify and remove extra nodes.
  1. For EACH Image Edit node, use upsertNode to update the prompt field with unique stylistic modifiers.
  2. Perform layout maintenance:
    • Use sectionFinder to identify the relevant section IDs.
    • For each section, call sectionManager(ungroup, { sectionId }).
    • Call organizeNodes to arrange the updated node set.
    • Call sectionManager(group, { nodeIds, label }) to re-group the nodes.
    • Call autoLayout() to finalize the canvas.
  3. Phase 2 complete. Now proceed to Phase 3. Do NOT skip to Phase 3.

Phase 3: Execution and Finalization 8. Use nodeExecutor to trigger the Image Edit nodes for all active groups. 9. If the publish decision in Phase 1 was "Yes", perform the final post-generation action. 10. Call followUp to present the generated images to the user for review.

Configuration Tips

User saysConfigure
"Use dark theme"Image Edit: prompt="dark moody aesthetic"
"High quality"Image Edit: megapixel=4
"Portrait mode"Image Edit: aspect_ratio=0.5625

Error Handling

  • Missing Drive File: Ensure the driveItemId is valid; use searchDriveItems to verify existence.
  • Connection Failure: If upsertEdge fails, use nodeFinder to verify the portType matches between source and target.
  • Generation Timeout: If Image Edit fails, reduce megapixel to 1.0 and retry.

Incremental Edits to an Existing Workflow

  • Detection: If the canvas already contains nodes, treat the request as an edit.
  • Add / remove / reorder recipes: Use batchCloneNodes for additions; use nodeFinder + deleteNode for removals. Always re-run the layout sequence (ungroup -> organizeNodes -> group -> autoLayout) after structural changes.
  • Post-edit: Re-run pre-execution verification, then honor the publish decision (re-present the gate under the post-build pattern).

// Dependencies

requirements.py
1from input import File2from input import DriveImageReader3from process import ImageEdit4from process import ImageCreation5from input import WorkspacePicker

$ git log --oneline

v1.0.7
HEAD
2026-06-08
v1.0.62026-05-29
v1.0.52026-05-29
v1.0.42026-05-29
v1.0.32026-05-29
v1.0.22026-05-29
v1.0.12026-05-29
v1.0.02026-05-29