Переимнованы OutgoingMessage в ServerMessage и IncomingMessage в ClientMessage

This commit is contained in:
Ярослав Малинин 2026-03-30 10:05:19 +03:00
parent dab8cf6335
commit f2d50ae88b
3 changed files with 10 additions and 10 deletions

View file

@ -1,7 +1,7 @@
import logging
from typing import AsyncGenerator
import aiohttp
from models import IM, OM, IncomingMessage, OutgoingMessage
from models import IM, OM, ClientMessage, ServerMessage
logger = logging.getLogger(__name__)
@ -126,7 +126,7 @@ class AgentApi:
self._connected = False
raise aiohttp.ClientError(f"Failed to send message: {e}") from e
async def listen(self) -> AsyncGenerator[OutgoingMessage, None]:
async def listen(self) -> AsyncGenerator[ServerMessage, None]:
"""
Читает поток сообщений от сервера и десериализует их.
@ -137,7 +137,7 @@ class AgentApi:
- OM.AgentEvent: Возвращает объект события
Yields:
OutgoingMessage: Десериализованное сообщение от сервера
ServerMessage: Десериализованное сообщение от сервера
Raises:
RuntimeError: Если соединение не установлено
@ -158,7 +158,7 @@ class AgentApi:
async for msg in self._ws:
if msg.type == aiohttp.WSMsgType.TEXT:
try:
outgoing_msg = OutgoingMessage.model_validate_json(
outgoing_msg = ServerMessage.model_validate_json(
msg.data)
logger.debug(
f"Received message of type: {outgoing_msg.type}")