AI 驱动文档
您想了解什么?
如何在 Node-RED 中使用 ChatGPT
This deep dive demonstrates how to use ChatGPT with Node‑RED.
注意事项
All Block Outputs包含在触发图像后输出的所有信息。
- 从
All Block Outputs中复制调试输出。

All Block Outputs
此节点在相机每次捕获后输出数据,包含所有 AI 块数据。数据以 JSON 对象的形式呈现。数据包括以下内容:
| Payload Field | Type | Description |
|---|---|---|
payload.capture_id | integer | 此捕获的捕获 ID |
payload.recipe_id | integer | 此配方的配方 ID |
payload.camera_id | string | 此相机的唯一字符串标识符 |
payload.inspection_id | integer | 每次检查递增的 16 位滚动整数 |
payload.inspection_time | string | 每次检查的捕获的 ISO 8601 格式时间戳 |
payload.image_url | string | 捕获图像的 HTTP URL(jpg) |
payload.alignment.success | boolean | 部件是否成功对齐 |
payload.alignment.center_location_x | integer | 对齐部件的中心位置 x |
payload.alignment.center_location_y | integer | 对齐部件的中心位置 y |
payload.alignment.confidence | float (0-1) | 对齐的置信度 |
ChatGPT/Gemini/Copilot
- 输入提示:“Here is the Input I have from Node Red : Insert the copied value here. enter prompt when you want it to fail and return msg.payload in boolean True or False”

示例
- 在这里,我们教 AI 查找安装板上的孔。

- 从 Node-RED 的
debug块中复制值,并将其粘贴到 ChatGPT 中,使用以下示例提示。- “Here is the Input I have from Node Red : Insert the copied value here. I want the camera to fail if there are less than 11 holes and return msg.payload in boolean True or False”

- 查看
function块并阅读逻辑上的注释。 - 检查它是否执行了正确的操作(所要求的),如果是,请复制它给你的代码。
- 从节点中获取一个
function节点,并将其连接到Inspection Pass/Fail块。


- 复制
function块中的代码,确保所有节点正确连接,然后点击 Deploy。


