Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: replace broken assert with raise ValueError in variable_assigner and loop (#13906)

Ricardo-M-Lcc21dc7f007e
diff --git a/agent/component/loop.py b/agent/component/loop.py
index 484dfae825..9558e1001e 100644
--- a/agent/component/loop.py
+++ b/agent/component/loop.py
@@ -56,7 +56,7 @@ class Loop(ComponentBase, ABC):
for item in self._param.loop_variables:
if any([not item.get("variable"), not item.get("input_mode"), not item.get("value"),not item.get("type")]):
- assert "Loop Variable is not complete."
+ raise ValueError("Loop Variable is not complete.")
if item["input_mode"]=="variable":
self.set_output(item["variable"],self._canvas.get_variable_value(item["value"]))
elif item["input_mode"]=="constant":
diff --git a/agent/component/variable_assigner.py b/agent/component/variable_assigner.py
index dd6182c7ce..0f78213684 100644
--- a/agent/component/variable_assigner.py
+++ b/agent/component/variable_assigner.py
@@ -48,7 +48,7 @@ class VariableAssigner(ComponentBase,ABC):
else:
for item in self._param.variables:
if any([not item.get("variable"), not item.get("operator"), not item.get("parameter")]):
- assert "Variable is not complete."
+ raise ValueError("Variable is not complete.")
variable=item["variable"]
operator=item["operator"]
parameter=item["parameter"]