rewrite creating-nodes
Browse files- docs/advanced-development/creating custom node.mdx +195 -0
- docs/advanced-development/creating-nodes.mdx +0 -134
- docs/img/{create-node-4.webp → create-node-1.png} +2 -2
- docs/img/{create-node-1.webp → create-node-2.png} +2 -2
- docs/img/{create-node-2.webp → create-node-3.png} +2 -2
- docs/img/{create-node-3.webp → create-node-4.png} +2 -2
- docs/img/create-node-5.png +3 -0
- docs/img/create-node-6.png +3 -0
- docs/img/create-node-7.png +3 -0
- docs/img/create-node-8.png +3 -0
docs/advanced-development/creating custom node.mdx
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
sidebar_position: 1
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# Создание кастомной ноды
|
| 6 |
+
|
| 7 |
+
Создание кастомных нод позволяет обойти ограничения, которые связаны со стандартной библиотекой нод Piper, или же даже просто улучшить функционал текущих нод.
|
| 8 |
+
Давайте создадим кастомную ноду **Merge text to JSON**, которая принимает несколько текстовых строк и объединяет их в один JSON массив.
|
| 9 |
+
|
| 10 |
+
## **1. Загрузка ноды из библиотеки нод**
|
| 11 |
+
|
| 12 |
+
Для создания кастомной ноды начните с загрузки существующей ноды, которая наиболее близка к вашим требованиям. Перейдите в библиотеку нод, используя значок **плюс (+)** в верхнем левом углу рабочего пространства пайплайны и выберите ноду **Input Text** для модификации, поскольку в ней минимум кода и она работает со строками.
|
| 13 |
+
|
| 14 |
+
После добавления ноды откройте её настройки.
|
| 15 |
+
|
| 16 |
+

|
| 17 |
+
|
| 18 |
+
Панель настроек включает несколько вкладок:
|
| 19 |
+
|
| 20 |
+
- **Inputs** - Определение входных параметров и источников данных
|
| 21 |
+
- **Design** - Настройка входных и выходных параметров
|
| 22 |
+
- **Script** - Редактирование JavaScript кода логики ноды
|
| 23 |
+
- **Environment** - Настройка переменных окружения
|
| 24 |
+
- **Catalog** - Просмотр метаданных ноды и её публикация
|
| 25 |
+
- **YAML** - Доступ к YAML ноды
|
| 26 |
+
|
| 27 |
+
## **2. Настройка дизайна ноды**
|
| 28 |
+
|
| 29 |
+
Кастомизация начинается во вкладке **Design**, где определяется структура ноды.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
|
| 33 |
+
### Основные свойства
|
| 34 |
+
- **ID** - Внутреннее имя, используемое в коде (строчные латинские символы, без пробелов)
|
| 35 |
+
- **Title** - Отображаемое имя, видимое пользователям
|
| 36 |
+
|
| 37 |
+
Для нашей ноды прежние значения необходимо заменить на:
|
| 38 |
+
- ID: `merge_text_to_json`
|
| 39 |
+
- Title: `Merge text to JSON`
|
| 40 |
+
|
| 41 |
+
### Добавление входных параметров
|
| 42 |
+
|
| 43 |
+
Нашей ноде нужно 4 строковых входа. Чтобы добавить новый вход:
|
| 44 |
+
|
| 45 |
+
1. Раскройте меню **Inputs**
|
| 46 |
+
2. Введите имя нового входа: `string1`
|
| 47 |
+
3. Нажмите **Add**
|
| 48 |
+
|
| 49 |
+

|
| 50 |
+
|
| 51 |
+
Настройте параметры входа:
|
| 52 |
+
- **Type**: string (то есть текст)
|
| 53 |
+
- **Title**: String 1 (отображается на ноде)
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
|
| 57 |
+
Повторите этот процесс для создания входов `string2`, `string3` и `string4`.
|
| 58 |
+
|
| 59 |
+
Чтобы удалить прежний входной параметр `input_text`, снимите галочку с него в меню Inputs.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
|
| 63 |
+
### Расширенные настройки входных параметров
|
| 64 |
+
|
| 65 |
+
Доступ к детальным настройкам открывается через меню-гамбургер.
|
| 66 |
+
|
| 67 |
+

