20 lines
875 B
Python
20 lines
875 B
Python
from aiohttp import web
|
|
|
|
from ..web_agent import WebAgent
|
|
from ..web_io_buffer import WebIOBuffer
|
|
from .llm_websocket import LlmWebSocket
|
|
from .context_websocket import ContextWebSocket
|
|
from .token_websocket import TokenWebSocket
|
|
from .stdout_websocket import StdoutWebSocket
|
|
|
|
class Websockets:
|
|
def __init__(self, app: web.Application, agent: WebAgent, io_buffer: WebIOBuffer):
|
|
self._llm_ws = LlmWebSocket(agent)
|
|
self._context_ws = ContextWebSocket(agent)
|
|
self._token_ws = TokenWebSocket(agent)
|
|
self._stdout_ws = StdoutWebSocket(io_buffer)
|
|
|
|
app.router.add_get("/ws/llm", self._llm_ws.handle_connection)
|
|
app.router.add_get("/ws/context", self._context_ws.handle_connection)
|
|
app.router.add_get("/ws/token", self._token_ws.handle_connection)
|
|
app.router.add_get("/ws/stdout", self._stdout_ws.handle_connection) |