Files

24 lines
1.2 KiB
Python
Raw Permalink Normal View History

2026-03-18 21:58:11 +08:00
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)
2026-03-29 00:20:53 +08:00
current_knowledge_base_id: ContextVar[Optional[str]] = ContextVar("current_knowledge_base_id", default=None)