__init__.py 891 B

12345678910111213141516171819
  1. from contextvars import ContextVar
  2. from threading import Lock
  3. from typing import TYPE_CHECKING
  4. if TYPE_CHECKING:
  5. from core.plugin.entities.plugin_daemon import PluginModelProviderEntity
  6. from core.tools.plugin_tool.provider import PluginToolProviderController
  7. from core.workflow.entities.variable_pool import VariablePool
  8. tenant_id: ContextVar[str] = ContextVar("tenant_id")
  9. workflow_variable_pool: ContextVar["VariablePool"] = ContextVar("workflow_variable_pool")
  10. plugin_tool_providers: ContextVar[dict[str, "PluginToolProviderController"]] = ContextVar("plugin_tool_providers")
  11. plugin_tool_providers_lock: ContextVar[Lock] = ContextVar("plugin_tool_providers_lock")
  12. plugin_model_providers: ContextVar[list["PluginModelProviderEntity"] | None] = ContextVar("plugin_model_providers")
  13. plugin_model_providers_lock: ContextVar[Lock] = ContextVar("plugin_model_providers_lock")