ComfyUI Node

Aiv Param

Turn your ComfyUI workflow into a form your users can't break

By bbtaivi·Created 2 years ago·Updated 2 years ago· 1
Aiv Param
      text_param[ {"id": 18, "name": "clip", "title": "这是参数例子, 详情参考下面的说明","default":"一个漂亮的女孩", "option": {"type": "text", "multi": true, "tooltip": "请在此输入提示词(中文)"} } ]
      text_note 上面输入框填写格式: json格式数组,每个参数一个对象元素,之间用豆号","分隔, 参考如下: [ {"id": 18, "name": "clip", "title": "提示词", "option": {"type": "text", "multi": true, "clear": true, "tooltip": "请在此输入提示词内容(中文)"} }, {"id": 30, "name": "seed", "title": "种子", "default": 512356789158, "option": {"type": "seed"} }, {"id": 21, "name": "steps", "title": "步数", "option": {"type": "number", "step": 1, "min": 1, "max": 100} }, {"id": 21, "name": "enabled", "title": "启用", "default": true, "option": {"type": "bool", "tooltip": "开启人脸增强效果"} }, {"id": 25, "name": "model", "title": "模型", "default": "GFPGANv1.4.pth", "order": 10, "option": {"type": "combo", "values": ["GFPGANv1.3.pth", "GFPGANv1.4.pth","GPEN-BFR-512.onnx"]} }, {"id": 117, "name": "image", "title": "上传头像", "required": true, "option": {"type": "file", "min": 1, "max": 2048, "ext": ".jpeg,.png,.webp" } } {"id": 119, "name": "audio", "title": "上传音频", "required": false, "option": {"type": "file", "min": 0, "max": 1024, "ext": "$audio", "tooltip": "如果不上传音频则使用系统预设值"} } ] 注意事项: - 每个工作流只能有一个 Aiv Param 节点; - 注意检查 json 格式是否正确, 可以使用在线网站检测; - 参数设置中,必需字段是"id"、"name",其它可选,默认是'text'类型, "id"对应ComfyUI节点的序列号(如果不知道如何显示ComfyUI节点序列中,请上网查询),"name"是节点的参数名(如果不知道参数名,可以先保存为json,再打开看); - 参数设置尽量指定参数类型,支持的类型有: "text"、"number"、"bool"、"seed"(种子)、"combo"(下拉框)、"file"(打开文件)等, "option"字段可以设置数据类型的一些属性; - "text"类型可以设置"multi"单多行, "clear"任务启动后是否自动清除,默认是自动清除 - "order"字段对参数排序显示,大值排前面(不填默认为10); "required"标识是否必填参数,未设置默认为true; - 设计好工作流后,使用ComfyUI的 Workflow -> Export(API) 菜单把工作流导出为API格式文件,在AIV平台写py代码调用json文件即可; - "file"类型参数可以指定限制文件大小的"min","max" 属性, 也可以指定文件扩展名 "ext": 文件扩展名可以指定"$audio"、"$image"、"$video"、"$text"这样的变量;

      Aiv Param is the bridge between a ComfyUI workflow and people who will never open ComfyUI. You build the full graph - loaders, samplers, face restore, the works - and this node turns the few knobs you care about into a clean form: a prompt box, a seed, a steps slider, an image upload. Your end users tweak that form inside the AIV platform (WeChat mini-programs, web apps, native apps) and the AIV agent runs your exported workflow behind the scenes. It's the "parameterize my workflow for customers" play.

      Which means the honest caveat up front: if you're not publishing through AIV's platform with their aivagent Python SDK (pypi.org/project/aivagent, the platform itself is aiv.store), this node does literally nothing for you. It has no outputs. It doesn't run code. It's a JSON config blob plus a frontend nicety, useless as a standalone utility. That's a feature, not a bug - it's a deployment tool, aimed at builders shipping AI apps in the Chinese ecosystem where mini-programs are the default distribution channel.

      How it actually works

      The server side is a joke in the best way: execute() is literally pass. All the work happens in js/check.js, which hooks the node's text_param widget and overrides its value getter/setter. When ComfyUI saves the workflow, the getter escapes every { and } with a backslash so your nested JSON survives serialization and can be json.loads()'d on the other end; when it renders the textarea, the setter strips those escapes back off so what you see is clean, valid JSON. That's the entire mechanism - no API calls, no models, no GPU. It's a frontend formatting node wearing a utility costume.

      You interact with it through two multiline text fields, and only one matters:

      • text_param - the JSON array of parameters you're exposing. This is the whole node.
      • text_note - a read-only-ish usage manual the author ships as the default. Leave it be.

      There are no outputs, and you don't wire anything in or out. The node's job is to be read, not connected.

      The JSON you actually write

      Each element of the array is one exposed parameter. Only two fields are mandatory: id (the ComfyUI serial number of the node whose input you're exposing - export your workflow to API JSON if you don't know it) and name (that node's parameter name, e.g. seed, steps, text). Everything else is optional but useful:

      [
        {"id": 18, "name": "text", "title": "提示词", "option": {"type": "text", "multi": true, "tooltip": "prompt goes here"}},
        {"id": 30, "name": "seed", "title": "Seed", "default": 512356789158, "option": {"type": "seed"}},
        {"id": 21, "name": "steps", "title": "Steps", "option": {"type": "number", "min": 1, "max": 100, "step": 1}},
        {"id": 117, "name": "image", "title": "Upload", "required": true, "option": {"type": "file", "ext": ".jpeg,.png,.webp"}}
      ]
      

      The option.type drives what widget the end user gets: text, number, bool, seed, combo (a dropdown - pass values), or file (upload, with min/max size limits and ext filters, including variables like $audio or $video). order sorts them (bigger first, default 10) and title is the label. The author's sample even shows exposing a face-restore model as a combo - but note that GFPGAN/GPEN only appear in the example text; this pack downloads nothing.

      Installing it

      Easiest via ComfyUI Manager - search "AIV ComfyUI Node" (author bbtaivi, it's in the registry) and install. Or the manual way:

      cd ComfyUI/custom_nodes
      git clone https://github.com/bbtaivi/ComfyUI-Aiv-Param
      

      Restart ComfyUI. There's no requirements.txt, no pip deps, no model downloads - the whole pack is one Python file, one JS file, and an image. It's as lightweight as custom nodes get.

      Where people get burned

      • Valid JSON, always. The node won't throw a helpful error on a stray comma - it just won't do what you expect. The author suggests checking your array in an online JSON validator before you fight it.
      • One AivParam per workflow, period. The docs are explicit. If you need more, restructure, don't duplicate.
      • Wrong id. Get the node serial wrong and you're silently exposing a different node's parameter. Export → API is your friend.
      • clear is on by default. For text params, the input auto-clears after a task runs unless you set "clear": false. Great for prompts, infuriating if you didn't expect it.

      It's a niche, single-purpose node with zero community footprint - but if you're shipping AIV apps, it's the whole interface between your graph and your users.

      Categoryutils

      Inputs (2)

      NameTypeDefaultDescription
      text_paramSTRING[ {"id": 18, "name": "clip", "title": "这是参数例子, 详情参考下面的说明","default":"一个漂亮的女孩", "option": {"type": "text", "multi": true, "tooltip": "请在此输入提示词(中文)"} } ] <请在此输入需要输出的参数设置(json格式)>
      text_noteSTRING 上面输入框填写格式: json格式数组,每个参数一个对象元素,之间用豆号","分隔, 参考如下: [ {"id": 18, "name": "clip", "title": "提示词", "option": {"type": "text", "multi": true, "clear": true, "tooltip": "请在此输入提示词内容(中文)"} }, {"id": 30, "name": "seed", "title": "种子", "default": 512356789158, "option": {"type": "seed"} }, {"id": 21, "name": "steps", "title": "步数", "option": {"type": "number", "step": 1, "min": 1, "max": 100} }, {"id": 21, "name": "enabled", "title": "启用", "default": true, "option": {"type": "bool", "tooltip": "开启人脸增强效果"} }, {"id": 25, "name": "model", "title": "模型", "default": "GFPGANv1.4.pth", "order": 10, "option": {"type": "combo", "values": ["GFPGANv1.3.pth", "GFPGANv1.4.pth","GPEN-BFR-512.onnx"]} }, {"id": 117, "name": "image", "title": "上传头像", "required": true, "option": {"type": "file", "min": 1, "max": 2048, "ext": ".jpeg,.png,.webp" } } {"id": 119, "name": "audio", "title": "上传音频", "required": false, "option": {"type": "file", "min": 0, "max": 1024, "ext": "$audio", "tooltip": "如果不上传音频则使用系统预设值"} } ] 注意事项: - 每个工作流只能有一个 Aiv Param 节点; - 注意检查 json 格式是否正确, 可以使用在线网站检测; - 参数设置中,必需字段是"id"、"name",其它可选,默认是'text'类型, "id"对应ComfyUI节点的序列号(如果不知道如何显示ComfyUI节点序列中,请上网查询),"name"是节点的参数名(如果不知道参数名,可以先保存为json,再打开看); - 参数设置尽量指定参数类型,支持的类型有: "text"、"number"、"bool"、"seed"(种子)、"combo"(下拉框)、"file"(打开文件)等, "option"字段可以设置数据类型的一些属性; - "text"类型可以设置"multi"单多行, "clear"任务启动后是否自动清除,默认是自动清除 - "order"字段对参数排序显示,大值排前面(不填默认为10); "required"标识是否必填参数,未设置默认为true; - 设计好工作流后,使用ComfyUI的 Workflow -> Export(API) 菜单把工作流导出为API格式文件,在AIV平台写py代码调用json文件即可; - "file"类型参数可以指定限制文件大小的"min","max" 属性, 也可以指定文件扩展名 "ext": 文件扩展名可以指定"$audio"、"$image"、"$video"、"$text"这样的变量; 这是使用说明

      Outputs (0)

      No outputs