2026-05-12 00:53:57 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import TYPE_CHECKING, Protocol, runtime_checkable
|
|
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from yuxi.channels.models import DeliveryResult
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@runtime_checkable
|
|
|
|
|
class ChannelStreamingProtocol(Protocol):
|
|
|
|
|
@property
|
|
|
|
|
def streaming_modes(self) -> list[str]: ...
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def block_streaming(self) -> bool: ...
|
|
|
|
|
|
2026-05-13 16:20:54 +08:00
|
|
|
@property
|
|
|
|
|
def supports_typing_indicator(self) -> bool:
|
|
|
|
|
return getattr(self, "capabilities", None) is not None and getattr(self.capabilities, "typing", False)
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def supports_message_edit(self) -> bool:
|
|
|
|
|
return getattr(self, "capabilities", None) is not None and getattr(self.capabilities, "edit", False)
|
|
|
|
|
|
2026-05-12 00:53:57 +08:00
|
|
|
async def send_stream_chunk(self, chat_id: str, msg_id: str, chunk: str, finished: bool) -> DeliveryResult: ...
|
2026-05-13 16:20:54 +08:00
|
|
|
|
|
|
|
|
async def send_typing_indicator(self, chat_id: str, active: bool) -> DeliveryResult: ...
|
|
|
|
|
|
|
|
|
|
async def fallback_send(self, chat_id: str, text: str) -> DeliveryResult: ...
|