поддержка chat_id

This commit is contained in:
Егор Кандрушин 2026-04-19 11:58:45 +03:00
parent 146dcdf21d
commit 9ac4ef1ba1
2 changed files with 7 additions and 3 deletions

View file

@ -2,6 +2,7 @@ import logging
from typing import Callable, Optional, AsyncIterator
import aiohttp
import asyncio
from urllib.parse import urljoin
from lambda_agent_api.server import *
from lambda_agent_api.client import *
@ -27,10 +28,12 @@ class AgentApi:
agent_id: str,
url: str,
callback: Optional[Callable[[ServerMessage], None]] = None,
on_disconnect: Optional[Callable[['AgentApi'], None]] = None
on_disconnect: Optional[Callable[['AgentApi'], None]] = None,
chat_id: int = 0 # значение по умолчанию для обратной совместимости
):
self.id = agent_id # ID агента для словаря
self.url = url
self.chat_id = chat_id
self.url = urljoin(url, f"{chat_id}/")
self.callback = callback
self.on_disconnect = on_disconnect