mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-10 07:27:57 -05:00
fix(copilot): deprecate yaml, json import/export, deprecate build_workflow tool, convert copilot to json-based (#1488)
* Temp commit * Edit workflow self contained * Remove build_workflow * Base bad version * fix lint * Sanitize workflows for copilot * Fixes * Fix import/export buttons * fix autolayout * fix lint * fix training logic to work with json * Add claude sonnet 4.5 to copilot * Lint * Update copilot url * Update default model and fix build errors * Fix tests --------- Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>
This commit is contained in:
committed by
GitHub
parent
333442909b
commit
6a664663cf
@@ -10,7 +10,6 @@ type: object
|
||||
required:
|
||||
- type
|
||||
- name
|
||||
- inputs
|
||||
- connections
|
||||
properties:
|
||||
type:
|
||||
@@ -22,21 +21,23 @@ properties:
|
||||
description: Display name for this loop block
|
||||
inputs:
|
||||
type: object
|
||||
required:
|
||||
- loopType
|
||||
description: Optional. If omitted, defaults will be applied.
|
||||
properties:
|
||||
loopType:
|
||||
type: string
|
||||
enum: [for, forEach]
|
||||
description: Type of loop to execute
|
||||
default: for
|
||||
iterations:
|
||||
type: number
|
||||
description: Number of iterations (for 'for' loops)
|
||||
default: 5
|
||||
minimum: 1
|
||||
maximum: 1000
|
||||
collection:
|
||||
type: string
|
||||
description: Collection to iterate over (for 'forEach' loops)
|
||||
default: ""
|
||||
maxConcurrency:
|
||||
type: number
|
||||
description: Maximum concurrent executions
|
||||
@@ -45,13 +46,10 @@ properties:
|
||||
maximum: 10
|
||||
connections:
|
||||
type: object
|
||||
required:
|
||||
- loop
|
||||
properties:
|
||||
# Nested format (recommended)
|
||||
loop:
|
||||
type: object
|
||||
required:
|
||||
- start
|
||||
properties:
|
||||
start:
|
||||
type: string
|
||||
@@ -59,26 +57,37 @@ properties:
|
||||
end:
|
||||
type: string
|
||||
description: Target block ID for loop completion (optional)
|
||||
# Direct handle format (alternative)
|
||||
loop-start-source:
|
||||
type: string | string[]
|
||||
description: Target block ID to execute inside the loop (direct format)
|
||||
loop-end-source:
|
||||
type: string | string[]
|
||||
description: Target block ID for loop completion (direct format, optional)
|
||||
error:
|
||||
type: string
|
||||
description: Target block ID for error handling
|
||||
note: Use either the nested 'loop' format OR the direct 'loop-start-source' format, not both
|
||||
```
|
||||
|
||||
## Connection Configuration
|
||||
|
||||
Loop blocks use a special connection format with a `loop` section:
|
||||
Loop blocks support two connection formats:
|
||||
|
||||
### Direct Handle Format (Alternative)
|
||||
|
||||
```yaml
|
||||
connections:
|
||||
loop:
|
||||
start: <string> # Target block ID to execute inside the loop
|
||||
end: <string> # Target block ID after loop completion (optional)
|
||||
loop-start-source: <string> # Target block ID to execute inside the loop
|
||||
loop-end-source: <string> # Target block ID after loop completion (optional)
|
||||
error: <string> # Target block ID for error handling (optional)
|
||||
```
|
||||
|
||||
Both formats work identically. Use whichever you prefer.
|
||||
|
||||
## Child Block Configuration
|
||||
|
||||
Blocks inside a loop must have their `parentId` set to the loop block ID:
|
||||
Blocks inside a loop must have their `parentId` set to the loop block ID. The `extent` property is automatically set to `'parent'` and doesn't need to be specified:
|
||||
|
||||
```yaml
|
||||
loop-1:
|
||||
@@ -261,6 +270,59 @@ process-task:
|
||||
success: task-completed
|
||||
```
|
||||
|
||||
### Direct Handle Format Example
|
||||
|
||||
The same loop can be written using the direct handle format:
|
||||
|
||||
```yaml
|
||||
my-loop:
|
||||
type: loop
|
||||
name: "Process Items"
|
||||
inputs:
|
||||
loopType: forEach
|
||||
collection: <start.items>
|
||||
connections:
|
||||
loop-start-source: process-item # Direct handle format
|
||||
loop-end-source: final-results # Direct handle format
|
||||
error: handle-error
|
||||
|
||||
process-item:
|
||||
type: agent
|
||||
name: "Process Item"
|
||||
parentId: my-loop
|
||||
inputs:
|
||||
systemPrompt: "Process this item"
|
||||
userPrompt: <loop.currentItem>
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
|
||||
### Minimal Loop Example (Using Defaults)
|
||||
|
||||
You can omit the `inputs` section entirely, and defaults will be applied:
|
||||
|
||||
```yaml
|
||||
simple-loop:
|
||||
type: loop
|
||||
name: "Simple Loop"
|
||||
# No inputs section - defaults to loopType: 'for', iterations: 5
|
||||
connections:
|
||||
loop-start-source: process-step
|
||||
loop-end-source: complete
|
||||
|
||||
process-step:
|
||||
type: agent
|
||||
name: "Process Step"
|
||||
parentId: simple-loop
|
||||
inputs:
|
||||
systemPrompt: "Execute step"
|
||||
userPrompt: "Step <loop.index>"
|
||||
model: gpt-4o
|
||||
apiKey: '{{OPENAI_API_KEY}}'
|
||||
```
|
||||
|
||||
This loop will execute 5 iterations by default.
|
||||
|
||||
## Loop Variables
|
||||
|
||||
Inside loop child blocks, these special variables are available:
|
||||
|
||||
Reference in New Issue
Block a user