{
  "name": "Define Selected Term",
  "description": "Highlight any word or term, right-click, and get a short, clear definition — generated privately on your own device.",
  "tags": [
    "dictionary",
    "definitions",
    "ai",
    "local ai",
    "reading",
    "right-click"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "📖 Define any term.\n\nHighlight a word or term on any page, right-click, and choose this workflow — it gives a short, clear definition and shows it right there. The AI runs locally in your browser; nothing leaves your device. Pick a model the first time.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 340,
      "height": 190,
      "measured": {
        "width": 340,
        "height": 190
      }
    },
    {
      "id": "trigger-context-menu",
      "position": {
        "x": 100,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:contextMenu"
        },
        "label": "Right-click a selection",
        "inputs": {
          "contexts": [
            "selection"
          ]
        },
        "parameters": {
          "notes": "Adds this workflow to the right-click menu whenever you have text selected."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "trigger",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "get-selection",
      "position": {
        "x": 285,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:getSelectedTextNode"
        },
        "label": "Get selected text",
        "inputs": {
          "outputFieldName": "selection",
          "options": {
            "includeInputFields": true
          }
        },
        "parameters": {
          "notes": "Reads the full text you highlighted on the page. The context-menu event only carries a short, truncated copy, so this node gets the complete selection reliably."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      },
      "selected": false,
      "dragging": false
    },
    {
      "id": "define",
      "position": {
        "x": 440,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:agent:basicLLMChain"
        },
        "label": "Define the term",
        "inputs": {
          "prompt": "Give a short, clear definition of this term:\n\n{{ $input.selection }}"
        },
        "parameters": {
          "notes": "Writes a short, clear definition of your selected term."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "agent",
      "measured": {
        "width": 144,
        "height": 50
      }
    },
    {
      "id": "local-model",
      "position": {
        "x": 440,
        "y": 500
      },
      "data": {
        "instance": {
          "id": "af-base-node:dependency:webLLM"
        },
        "label": "Local AI model",
        "inputs": {
          "model": "",
          "options": {
            "temperature": 0.5
          }
        },
        "parameters": {
          "notes": "Runs the AI model locally in your browser. Pick a model the first time — nothing is sent to a server."
        },
        "runned": false,
        "isRunning": false,
        "failed": false,
        "wasRunned": false,
        "skipped": false
      },
      "type": "dependency",
      "measured": {
        "width": 30,
        "height": 30
      },
      "selected": true
    },
    {
      "id": "show-definition",
      "position": {
        "x": 780,
        "y": 280
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Show the definition",
        "inputs": {
          "title": "Definition",
          "content": "{{ $input.response }}"
        },
        "parameters": {
          "notes": "Displays the definition right where you're working."
        },
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "basic",
      "measured": {
        "width": 50,
        "height": 50
      }
    },
    {
      "id": "sticky-model",
      "position": {
        "x": 440,
        "y": 660
      },
      "data": {
        "color": "#ffd9b3",
        "content": "Setup needed: pick a local model the first time you run this. It downloads once, then runs fully offline.",
        "isRunning": false,
        "runned": false,
        "wasRunned": false,
        "skipped": false,
        "failed": false
      },
      "type": "stickyNote",
      "width": 300,
      "height": 110,
      "measured": {
        "width": 300,
        "height": 110
      }
    }
  ],
  "edges": [
    {
      "id": "e-ctx-get-selection",
      "type": "flowEdge",
      "source": "trigger-context-menu",
      "target": "get-selection",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-trigger-define",
      "type": "flowEdge",
      "source": "get-selection",
      "target": "define",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-define-model",
      "type": "flowEdge",
      "source": "define",
      "target": "local-model",
      "sourceHandle": "dependency-0",
      "markerEnd": {
        "type": "arrowclosed"
      }
    },
    {
      "id": "e-define-show",
      "type": "flowEdge",
      "source": "define",
      "target": "show-definition",
      "markerEnd": {
        "type": "arrowclosed"
      }
    }
  ],
  "requiredInputs": [
    {
      "nodeId": "local-model",
      "field": "model"
    }
  ]
}