|
| 68 |
+
|
| 69 |
+
Доступные опции включают:
|
| 70 |
+
|
| 71 |
+
- **Order** (число) - Задаёт порядок расположения входов в ноде
|
| 72 |
+
- **Description** (текст) - Текст всплывающей подсказки для параметра
|
| 73 |
+
- **Required** (boolean) - Делает параметр обязательным
|
| 74 |
+
- **Group** (текст) - Группирует связанные настройки
|
| 75 |
+
- **Enum** (текст) - Создает выпадающие списки с предопределенными значениями
|
| 76 |
+
- **Multiline** (boolean) - Расширяет поля String для длинного текста
|
| 77 |
+
- **Min, Max** (число) - Устанавливает ограничения для полей Integer
|
| 78 |
+
- **Step** (число) - Преобразует поле Integer в ползунок с шагом, равным значению Step
|
| 79 |
+
- **Default** - Устанавливает значения по умолчанию
|
| 80 |
+
- **Placeholder** (текст) - Показывает подсказку в пустых полях String
|
| 81 |
+
- **Schema** - Техническое поле для скриптов
|
| 82 |
+
- **Extensions** (текст) - Добавляет специальную функциональность (например, draw-mask для редактирования изображений)
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
|
| 86 |
+
### Настройка выходных параметров
|
| 87 |
+
|
| 88 |
+
Измените выходной параметр с `output_text` на `json_output`:
|
| 89 |
+
- **Type**: JSON
|
| 90 |
+
- **Title**: JSON
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
|
| 94 |
+
:::tip Tip
|
| 95 |
+
Отслеживайте ваши изменения во вкладке **Inputs**, чтобы видеть, как модификации влияют на структуру ноды.
|
| 96 |
+
:::
|
| 97 |
+
|
| 98 |
+
Следующий шаг - написание логики скрипта ноды, рассматриваемое в разделе Node Script.
|
| 99 |
+
|
| 100 |
+
--- eng ---
|
| 101 |
+
|
| 102 |
+
# Creating Custom Nodes
|
| 103 |
+
|
| 104 |
+
Creating custom nodes allows you to bypass limitations associated with Piper's standard node library, or even simply improve the functionality of current nodes.
|
| 105 |
+
Let's create a custom **Merge text to JSON** node that takes multiple text strings and combines them into a single JSON array.
|
| 106 |
+
|
| 107 |
+
## **1. Loading a Node from the Node Library**
|
| 108 |
+
|
| 109 |
+
To create a custom node, start by loading an existing node that's closest to your requirements. Navigate to the node library using the **plus (+)** icon in the top left corner of the pipeline workspace and select the **Input Text** node for modification, since it has minimal code and works with strings.
|
| 110 |
+
|
| 111 |
+
After adding the node, open its settings.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
|
| 115 |
+
The settings panel includes several tabs:
|
| 116 |
+
|
| 117 |
+
- **Inputs** - Define input parameters and data sources
|
| 118 |
+
- **Design** - Configure input and output parameters
|
| 119 |
+
- **Script** - Edit JavaScript code for node logic
|
| 120 |
+
- **Environment** - Configure environment variables
|
| 121 |
+
- **Catalog** - View node metadata and publish it
|
| 122 |
+
- **YAML** - Access the node's YAML
|
| 123 |
+
|
| 124 |
+
## **2. Configuring Node Design**
|
| 125 |
+
|
| 126 |
+
Customization begins in the **Design** tab, where the node structure is defined.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
|
| 130 |
+
### Basic Properties
|
| 131 |
+
- **ID** - Internal name used in code (lowercase Latin characters, no spaces)
|
| 132 |
+
- **Title** - Display name visible to users
|
| 133 |
+
|
| 134 |
+
For our node, the previous values need to be replaced with:
|
| 135 |
+
- ID: `merge_text_to_json`
|
| 136 |
+
- Title: `Merge text to JSON`
|
| 137 |
+
|
| 138 |
+
### Adding Input Parameters
|
| 139 |
+
|
| 140 |
+
Our node needs 4 string inputs. To add a new input:
|
| 141 |
+
|
| 142 |
+
1. Expand the **Inputs** menu
|
| 143 |
+
2. Enter the new input name: `string1`
|
| 144 |
+
3. Click **Add**
|
| 145 |
+
|
| 146 |
+

