From e845d5f9f85c69a7db773aacdfd6f4b3311809f6 Mon Sep 17 00:00:00 2001 From: Popmio <102001444+Popmio@users.noreply.github.com> Date: Tue, 12 Aug 2025 17:39:03 +0800 Subject: [PATCH] Fix:valueERROR when file is optional but not exist value (#9414) ### What problem does this PR solve? when begin component has optional file but not exist , it rase error ### Type of change - [x] Bug Fix Co-authored-by: Popmio --- agent/component/begin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/component/begin.py b/agent/component/begin.py index d65a698fa..159f0f5d7 100644 --- a/agent/component/begin.py +++ b/agent/component/begin.py @@ -39,7 +39,10 @@ class Begin(UserFillUp): def _invoke(self, **kwargs): for k, v in kwargs.get("inputs", {}).items(): if isinstance(v, dict) and v.get("type", "").lower().find("file") >=0: - v = self._canvas.get_files([v["value"]]) + if v.get("optional") and v.get("value", None) is None: + v = None + else: + v = self._canvas.get_files([v["value"]]) else: v = v.get("value") self.set_output(k, v)