mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2026-07-27 16:37:58 +00:00
refactor: Merge loop_timer demos and extend duration
- Merge demo_loop_timer.yaml and demo_loop_timer_passthrough.yaml into single comprehensive demo - Create dual-branch workflow demonstrating both standard and passthrough modes side-by-side - Increase duration from 5 seconds to 2 minutes for better demonstration - Update YAML_FORMAT_QUICK_GUIDE.md with detailed mode explanations and demo reference - Update tasks.md in add-loop-timer proposal to reflect demo improvements - Remove duplicate demo_loop_timer_passthrough.yaml file
This commit is contained in:
parent
42cd389d59
commit
1abf173a14
@ -176,16 +176,19 @@ config:
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### **`loop_timer`**
|
#### **`loop_timer`**
|
||||||
Controls loops by tracking elapsed time.
|
Controls loops by tracking elapsed time. See `yaml_instance/demo_loop_timer.yaml` for comprehensive demo with both standard and passthrough modes.
|
||||||
```yaml
|
```yaml
|
||||||
type: loop_timer
|
type: loop_timer
|
||||||
config:
|
config:
|
||||||
max_duration: 5 # Max allowed time
|
max_duration: 2 # Max allowed time
|
||||||
duration_unit: seconds # Unit: 'seconds', 'minutes', or 'hours'
|
duration_unit: minutes # Unit: 'seconds', 'minutes', or 'hours'
|
||||||
reset_on_emit: true # Reset timer when condition is met
|
reset_on_emit: true # Reset timer when condition is met (standard mode)
|
||||||
message: "" # Optional message
|
message: "" # Optional custom message when time limit reached
|
||||||
passthrough: false # Passthrough mode (same as loop_counter)
|
passthrough: false # false (standard): suppress until limit
|
||||||
|
# true (passthrough): pass through, emit at limit, then transparent
|
||||||
```
|
```
|
||||||
|
**Standard mode** (`passthrough: false`): Messages suppressed until time limit, then emits message and allows passage.
|
||||||
|
**Passthrough mode** (`passthrough: true`): Messages pass through immediately, emits message at limit, then becomes transparent.
|
||||||
|
|
||||||
#### **`passthrough`**
|
#### **`passthrough`**
|
||||||
A simple node that passes data through without modification.
|
A simple node that passes data through without modification.
|
||||||
|
|||||||
@ -1,52 +1,137 @@
|
|||||||
version: 0.4.0
|
version: 0.4.0
|
||||||
graph:
|
graph:
|
||||||
start:
|
start:
|
||||||
- Writer
|
- StandardWriter
|
||||||
end:
|
end:
|
||||||
- Finalizer
|
- StandardFinalizer
|
||||||
id: loop_timer_demo
|
- PassthroughFinalizer
|
||||||
description: LoopTimer demo that releases output after 5 seconds of elapsed time.
|
id: loop_timer_comprehensive_demo
|
||||||
|
description: |
|
||||||
|
Comprehensive LoopTimer demonstration with both standard and passthrough modes.
|
||||||
|
|
||||||
|
STANDARD MODE BRANCH:
|
||||||
|
StandardWriter → StandardCritic → Standard Timer Gate (2 min) → StandardFinalizer
|
||||||
|
|
||||||
|
The Standard Timer Gate suppresses messages for 2 minutes, then emits a time limit
|
||||||
|
message to StandardFinalizer. The feedback loop (StandardCritic → StandardWriter)
|
||||||
|
continues running but outputs are blocked by the gate until time expires.
|
||||||
|
|
||||||
|
PASSTHROUGH MODE BRANCH:
|
||||||
|
PassthroughWriter → PassthroughCritic → Passthrough Timer Gate (2 min) → PassthroughFinalizer
|
||||||
|
|
||||||
|
The Passthrough Timer Gate allows messages through immediately, maintains a parallel
|
||||||
|
feedback loop (PassthroughCritic → PassthroughWriter), and after 2 minutes emits a
|
||||||
|
time limit message before becoming transparent.
|
||||||
is_majority_voting: false
|
is_majority_voting: false
|
||||||
log_level: INFO
|
log_level: INFO
|
||||||
nodes:
|
nodes:
|
||||||
- id: Writer
|
# ===== STANDARD MODE BRANCH =====
|
||||||
|
- id: StandardWriter
|
||||||
type: literal
|
type: literal
|
||||||
description: Responsible for outputting a fixed draft.
|
description: Standard mode - outputs draft messages that get blocked by timer gate.
|
||||||
config:
|
config:
|
||||||
content: Draft iteration from Writer
|
content: "[STANDARD] Draft iteration from Writer"
|
||||||
role: assistant
|
role: assistant
|
||||||
- id: Critic
|
|
||||||
|
- id: StandardCritic
|
||||||
type: literal
|
type: literal
|
||||||
description: Simulates feedback, always requesting further revisions.
|
description: Standard mode - provides feedback to keep the loop running.
|
||||||
config:
|
config:
|
||||||
content: Please revise again
|
content: "[STANDARD] Please revise again"
|
||||||
role: user
|
role: user
|
||||||
- id: Timer Gate
|
|
||||||
|
- id: Standard Timer Gate
|
||||||
type: loop_timer
|
type: loop_timer
|
||||||
description: Counts elapsed time, only granting passage after 5 seconds.
|
description: |
|
||||||
|
Standard mode (passthrough=false) - Suppresses messages for 2 minutes.
|
||||||
|
After 2 minutes elapsed, emits time limit message and allows passage to StandardFinalizer.
|
||||||
|
Timer resets after emission (reset_on_emit=true).
|
||||||
config:
|
config:
|
||||||
max_duration: 5
|
max_duration: 2
|
||||||
duration_unit: seconds
|
duration_unit: minutes
|
||||||
reset_on_emit: true
|
reset_on_emit: true
|
||||||
message: Loop finished after 5 seconds
|
message: "[STANDARD] Time limit reached after 2 minutes - releasing output"
|
||||||
- id: Finalizer
|
passthrough: false
|
||||||
|
|
||||||
|
- id: StandardFinalizer
|
||||||
type: literal
|
type: literal
|
||||||
description: Receives the release signal from Timer Gate and outputs the final statement.
|
description: Standard mode - receives output only after timer expires.
|
||||||
config:
|
config:
|
||||||
content: Final summary released
|
content: "[STANDARD] Final summary released"
|
||||||
role: assistant
|
role: assistant
|
||||||
|
|
||||||
|
# ===== PASSTHROUGH MODE BRANCH =====
|
||||||
|
- id: PassthroughWriter
|
||||||
|
type: literal
|
||||||
|
description: Passthrough mode - outputs draft messages that pass through immediately.
|
||||||
|
config:
|
||||||
|
content: "[PASSTHROUGH] Draft iteration from Writer"
|
||||||
|
role: assistant
|
||||||
|
|
||||||
|
- id: PassthroughCritic
|
||||||
|
type: literal
|
||||||
|
description: Passthrough mode - provides feedback to keep the loop running.
|
||||||
|
config:
|
||||||
|
content: "[PASSTHROUGH] Please revise again"
|
||||||
|
role: user
|
||||||
|
|
||||||
|
- id: Passthrough Timer Gate
|
||||||
|
type: loop_timer
|
||||||
|
description: |
|
||||||
|
Passthrough mode (passthrough=true) - Allows messages through immediately.
|
||||||
|
After 2 minutes elapsed, emits time limit message.
|
||||||
|
Then becomes transparent gate (no reset, continues passing through).
|
||||||
|
config:
|
||||||
|
max_duration: 2
|
||||||
|
duration_unit: minutes
|
||||||
|
reset_on_emit: false
|
||||||
|
message: "[PASSTHROUGH] Time limit reached after 2 minutes - now transparent"
|
||||||
|
passthrough: true
|
||||||
|
|
||||||
|
- id: PassthroughFinalizer
|
||||||
|
type: literal
|
||||||
|
description: Passthrough mode - receives output immediately and continues receiving after timer.
|
||||||
|
config:
|
||||||
|
content: "[PASSTHROUGH] Final summary released"
|
||||||
|
role: assistant
|
||||||
|
|
||||||
edges:
|
edges:
|
||||||
- from: Writer
|
# ===== STANDARD MODE EDGES =====
|
||||||
to: Critic
|
# Main forward path
|
||||||
- from: Critic
|
- from: StandardWriter
|
||||||
to: Writer
|
to: StandardCritic
|
||||||
- from: Critic
|
|
||||||
to: Timer Gate
|
- from: StandardCritic
|
||||||
- from: Timer Gate
|
to: Standard Timer Gate
|
||||||
to: Writer
|
|
||||||
|
# Feedback loop (blocked until timer expires)
|
||||||
|
- from: StandardCritic
|
||||||
|
to: StandardWriter
|
||||||
trigger: true
|
trigger: true
|
||||||
condition: 'true'
|
condition: 'true'
|
||||||
carry_data: true
|
carry_data: true
|
||||||
keep_message: false
|
keep_message: false
|
||||||
- from: Timer Gate
|
|
||||||
to: Finalizer
|
# Timer gate output (only after 2 minutes)
|
||||||
|
- from: Standard Timer Gate
|
||||||
|
to: StandardFinalizer
|
||||||
|
|
||||||
|
# ===== PASSTHROUGH MODE EDGES =====
|
||||||
|
# Main forward path
|
||||||
|
- from: PassthroughWriter
|
||||||
|
to: PassthroughCritic
|
||||||
|
|
||||||
|
- from: PassthroughCritic
|
||||||
|
to: Passthrough Timer Gate
|
||||||
|
|
||||||
|
# Feedback loop (always active)
|
||||||
|
- from: PassthroughCritic
|
||||||
|
to: PassthroughWriter
|
||||||
|
trigger: true
|
||||||
|
condition: 'true'
|
||||||
|
carry_data: true
|
||||||
|
keep_message: false
|
||||||
|
|
||||||
|
# Timer gate output (immediate passthrough + timer message at 2 min)
|
||||||
|
- from: Passthrough Timer Gate
|
||||||
|
to: PassthroughFinalizer
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
version: 0.4.0
|
|
||||||
graph:
|
|
||||||
start:
|
|
||||||
- Writer
|
|
||||||
end:
|
|
||||||
- Finalizer
|
|
||||||
id: loop_timer_passthrough_demo
|
|
||||||
description: LoopTimer passthrough mode demo - passes through messages before the limit, emits at the limit, then becomes transparent.
|
|
||||||
is_majority_voting: false
|
|
||||||
log_level: INFO
|
|
||||||
nodes:
|
|
||||||
- id: Writer
|
|
||||||
type: literal
|
|
||||||
description: Outputs a draft message.
|
|
||||||
config:
|
|
||||||
content: Draft iteration from Writer
|
|
||||||
role: assistant
|
|
||||||
- id: Critic
|
|
||||||
type: literal
|
|
||||||
description: Provides feedback.
|
|
||||||
config:
|
|
||||||
content: Please revise again
|
|
||||||
role: user
|
|
||||||
- id: Timer Gate
|
|
||||||
type: loop_timer
|
|
||||||
description: Passthrough mode - passes messages through before 5 seconds, emits limit message at 5 seconds, then transparent.
|
|
||||||
config:
|
|
||||||
max_duration: 5
|
|
||||||
duration_unit: seconds
|
|
||||||
reset_on_emit: false
|
|
||||||
message: Time limit reached - switching to passthrough
|
|
||||||
passthrough: true
|
|
||||||
- id: Finalizer
|
|
||||||
type: literal
|
|
||||||
description: Receives messages.
|
|
||||||
config:
|
|
||||||
content: Final summary released
|
|
||||||
role: assistant
|
|
||||||
edges:
|
|
||||||
- from: Writer
|
|
||||||
to: Critic
|
|
||||||
- from: Critic
|
|
||||||
to: Timer Gate
|
|
||||||
- from: Timer Gate
|
|
||||||
to: Writer
|
|
||||||
trigger: true
|
|
||||||
condition: 'true'
|
|
||||||
carry_data: true
|
|
||||||
keep_message: false
|
|
||||||
- from: Timer Gate
|
|
||||||
to: Finalizer
|
|
||||||
Loading…
x
Reference in New Issue
Block a user