import logging from yuxi.channel.extensions.freshdesk.constants import ( FRESHDESK_BLOCK_STREAMING_CHUNK_MAX_CHARS, FRESHDESK_BLOCK_STREAMING_CHUNK_MIN_CHARS, ) logger = logging.getLogger(__name__) class FreshdeskStreaming: streaming_mode = "block" block_streaming_enabled = True block_streaming_chunk_min_chars = FRESHDESK_BLOCK_STREAMING_CHUNK_MIN_CHARS block_streaming_chunk_max_chars = FRESHDESK_BLOCK_STREAMING_CHUNK_MAX_CHARS block_streaming_break = "\n" block_streaming_chunk_break_preference = "paragraph" block_streaming_coalesce_defaults = None def create_pipeline(self, outbound, target_id: str, account_id: str | None = None): from yuxi.channel.streaming.block import BlockReplyPipeline return BlockReplyPipeline( outbound=outbound, target_id=target_id, account_id=account_id, chunk_min_chars=self.block_streaming_chunk_min_chars, chunk_max_chars=self.block_streaming_chunk_max_chars, break_char=self.block_streaming_break, break_preference=self.block_streaming_chunk_break_preference, ) def create_draft_stream_session(self, target_id: str) -> object: return {"target_id": target_id, "content": ""} def create_block_chunker(self) -> object: return {"mode": "length"}