|
| 147 |
+
|
| 148 |
+
Configure the input parameters:
|
| 149 |
+
- **Type**: string (i.e., text)
|
| 150 |
+
- **Title**: String 1 (displayed on the node)
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
|
| 154 |
+
Repeat this process to create inputs `string2`, `string3`, and `string4`.
|
| 155 |
+
|
| 156 |
+
To remove the previous input parameter `input_text`, uncheck it in the Inputs menu.
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
|
| 160 |
+
### Advanced Input Parameter Settings
|
| 161 |
+
|
| 162 |
+
Access to detailed settings is opened through the hamburger menu.
|
| 163 |
+
|
| 164 |
+

|
| 165 |
+
|
| 166 |
+
Available options include:
|
| 167 |
+
|
| 168 |
+
- **Order** (number) - Sets the order of inputs in the node
|
| 169 |
+
- **Description** (text) - Tooltip text for the parameter
|
| 170 |
+
- **Required** (boolean) - Makes the parameter mandatory
|
| 171 |
+
- **Group** (text) - Groups related settings
|
| 172 |
+
- **Enum** (text) - Creates dropdown lists with predefined values
|
| 173 |
+
- **Multiline** (boolean) - Expands String fields for long text
|
| 174 |
+
- **Min, Max** (number) - Sets constraints for Integer fields
|
| 175 |
+
- **Step** (number) - Converts Integer field to slider with step equal to Step value
|
| 176 |
+
- **Default** - Sets default values
|
| 177 |
+
- **Placeholder** (text) - Shows hints in empty String fields
|
| 178 |
+
- **Schema** - Technical field for scripts
|
| 179 |
+
- **Extensions** (text) - Adds special functionality (e.g., draw-mask for image editing)
|
| 180 |
+
|
| 181 |
+

|
| 182 |
+
|
| 183 |
+
### Configuring Output Parameters
|
| 184 |
+
|
| 185 |
+
Change the output parameter from `output_text` to `json_output`:
|
| 186 |
+
- **Type**: JSON
|
| 187 |
+
- **Title**: JSON
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
|
| 191 |
+
:::tip Tip
|
| 192 |
+
Monitor your changes in the **Inputs** tab to see how modifications affect the node structure.
|
| 193 |
+
:::
|
| 194 |
+
|
| 195 |
+
The next step is writing the node's script logic, covered in the Node Script section.
|
docs/advanced-development/creating-nodes.mdx
DELETED
|
@@ -1,134 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
sidebar_position: 1
|
| 3 |
-
---
|
| 4 |
-
|
| 5 |
-
# Create Node
|
| 6 |
-
|
| 7 |
-
Creating nodes is the foundation of building pipelines in Piper. Each node provides access to a specific neural network or performs a programmed operation, and passes the results to the input of the next node in your workflow.
|
| 8 |
-
|
| 9 |
-
## **1. Adding a New Node**
|
| 10 |
-
|
| 11 |
-
To create a new node in your pipeline, locate the **plus (+)** icon in the upper left corner of the interface. This button opens the node library where you can browse and select from available nodes.
|
| 12 |
-
|
| 13 |
-

