update
Browse files
docs/advanced-development/creating-nodes.mdx
CHANGED
|
@@ -4,4 +4,49 @@ sidebar_position: 3
|
|
| 4 |
|
| 5 |
# Creating nodes
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# Creating nodes
|
| 6 |
|
| 7 |
+
## 1. Step-by-Step Node Creation
|
| 8 |
+
|
| 9 |
+
### Step 1: Design Setup
|
| 10 |
+
1. Click "Design" tab
|
| 11 |
+
2. Fill in:
|
| 12 |
+
- Name (in required languages)
|
| 13 |
+
- Select category
|
| 14 |
+
- Set version (start with 1)
|
| 15 |
+
|
| 16 |
+
### Step 2: Adding Inputs
|
| 17 |
+
1. Go to "Inputs" tab
|
| 18 |
+
2. Click "+ Add Input"
|
| 19 |
+
3. Configure:
|
| 20 |
+
- Field Name (Latin characters)
|
| 21 |
+
- Title (display name)
|
| 22 |
+
- Type (select from dropdown)
|
| 23 |
+
- Mark "required" if mandatory
|
| 24 |
+
|
| 25 |
+
### Step 3: Environment Setup
|
| 26 |
+
1. Open "Environment"
|
| 27 |
+
2. Add variables:
|
| 28 |
+
- Specify type (string/number/boolean)
|
| 29 |
+
- Choose scope (global for shared)
|
| 30 |
+
|
| 31 |
+
### Step 4: Writing Script
|
| 32 |
+
1. Navigate to "Script"
|
| 33 |
+
2. Use template:
|
| 34 |
+
```javascript
|
| 35 |
+
export async function run({ inputs, env }) {
|
| 36 |
+
// inputs contains all input parameters
|
| 37 |
+
// env - environment variables
|
| 38 |
+
|
| 39 |
+
// Your logic here
|
| 40 |
+
|
| 41 |
+
return {
|
| 42 |
+
// Matches outputs in YAML
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Step 5: Publishing
|
| 48 |
+
1. Test in "Test" tab
|
| 49 |
+
2. Save with Ctrl+S
|
| 50 |
+
3. Click "Deploy"
|
| 51 |
+
|
| 52 |
+
IN WORK
|
docs/advanced-development/node-yaml.mdx
CHANGED
|
@@ -2,6 +2,170 @@
|
|
| 2 |
sidebar_position: 2
|
| 3 |
---
|
| 4 |
|
| 5 |
-
# Node
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
sidebar_position: 2
|
| 3 |
---
|
| 4 |
|
| 5 |
+
# Creating Your First Node: Complete Beginner's Guide
|
| 6 |
|
| 7 |
+
## 1. Node Interface
|
| 8 |
+
|
| 9 |
+
### 1.1 Inputs
|
| 10 |
+

|
| 11 |
+
Configure here:
|
| 12 |
+
- Data the node accepts
|
| 13 |
+
- Input parameter types
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
### 1.2 Design
|
| 17 |
+

|
| 18 |
+
Settings for:
|
| 19 |
+
- Node name (title)
|
| 20 |
+
- Version
|
| 21 |
+
- Inputs
|
| 22 |
+
- Outputs
|
| 23 |
+
|
| 24 |
+
*Example:*
|
| 25 |
+
```yaml
|
| 26 |
+
version: 1
|
| 27 |
+
title: en=Translate text
|
| 28 |
+
//...
|
| 29 |
+
inputs:
|
| 30 |
+
source:
|
| 31 |
+
order: 1
|
| 32 |
+
title: en=Source language
|
| 33 |
+
type: string
|
| 34 |
+
required: true
|
| 35 |
+
default: auto
|
| 36 |
+
outputs:
|
| 37 |
+
text:
|
| 38 |
+
title: en=Text
|
| 39 |
+
type: string
|
| 40 |
+
alternatives:
|
| 41 |
+
title: en=Alternatives
|
| 42 |
+
type: string[]
|
| 43 |
+
detectedLanguage:
|
| 44 |
+
title: en=Detected language
|
| 45 |
+
type: json
|
| 46 |
+
schema: detected-languages
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
### 1.3 Script
|
| 51 |
+

