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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: prepare the plugin daemon base url to yarl URL ahead intstead of in every invocation (#20541)
Bowen Liang888cd86afda7
diff --git a/api/core/helper/code_executor/code_executor.py b/api/core/helper/code_executor/code_executor.pyindex 5bb045cce9b..2b580cb3730 100644--- a/api/core/helper/code_executor/code_executor.py+++ b/api/core/helper/code_executor/code_executor.py@@ -15,6 +15,7 @@ from core.helper.code_executor.python3.python3_transformer import Python3Templatfrom core.helper.code_executor.template_transformer import TemplateTransformerlogger = logging.getLogger(__name__)+code_execution_endpoint_url = URL(str(dify_config.CODE_EXECUTION_ENDPOINT))class CodeExecutionError(Exception):@@ -64,7 +65,7 @@ class CodeExecutor::param code: code:return:"""- url = URL(str(dify_config.CODE_EXECUTION_ENDPOINT)) / "v1" / "sandbox" / "run"+ url = code_execution_endpoint_url / "v1" / "sandbox" / "run"headers = {"X-Api-Key": dify_config.CODE_EXECUTION_API_KEY}diff --git a/api/core/helper/marketplace.py b/api/core/helper/marketplace.pyindex f4129b88eda..65bf4fc1db5 100644--- a/api/core/helper/marketplace.py+++ b/api/core/helper/marketplace.py@@ -7,29 +7,28 @@ from configs import dify_configfrom core.helper.download import download_with_size_limitfrom core.plugin.entities.marketplace import MarketplacePluginDeclaration+marketplace_api_url = URL(str(dify_config.MARKETPLACE_API_URL))-def get_plugin_pkg_url(plugin_unique_identifier: str):- return (URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/plugins/download").with_query(- unique_identifier=plugin_unique_identifier- )++def get_plugin_pkg_url(plugin_unique_identifier: str) -> str:+ return str((marketplace_api_url / "api/v1/plugins/download").with_query(unique_identifier=plugin_unique_identifier))def download_plugin_pkg(plugin_unique_identifier: str):- url = str(get_plugin_pkg_url(plugin_unique_identifier))- return download_with_size_limit(url, dify_config.PLUGIN_MAX_PACKAGE_SIZE)+ return download_with_size_limit(get_plugin_pkg_url(plugin_unique_identifier), dify_config.PLUGIN_MAX_PACKAGE_SIZE)def batch_fetch_plugin_manifests(plugin_ids: list[str]) -> Sequence[MarketplacePluginDeclaration]:if len(plugin_ids) == 0:return []- url = str(URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/plugins/batch")+ url = str(marketplace_api_url / "api/v1/plugins/batch")response = requests.post(url, json={"plugin_ids": plugin_ids})response.raise_for_status()return [MarketplacePluginDeclaration(**plugin) for plugin in response.json()["data"]["plugins"]]def record_install_plugin_event(plugin_unique_identifier: str):- url = str(URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/stats/plugins/install_count")+ url = str(marketplace_api_url / "api/v1/stats/plugins/install_count")response = requests.post(url, json={"unique_identifier": plugin_unique_identifier})response.raise_for_status()diff --git a/api/core/plugin/impl/base.py b/api/core/plugin/impl/base.pyindex 7b9592bff34..7375726fa97 100644--- a/api/core/plugin/impl/base.py+++ b/api/core/plugin/impl/base.py@@ -31,8 +31,7 @@ from core.plugin.impl.exc import (PluginUniqueIdentifierError,)-plugin_daemon_inner_api_baseurl = dify_config.PLUGIN_DAEMON_URL-plugin_daemon_inner_api_key = dify_config.PLUGIN_DAEMON_KEY+plugin_daemon_inner_api_baseurl = URL(str(dify_config.PLUGIN_DAEMON_URL))T = TypeVar("T", bound=(BaseModel | dict | list | bool | str))@@ -53,9 +52,9 @@ class BasePluginClient:"""Make a request to the plugin daemon inner API."""- url = URL(str(plugin_daemon_inner_api_baseurl)) / path+ url = plugin_daemon_inner_api_baseurl / pathheaders = headers or {}- headers["X-Api-Key"] = plugin_daemon_inner_api_key+ headers["X-Api-Key"] = dify_config.PLUGIN_DAEMON_KEYheaders["Accept-Encoding"] = "gzip, deflate, br"if headers.get("Content-Type") == "application/json" and isinstance(data, dict):