|
| 14 |
-
|
| 15 |
-
## **2. Node Library**
|
| 16 |
-
|
| 17 |
-
The node library displays all available nodes organized into logical categories to help you find the right functionality for your pipeline:
|
| 18 |
-
|
| 19 |
-

|
| 20 |
-
|
| 21 |
-
### Common Node Categories:
|
| 22 |
-
|
| 23 |
-
- **Generate images** - Nodes for generating and modifying images
|
| 24 |
-
- **Work with images** - Image processing not related to generation
|
| 25 |
-
- **Generate videos** - Nodes for video generation
|
| 26 |
-
- **Process videos** - Video processing not related to generation
|
| 27 |
-
- **Language agents** - Nodes for calling text LLM models
|
| 28 |
-
- **Analyze images** - Group of nodes for image analysis, evaluation and detection
|
| 29 |
-
- **Computer vision** - Image description nodes
|
| 30 |
-
|
| 31 |
-
Browse through the categories and click on any node to add it to your pipeline workspace.
|
| 32 |
-
|
| 33 |
-
## **3. Node Interaction**
|
| 34 |
-
|
| 35 |
-
Once a node is added to your workspace, you can interact with it using the control icons that appear when you hover over the node:
|
| 36 |
-
|
| 37 |
-

|
| 38 |
-
|
| 39 |
-
### Control Icons:
|
| 40 |
-
|
| 41 |
-
- **Hand icon (🖐️)** - Click and drag to move the node around the workspace
|
| 42 |
-
- **Notebook icon (📝)** - Opens the node configuration panel
|
| 43 |
-
|
| 44 |
-
These icons provide quick access to essential node operations without cluttering the interface.
|
| 45 |
-
|
| 46 |
-
## **4. Node Configuration**
|
| 47 |
-
|
| 48 |
-
Clicking the notebook icon opens the node settings panel where you can customize the node's behavior:
|
| 49 |
-
|
| 50 |
-
The configuration panel includes multiple tabs:
|
| 51 |
-
|
| 52 |
-
- **Inputs** - Define input parameters and data sources
|
| 53 |
-
- **Design** - Configure input and output parameters
|
| 54 |
-
- **Script** - Edit the node's JavaScript code logic
|
| 55 |
-
- **Environment** - Configure environment variables
|
| 56 |
-
- **Catalog** - View node metadata and publish it
|
| 57 |
-
- **YAML** - Access the node's YAML definition
|
| 58 |
-
|
| 59 |
-
## **5. Deleting Nodes**
|
| 60 |
-
|
| 61 |
-
To remove a node from your pipeline:
|
| 62 |
-
|
| 63 |
-
1. Click the notebook icon to open the node settings
|
| 64 |
-
2. Look for the red **Delete** button in the upper left corner of the settings panel
|
| 65 |
-
3. Click Delete to permanently remove the node from your pipeline
|
| 66 |
-
|
| 67 |
-

|
| 68 |
-
|
| 69 |
-
Be careful when deleting nodes, as this action cannot be undone and may break connections in your pipeline.
|
| 70 |
-
|
| 71 |
-
--- ru ---
|
| 72 |
-
|
| 73 |
-
# Создание ноды
|
| 74 |
-
|
| 75 |
-
Создание нод является основой построения пайплайнов в Piper. Каждая нода представляет определенную функцию или операцию, которая обрабатывает данные и передает их на следующий шаг в вашем рабочем процессе.
|
| 76 |
-
|
| 77 |
-
## **1. Добавление новой ноды**
|
| 78 |
-
|
| 79 |
-
Чтобы создать новую ноду в вашем пайплайне, найдите значок **плюс (+)** в верхнем левом углу интерфейса. Эта кнопка открывает библиотеку нод, где вы можете просматривать и выбирать из доступных нод.
|
| 80 |
-
|
| 81 |
-

