mirror of
https://github.com/langgenius/dify.git
synced 2026-05-01 07:58:02 +08:00
fix: hide internal builtin providers from tool list
This commit is contained in:
@ -67,6 +67,8 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
INTERNAL_BUILTIN_TOOL_PROVIDERS = {"agent_output"}
|
||||
|
||||
|
||||
class ApiProviderControllerItem(TypedDict):
|
||||
provider: ApiToolProvider
|
||||
@ -598,6 +600,10 @@ class ToolManager:
|
||||
cls._hardcoded_providers = {}
|
||||
cls._builtin_providers_loaded = False
|
||||
|
||||
@classmethod
|
||||
def is_internal_builtin_provider(cls, provider_name: str) -> bool:
|
||||
return provider_name in INTERNAL_BUILTIN_TOOL_PROVIDERS
|
||||
|
||||
@classmethod
|
||||
def get_tool_label(cls, tool_name: str) -> Union[I18nObject, None]:
|
||||
"""
|
||||
@ -674,6 +680,8 @@ class ToolManager:
|
||||
|
||||
# append builtin providers
|
||||
for provider in builtin_providers:
|
||||
if cls.is_internal_builtin_provider(provider.entity.identity.name):
|
||||
continue
|
||||
# handle include, exclude
|
||||
if is_filtered(
|
||||
include_set=dify_config.POSITION_TOOL_INCLUDES_SET,
|
||||
|
||||
@ -91,6 +91,8 @@ class BuiltinToolManageService:
|
||||
:return: the list of tools
|
||||
"""
|
||||
provider_controller = ToolManager.get_builtin_provider(provider, tenant_id)
|
||||
if ToolManager.is_internal_builtin_provider(provider_controller.entity.identity.name):
|
||||
return []
|
||||
tools = provider_controller.get_tools()
|
||||
|
||||
result: list[ToolApiEntity] = []
|
||||
@ -541,6 +543,8 @@ class BuiltinToolManageService:
|
||||
|
||||
for provider_controller in provider_controllers:
|
||||
try:
|
||||
if ToolManager.is_internal_builtin_provider(provider_controller.entity.identity.name):
|
||||
continue
|
||||
# handle include, exclude
|
||||
if is_filtered(
|
||||
include_set=dify_config.POSITION_TOOL_INCLUDES_SET,
|
||||
|
||||
@ -25,7 +25,6 @@ from core.model_runtime.entities.message_entities import (
|
||||
TextPromptMessageContent,
|
||||
UserPromptMessage,
|
||||
)
|
||||
from core.model_runtime.entities.common_entities import I18nObject
|
||||
from core.model_runtime.entities.model_entities import (
|
||||
AIModelEntity,
|
||||
ModelType,
|
||||
|
||||
Reference in New Issue
Block a user