From f54a8d774885235b1be64107d71637b9867df3a1 Mon Sep 17 00:00:00 2001 From: Kevin Hu Date: Fri, 6 Dec 2024 18:32:57 +0800 Subject: [PATCH] Remove vector stored in component output. (#3908) ### What problem does this PR solve? Close #3805 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- agent/component/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent/component/base.py b/agent/component/base.py index 63d5f0d84..5825eba58 100644 --- a/agent/component/base.py +++ b/agent/component/base.py @@ -383,6 +383,9 @@ class ComponentBase(ABC): "params": {} } """ + out = json.loads(str(self._param)).get("output", {}) + if isinstance(out, dict) and "vector" in out: + del out["vector"] return """{{ "component_name": "{}", "params": {}, @@ -390,7 +393,7 @@ class ComponentBase(ABC): "inputs": {} }}""".format(self.component_name, self._param, - json.dumps(json.loads(str(self._param)).get("output", {}), ensure_ascii=False), + json.dumps(out, ensure_ascii=False), json.dumps(json.loads(str(self._param)).get("inputs", []), ensure_ascii=False) )