Skip to content

Commit

Permalink
docs: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyoucao577 committed Oct 28, 2024
1 parent f1e5228 commit ce6634d
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/ten_agent/how_does_interrupt_work.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
The interrupt mechanism in
[TEN-Agent](https://github.com/TEN-framework/TEN-Agent) consists of two main
parts: **Interrupt Detection** and **Interrupt Response**. This document details
both components and explains how the interrupt command propagates through the AI
both parts and explains how the interrupt command propagates through the AI
agent graph.

## Part 1: Interrupt Detection

### 1. Current Interrupt Detection Implementation

The current interrupt detector
The current
([interrupt_detector_python](https://github.com/TEN-framework/TEN-Agent/tree/main/agents/ten_packages/extension/interrupt_detector_python))
implements a text-based interrupt detection mechanism:
extension implements a text-based interrupt detection mechanism:

```python
def on_data(self, ten: TenEnv, data: Data) -> None:
Expand All @@ -31,7 +31,7 @@ The interrupt detector triggers in the following cases:
1. When receiving final text (`is_final = true`)
2. When text length reaches a threshold (≥ 2 characters)

### 2. Custom Interrupt Detection
### 2. Customize Interrupt Detection

To implement your own interrupt detection logic, you can refer to the
implementation of
Expand All @@ -56,22 +56,22 @@ Interrupt Detector
agora_rtc
```

Each component in the chain follows two key steps when receiving a `flush`
Each extension in the chain follows two key steps when receiving a `flush`
command:

1. Clean up its own resources and internal state
2. Forward the `flush` command to downstream components
2. Forward the `flush` command to downstream extensions

This ensures that:

- Components are cleaned up in the correct order
- Extensions are cleaned up in the correct order
- No residual data flows through the system
- Each component returns to a clean state before the next operation
- Each extension returns to a clean state before the next operation

## Conclusion

[TEN-Agent](https://github.com/TEN-framework/TEN-Agent)'s interrupt mechanism
uses a chain processing pattern to ensure orderly cleanup of all components in
the AI agent graph. When an interrupt occurs, each component first cleans up its
own state and then forwards the `flush` command to downstream components,
uses a chain processing pattern to ensure orderly cleanup of all extensions in
the AI agent graph. When an interrupt occurs, each extension first cleans up its
own state and then forwards the `flush` command to downstream extensions,
ensuring a clean system state for subsequent operations.

0 comments on commit ce6634d

Please sign in to comment.