Files
ailine/backend/app/main_graph/config.py

22 lines
561 B
Python
Raw Normal View History

"""
Main Graph Configuration - Streaming Writer
"""
from typing import Optional, Callable, Any
_stream_writer: Optional[Callable[[Any], None]] = None
def set_stream_writer(writer: Callable[[Any], None]):
"""Set the global stream writer"""
global _stream_writer
_stream_writer = writer
def get_stream_writer() -> Callable[[Any], None]:
"""Get the global stream writer"""
global _stream_writer
if _stream_writer is None:
# Default no-op writer
def noop(_):
pass
return noop
return _stream_writer