23 lines
504 B
Python
23 lines
504 B
Python
|
|
import uuid
|
||
|
|
from dataclasses import dataclass
|
||
|
|
|
||
|
|
|
||
|
|
@dataclass
|
||
|
|
class StreamSessionState:
|
||
|
|
session_id: str
|
||
|
|
channel: str = "messenger"
|
||
|
|
stream_mode: str = "block"
|
||
|
|
chunk_min: int = 80
|
||
|
|
chunk_max: int = 2000
|
||
|
|
coalesce_idle_ms: int = 500
|
||
|
|
|
||
|
|
|
||
|
|
class MessengerStreaming:
|
||
|
|
streaming_mode = "block"
|
||
|
|
block_streaming_enabled = True
|
||
|
|
|
||
|
|
def create_draft_stream_session(self, **kwargs) -> StreamSessionState:
|
||
|
|
return StreamSessionState(
|
||
|
|
session_id=str(uuid.uuid4()),
|
||
|
|
)
|