Skip to content

Editor AI panel can't handle escaped strings #35

Description

@stmh

I try to use the ai panel to replace a template of a node processor. Here's the chat transcript:

[
  {
    "role": "user",
    "content": "currently the commit message description is using a static text. use the result of the agent together with the static text"
  },
  {
    "role": "assistant",
    "content": "Looking at the workflow, the commit message currently uses a static `value.4` node with `\"chore(deps): apply Composer security updates\"`. You want to combine the agent's `summary` output with that static text as the commit message.\n\nThe best approach is to use a **Template** node, which accepts a `data` (JSON) input and renders a template string. I'll:\n\n1. Add a `template` node that receives a merged JSON object containing the agent summary and the static prefix.\n2. Use a **Merge** node to combine the agent `summary` with the static commit prefix into a single JSON object.\n3. Wire the template output to `git_commit_and_push.1:commit_message` instead of `value.4`.\n4. Keep `value.4` for the static prefix text, repurposing it as input to the merge.\n\nLet me also reconfigure `value.4` to hold just the prefix string, add a `merge` node, and add a `template` node.\n\n```flowdrop\n# Step 1 — repurpose value.4 as the static commit prefix\nset value.4:value \"chore(deps): apply Composer security updates\"\nrename value.4 Commit Prefix\n\n# Step 2 — add a Merge node to combine summary + prefix into one JSON object\nadd merge at 1660,200\nrename merge.1 Merge Commit Data\n\n# Step 3 — configure the Merge node's dynamic inputs\nset merge.1:dynamicInputs [{\"id\":\"prefix\",\"name\":\"Prefix\",\"dataType\":\"mixed\"},{\"id\":\"summary\",\"name\":\"Summary\",\"dataType\":\"mixed\"}]\n\n# Step 4 — add a Template node to render the final commit message\nadd template at 1940,200\nrename template.1 Commit Message Template\n\n# Step 5 — set the template string (prefix on line 1, blank line, then the agent summary)\nset template.1:template \"\"\"{{prefix}}\n\n{{summary}}\"\"\"\n\n# Step 6 — disconnect value.4 from git_commit_and_push.1:commit_message\ndisconnect value.4:value from git_commit_and_push.1:commit_message\n\n# Step 7 — wire value.4 (prefix) and agent.1 (summary) into the Merge node\nconnect value.4:value to merge.1:prefix\nconnect agent.1:summary to merge.1:summary\n\n# Step 8 — wire Merge output into Template\nconnect merge.1:output to template.1:data\n\n# Step 9 — wire Template output to the commit message input\nconnect template.1:output to git_commit_and_push.1:commit_message\n\n# Step 10 — tidy up\nlayout beautify\ncanvas fitview\n```\n\nHere's how the data flows:\n\n- **Commit Prefix** (`value.4`) → `merge.1:prefix` — still holds the static subject line.\n- **agent.1:summary** → `merge.1:summary` — the agent's per-project report of what was found and changed.\n- **merge.1** combines both into `{ \"prefix\": \"...\", \"summary\": \"...\" }`.\n- **template.1** renders them as:\n  ```\n  chore(deps): apply Composer security updates\n\n  <agent summary here>\n  ```\n- That rendered string goes to `git_commit_and_push.1:commit_message`.\n\nThis gives you a rich commit message with a conventional-commit subject line followed by the agent's detailed findings as the body."
  },
  {
    "role": "user",
    "content": "try again"
  },
  {
    "role": "assistant",
    "content": "Looking at the current workflow state, the previous commands were applied successfully. The merge node (`merge.1`) and template node (`template.1`) should already exist based on the last response. However, since the workflow state shown doesn't reflect those changes, let me re-apply the full set of changes cleanly.\n\n```flowdrop\n# Repurpose value.4 as the static commit prefix (it already has the right value)\nrename value.4 Commit Prefix\n\n# Add a Merge node to combine the agent summary + static prefix\nadd merge at 1660,200\nrename merge.1 Merge Commit Data\nset merge.1:dynamicInputs [{\"id\":\"prefix\",\"name\":\"Prefix\",\"dataType\":\"mixed\"},{\"id\":\"summary\",\"name\":\"Summary\",\"dataType\":\"mixed\"}]\n\n# Add a Template node to render the final commit message\nadd template at 1940,200\nrename template.1 Commit Message Template\nset template.1:template \"\"\"{{prefix}}\n\n{{summary}}\"\"\"\n\n# Disconnect the static value.4 from the commit message input\ndisconnect value.4:value from git_commit_and_push.1:commit_message\n\n# Wire value.4 (prefix) and agent.1 (summary) into the Merge node\nconnect value.4:value to merge.1:prefix\nconnect agent.1:summary to merge.1:summary\n\n# Wire Merge output into the Template node\nconnect merge.1:output to template.1:data\n\n# Wire Template output to the commit message input\nconnect template.1:output to git_commit_and_push.1:commit_message\n\n# Tidy up\nlayout beautify\ncanvas fitview\n```\n\nHere's how it works:\n\n- **`value.4` (Commit Prefix)** still holds `\"chore(deps): apply Composer security updates\"` — the conventional-commit subject line.\n- **`merge.1`** combines the prefix string and the agent's `summary` output into a single JSON object `{ \"prefix\": \"...\", \"summary\": \"...\" }`.\n- **`template.1`** renders them using `{{prefix}}` and `{{summary}}` placeholders, producing a two-part commit message: the subject line followed by a blank line and the agent's full findings as the body.\n- The rendered string flows into `git_commit_and_push.1:commit_message`."
  }
]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions