agentscope-ai / agentscope-ai/agentscope-runtime
[Feature] AgentApp Websocket endpoint registration
- Linguagem predominante
- Python
- Estrelas
- 863
- Forks
- 168
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
## Problem Description
I want to create self-defined websocket endpoint using AgentApp just like in FastAPI. However, websocket decorator is not implemented so far.
## Proposed Solution
# 在 AgentApp 类中添加:
def websocket(self, path: str):
"""Decorator to register custom websocket endpoints"""
def decorator(func: Callable):
endpoint_info = {
"path": path,
"handler": func,
"methods": ["WS"], # 标记为 WebSocket 类型
"module": getattr(func, "__module__", None),
"function_name": getattr(func, "__name__", None),
"is_websocket": True, # 显式标记
}
self.custom_endpoints.append(endpoint_info)
return func
return decorator
## Affected Component(s)
- [x] Engine
- [ ] Sandbox
- [ ] Common
- [ ] Tools
- [x] Documentation
- [ ] Other: ___________
## Alternatives Considered
[Describe any alternative solutions you've considered]
## Additional Context
[Any other context, screenshots, or examples about the feature request]
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.