Update nexus wiki content
This commit is contained in:
37
wiki/concepts/SSE.md
Normal file
37
wiki/concepts/SSE.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: "SSE"
|
||||
type: concept
|
||||
tags: []
|
||||
sources: [expose-hermes-agent-as-an-openai-compatible-api-for-any-frontend]
|
||||
last_updated: 2026-05-02
|
||||
---
|
||||
|
||||
## Definition
|
||||
Server-Sent Events (SSE) 是一种服务器推送技术,允许服务端通过 HTTP 单向通道向客户端持续发送事件流。
|
||||
|
||||
## Usage in Hermes Agent
|
||||
`/v1/runs` API 通过 SSE 实现长会话实时进度订阅:
|
||||
- **Token 流**:逐 token 推送响应内容
|
||||
- **工具进度**:自定义事件推送工具执行状态
|
||||
- **实时反馈**:用户可看到 Agent 思考和工具调用的全过程
|
||||
|
||||
## Format
|
||||
```
|
||||
event: content
|
||||
data: {"content": "Hello"}
|
||||
|
||||
event: tool_use
|
||||
data: {"tool": "terminal", "input": {...}}
|
||||
```
|
||||
|
||||
## Comparison with WebSocket
|
||||
| 特性 | SSE | WebSocket |
|
||||
|------|-----|-----------|
|
||||
| 方向 | 单向(服务端→客户端) | 双向 |
|
||||
| 复杂性 | 简单 | 复杂 |
|
||||
| 自动重连 | 支持 | 需自行实现 |
|
||||
| HTTP/2 | 优化支持 | 支持 |
|
||||
|
||||
## Related
|
||||
- [[ToolStreaming]]
|
||||
- [[ResponsesAPI]]
|
||||
Reference in New Issue
Block a user