dify/api/contexts/__init__.py

15 lines
606 B
Python
Raw Normal View History

from contextvars import ContextVar
2024-12-02 21:08:36 +08:00
from threading import Lock
from typing import TYPE_CHECKING
if TYPE_CHECKING:
2024-12-02 21:08:36 +08:00
from core.tools.plugin_tool.provider import PluginToolProviderController
from core.workflow.entities.variable_pool import VariablePool
tenant_id: ContextVar[str] = ContextVar("tenant_id")
workflow_variable_pool: ContextVar["VariablePool"] = ContextVar("workflow_variable_pool")
2024-12-02 21:08:36 +08:00
plugin_tool_providers: ContextVar[dict[str, "PluginToolProviderController"]] = ContextVar("plugin_tool_providers")
plugin_tool_providers_lock: ContextVar[Lock] = ContextVar("plugin_tool_providers_lock")