mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-26 10:23:28 +08:00
Refactor: reformat all code for lefthook using ruff and gofmt (#16585)
This commit is contained in:
@@ -25,16 +25,11 @@ class LoopParam(ComponentParamBase):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.loop_variables = []
|
||||
self.loop_termination_condition=[]
|
||||
self.loop_termination_condition = []
|
||||
self.maximum_loop_count = 0
|
||||
|
||||
def get_input_form(self) -> dict[str, dict]:
|
||||
return {
|
||||
"items": {
|
||||
"type": "json",
|
||||
"name": "Items"
|
||||
}
|
||||
}
|
||||
return {"items": {"type": "json", "name": "Items"}}
|
||||
|
||||
def check(self):
|
||||
return True
|
||||
@@ -83,10 +78,10 @@ class Loop(ComponentBase, ABC):
|
||||
for item in self._param.loop_variables:
|
||||
if self._is_incomplete_loop_variable(item):
|
||||
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":
|
||||
self.set_output(item["variable"],item["value"])
|
||||
if item["input_mode"] == "variable":
|
||||
self.set_output(item["variable"], self._canvas.get_variable_value(item["value"]))
|
||||
elif item["input_mode"] == "constant":
|
||||
self.set_output(item["variable"], item["value"])
|
||||
else:
|
||||
if item["type"] == "number":
|
||||
self.set_output(item["variable"], 0)
|
||||
@@ -101,6 +96,5 @@ class Loop(ComponentBase, ABC):
|
||||
else:
|
||||
self.set_output(item["variable"], "")
|
||||
|
||||
|
||||
def thoughts(self) -> str:
|
||||
return "Loop from canvas."
|
||||
return "Loop from canvas."
|
||||
|
||||
Reference in New Issue
Block a user