Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: fix when tool execute in progress tool_meta miss tool_provider_type (#39513)

wangxiaolei5277e4b37510
diff --git a/api/services/agent_service.py b/api/services/agent_service.py
index 74c2a9ae56a..e065e1f978b 100644
--- a/api/services/agent_service.py
+++ b/api/services/agent_service.py
@@ -9,6 +9,7 @@ import contexts
from core.app.app_config.easy_ui_based_app.agent.manager import AgentConfigManager
from core.plugin.impl.agent import PluginAgentClient
from core.plugin.impl.exc import PluginDaemonClientSideError
+from core.tools.entities.tool_entities import EmojiIconDict
from core.tools.tool_manager import ToolManager
from libs.login import current_user
from models import Account
@@ -105,11 +106,22 @@ class AgentService:
tool_output = tool_outputs.get(tool_name, {})
tool_meta_data = tool_meta.get(tool_name, {})
tool_config = tool_meta_data.get("tool_config", {})
- if tool_config.get("tool_provider_type", "") != "dataset-retrieval":
+ tool_provider_type = tool_config.get("tool_provider_type", "")
+ tool_provider_id = tool_config.get("tool_provider", "")
+
+ if not tool_provider_type:
+ tool_entity = find_agent_tool(tool_name)
+ if tool_entity:
+ tool_provider_type = tool_entity.provider_type
+ tool_provider_id = tool_provider_id or tool_entity.provider_id
+
+ tool_icon: str | EmojiIconDict = ""
+
+ if tool_provider_type and tool_provider_type != "dataset-retrieval":
tool_icon = ToolManager.get_tool_icon(
tenant_id=app_model.tenant_id,
- provider_type=tool_config.get("tool_provider_type", ""),
- provider_id=tool_config.get("tool_provider", ""),
+ provider_type=tool_provider_type,
+ provider_id=tool_provider_id,
)
if not tool_icon:
tool_entity = find_agent_tool(tool_name)