by tdcktz · v0.0.5
A Server-Sent Events (SSE) request tool for Dify workflows. Establishes long connections to receive real-time event streams from servers with support for authentication, custom headers, and automatic retry mechanisms.
This community listing does not yet include every recommended support, privacy, pricing, and permission disclosure. Review the available package permissions before installing.
Available inside your emploidai workspace after installation.
Available inside your emploidai workspace after installation.
Author: lw
Version: 0.0.3
Type: tool
这是一个为Dify工作流设计的Server-Sent Events (SSE) 请求工具插件。它允许你在Dify工作流中建立长连接,接收服务器实时推送的事件流数据,并提供流式输出和最终汇总结果。
在Dify工作流中添加SSE请求工具,配置以下参数:
URL: https://your-sse-server.com/stream
认证类型: none
超时时间: 30
最大事件数: 100
最大持续时间: 300
URL: https://api.example.com/sse/events
认证类型: bearer
认证令牌: your-bearer-token
请求头: |
Content-Type: application/json
X-Custom-Header: custom-value
查询参数: |
stream: true
topic: updates
| 参数名 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
url | string | ✅ | - | SSE服务器端点URL |
headers | string | ❌ | - | 自定义HTTP头,每行一个,格式:key: value |
query_params | string | ❌ | - | URL查询参数,每行一个,格式:key: value |
auth_type | select | ❌ | none | 认证类型:none/bearer/api_key |
auth_token | string | ❌ | - | 认证令牌或API密钥 |
auth_header | string | ❌ | Authorization | API密钥认证的头名称 |
timeout | number | ❌ | 30 | 连接超时时间(秒) |
max_events | number | ❌ | 100 | 最大接收事件数 |
max_duration | number | ❌ | 300 | 最大连接持续时间(秒) |
retry_attempts | number | ❌ | 3 | 连接失败重试次数 |
{
"type": "event",
"event_number": 1,
"event_type": "message",
"data": "实时接收的数据",
"event_id": "event-123",
"timestamp": "2024-01-01T12:00:00Z"
}
{
"type": "summary",
"status": "completed",
"total_events": 50,
"connection_duration": 25.5,
"events": [...],
"summary": "SSE连接成功,接收到50个事件,耗时25.5秒",
"timestamp": "2024-01-01T12:00:25Z"
}
{
"type": "error",
"status": "failed",
"error": "连接超时",
"timestamp": "2024-01-01T12:00:30Z"
}
data:、event:、id:、retry:字段httpx>=0.25.0: HTTP客户端,支持流式请求dify_plugin>=0.2.0: Dify插件框架URL: https://api.openai.com/v1/chat/completions
认证类型: bearer
认证令牌: sk-your-openai-api-key
请求头: |
Content-Type: application/json
查询参数: |
stream: true
model: gpt-3.5-turbo
URL: https://your-log-server.com/logs/stream
认证类型: api_key
认证令牌: your-api-key
认证头名称: X-API-Key
查询参数: |
level: info
service: web-app
最大事件数: 1000
最大持续时间: 600
欢迎提交Issue和Pull Request来改进这个插件!
MIT License