2024-07-22 15:29:39 +08:00
|
|
|
from contextvars import ContextVar
|
2024-12-02 21:08:36 +08:00
|
|
|
from threading import Lock
|
2024-10-21 10:43:49 +08:00
|
|
|
from typing import TYPE_CHECKING
|
2024-07-22 15:29:39 +08:00
|
|
|
|
2024-10-21 10:43:49 +08:00
|
|
|
if TYPE_CHECKING:
|
2024-12-19 00:50:46 +08:00
|
|
|
from core.plugin.entities.plugin_daemon import PluginModelProviderEntity
|
2024-12-19 01:02:44 +08:00
|
|
|
from core.tools.plugin_tool.provider import PluginToolProviderController
|
2024-10-21 10:43:49 +08:00
|
|
|
from core.workflow.entities.variable_pool import VariablePool
|
2024-08-15 10:53:05 +08:00
|
|
|
|
2024-12-19 00:50:46 +08:00
|
|
|
|
2024-08-15 12:54:05 +08:00
|
|
|
tenant_id: ContextVar[str] = ContextVar("tenant_id")
|
2024-08-15 10:53:05 +08:00
|
|
|
|
2024-10-21 10:43:49 +08:00
|
|
|
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")
|
2024-12-19 00:50:46 +08:00
|
|
|
|
2024-12-19 01:02:08 +08:00
|
|
|
plugin_model_providers: ContextVar[list["PluginModelProviderEntity"] | None] = ContextVar("plugin_model_providers")
|
2024-12-19 00:50:46 +08:00
|
|
|
plugin_model_providers_lock: ContextVar[Lock] = ContextVar("plugin_model_providers_lock")
|