|
| 52 |
+
Write JavaScript code that:
|
| 53 |
+
- Processes input data
|
| 54 |
+
- Interacts with external APIs
|
| 55 |
+
- Returns results
|
| 56 |
+
|
| 57 |
+
*Example:*
|
| 58 |
+
```yaml
|
| 59 |
+
script: |
|
| 60 |
+
const CHECK_TASK_INTERVAL = 3000;
|
| 61 |
+
const MAX_ATTEMPTS = 10;
|
| 62 |
+
|
| 63 |
+
export async function run({ inputs, state }) {
|
| 64 |
+
|
| 65 |
+
const { FatalError, TimeoutError, RepeatNode, NextNode } = DEFINITIONS;
|
| 66 |
+
const { ArtWorks, FatalError: ArtWorksError } = require('artworks');
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
### 1.4 Environment
|
| 71 |
+

|
| 72 |
+
Configure:
|
| 73 |
+
- API keys
|
| 74 |
+
- External service URLs
|
| 75 |
+
- Configuration parameters
|
| 76 |
+
|
| 77 |
+
*Example:*
|
| 78 |
+
```yaml
|
| 79 |
+
environment:
|
| 80 |
+
API_KEY:
|
| 81 |
+
title: "Access Key"
|
| 82 |
+
type: string
|
| 83 |
+
scope: global
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
### 1.5 YAML
|
| 87 |
+

|
| 88 |
+
Full access to all node parameters in YAML format.
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
## 2. Complete YAML Structure
|
| 93 |
+
|
| 94 |
+
```yaml
|
| 95 |
+
# Block 1: Metadata (Design)
|
| 96 |
+
version: 1
|
| 97 |
+
title: en="My Node";ru="Моя нода"
|
| 98 |
+
category:
|
| 99 |
+
_id: custom
|
| 100 |
+
title: "Custom Nodes"
|
| 101 |
+
|
| 102 |
+
# Block 2: Inputs
|
| 103 |
+
inputs:
|
| 104 |
+
image_input:
|
| 105 |
+
type: image
|
| 106 |
+
title: "Image"
|
| 107 |
+
required: true
|
| 108 |
+
order: 1
|
| 109 |
+
|
| 110 |
+
# Block 3: Outputs
|
| 111 |
+
outputs:
|
| 112 |
+
result_image:
|
| 113 |
+
type: image
|
| 114 |
+
title: "Result"
|
| 115 |
+
|
| 116 |
+
# Block 4: Environment
|
| 117 |
+
environment:
|
| 118 |
+
API_ENDPOINT:
|
| 119 |
+
title: "API Server"
|
| 120 |
+
type: string
|
| 121 |
+
scope: global
|
| 122 |
+
|
| 123 |
+
# Block 5: Execution (Design)
|
| 124 |
+
execution: regular # rapid/regular/deferred/protracted
|
| 125 |
+
|
| 126 |
+
# Block 6: Script
|
| 127 |
+
script: |
|
| 128 |
+
export async function run({ inputs }) {
|
| 129 |
+
// Processing logic
|
| 130 |
+
return {
|
| 131 |
+
result_image: processedImage
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
```
|
| 135 |
+
|
| 136 |
+
## 4. Frequently Asked Questions
|
| 137 |
+
|
| 138 |
+
### Q: How to add a dropdown?
|
| 139 |
+
```yaml
|
| 140 |
+
inputs:
|
| 141 |
+
gender:
|
| 142 |
+
type: string
|
| 143 |
+
enum: ["male", "female", "other"]
|
| 144 |
+
default: "male"
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
### Q: How to make multiline text?
|
| 148 |
+
```yaml
|
| 149 |
+
inputs:
|
| 150 |
+
bio:
|
| 151 |
+
type: string
|
| 152 |
+
multiline: true
|
| 153 |
+
placeholder: "Tell about yourself"
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
### Q: Where to set execution time?
|
| 157 |
+
In Design → Execution Timeout select:
|
| 158 |
+
- Rapid (fast operations)
|
| 159 |
+
- Protracted (long requests)
|
| 160 |
+
|
| 161 |
+
## 5. Developer Tips
|
| 162 |
+
|
| 163 |
+
1. Always test nodes before deployment
|
| 164 |
+
2. Use `console.log()` for debugging
|
| 165 |
+
3. Start with simple nodes, gradually increase complexity
|
| 166 |
+
4. Break complex logic into multiple nodes
|
| 167 |
+
|
| 168 |
+
> More examples available in [Template Library]
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
IN WORK
|
docs/advanced-development/pipeline-yaml.mdx
CHANGED
|
@@ -206,3 +206,5 @@ nodes:
|
|
| 206 |
debug_logger:
|
| 207 |
script: "log_intermediate.js"
|
| 208 |
```
|
|
|
|
|
|
|
|
|
| 206 |
debug_logger:
|
| 207 |
script: "log_intermediate.js"
|
| 208 |
```
|
| 209 |
+
|
| 210 |
+
IN WORK
|