|
| 82 |
-
|
| 83 |
-
## **2. Библиотека нод**
|
| 84 |
-
|
| 85 |
-
Библиотека нод отображает все доступные ноды, организованные в логические категории, чтобы помочь вам найти нужную функциональность для вашего пайплайна:
|
| 86 |
-
|
| 87 |
-

|
| 88 |
-
|
| 89 |
-
### Основные категории нод:
|
| 90 |
-
|
| 91 |
-
- **Генерация изображений** - Ноды для генерации и изменения изображений
|
| 92 |
-
- **Работа с изображениями** - Работа с изображениями, не связанная с генерацией
|
| 93 |
-
- **Генерация видео** - Ноды для генерации видео
|
| 94 |
-
- **Обработка видео** - Работа с видео, не связанная с генерацией
|
| 95 |
-
- **Анализ изображений** - Группа нод по анализу, оценке и детектированию изображений
|
| 96 |
-
- **Computer vision** - Описание изображений
|
| 97 |
-
|
| 98 |
-
Просмотрите категории и нажмите на любую ноду, чтобы добавить её в рабочее пространство вашего пайплайна.
|
| 99 |
-
|
| 100 |
-
## **3. Взаимодействие с нодой**
|
| 101 |
-
|
| 102 |
-
После добавления ноды в рабочее пространство вы можете взаимодействовать с ней с помощью значков управления, которые появляются при наведении курсора на ноду:
|
| 103 |
-
|
| 104 |
-

|
| 105 |
-
|
| 106 |
-
### Значки управления:
|
| 107 |
-
|
| 108 |
-
- **Значок ладони (🖐️)** - Нажмите и перетащите для перемещения ноды по рабочему пространству
|
| 109 |
-
- **Значок блокнота (📝)** - Открывает панель настроек ноды
|
| 110 |
-
|
| 111 |
-
## **4. Настройка ноды**
|
| 112 |
-
|
| 113 |
-
Нажатие на значок блокнота открывает панель настроек ноды, где вы можете настроить поведение ноды:
|
| 114 |
-
|
| 115 |
-
Панель настроек включает несколько вкладок:
|
| 116 |
-
|
| 117 |
-
- **Inputs** - Определение входных параметров и источников данных
|
| 118 |
-
- **Design** - Настройка входных и выходных параметров
|
| 119 |
-
- **Script** - Редактирование JavaScript кода логики ноды
|
| 120 |
-
- **Environment** - Настройка переменных окружения
|
| 121 |
-
- **Catalog** - Просмотр метаданных ноды и её публикация
|
| 122 |
-
- **YAML** - Доступ к YAML ноды
|
| 123 |
-
|
| 124 |
-
## **5. Удаление нод**
|
| 125 |
-
|
| 126 |
-
Чтобы удалить ноду из вашего пайплайна:
|
| 127 |
-
|
| 128 |
-
1. Нажмите на значок блокнота, чтобы открыть настройки ноды
|
| 129 |
-
2. Найдите красную кнопку **Delete** в верхнем левом углу панели настроек
|
| 130 |
-
3. Нажмите Delete, чтобы окончательно удалить ноду из вашего пайплайна
|
| 131 |
-
|
| 132 |
-

|
| 133 |
-
|
| 134 |
-
Будьте осторожны при удалении нод, так как это действие нельзя отменить и оно может нарушить соединения в вашем пайплайн.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/img/{create-node-4.webp → create-node-1.png}
RENAMED
|
File without changes
|
docs/img/{create-node-1.webp → create-node-2.png}
RENAMED
|
File without changes
|
docs/img/{create-node-2.webp → create-node-3.png}
RENAMED
|
File without changes
|
docs/img/{create-node-3.webp → create-node-4.png}
RENAMED
|
File without changes
|
docs/img/create-node-5.png
ADDED
|
Git LFS Details
|
docs/img/create-node-6.png
ADDED
|
Git LFS Details
|
docs/img/create-node-7.png
ADDED
|
Git LFS Details
|
docs/img/create-node-8.png
ADDED
|
Git LFS Details
|