22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
|
|
from contextvars import ContextVar
|
||
|
|
from typing import Any, Callable, Awaitable, Dict, Optional
|
||
|
|
|
||
|
|
# The current session ID processing the request
|
||
|
|
current_session_id: ContextVar[str] = ContextVar("current_session_id", default="")
|
||
|
|
|
||
|
|
# A callback to send progress updates to the frontend during tool execution
|
||
|
|
current_progress_callback: ContextVar[Optional[Callable[[str], Awaitable[None]]]] = ContextVar("current_progress_callback", default=None)
|
||
|
|
|
||
|
|
# A payload dictionary to store visualization results generated by tools
|
||
|
|
# This will be picked up by the stream handler and sent to the frontend
|
||
|
|
current_viz_data: ContextVar[Optional[Dict[str, Any]]] = ContextVar("current_viz_data", default=None)
|
||
|
|
|
||
|
|
# Store the last queried data so the Visualization Tool can access it
|
||
|
|
current_data: ContextVar[Optional[list]] = ContextVar("current_data", default=None)
|
||
|
|
|
||
|
|
# The data source requested by the user or bound to the session
|
||
|
|
current_data_source: ContextVar[str] = ContextVar("current_data_source", default="postgres")
|
||
|
|
|
||
|
|
# Any file URL attached to the request
|
||
|
|
current_file_url: ContextVar[Optional[str]] = ContextVar("current_file_url", default=None)
|