Add docs for field update, icon, and small fixes (#1459)

* Refactor code formatting and improve error handling in utils.py

* Refactor parameterComponent to include refresh button

* Update Langflow description

* Add new_langflow_demo.gif and remove langflow-demo.gif and langflow-screen.png

* Update image source path in README.md

* Add dynamic options and default value support to CustomComponent class
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-21 22:30:01 -03:00 committed by GitHub
commit 8c897514aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 36 additions and 11 deletions

View file

@ -372,7 +372,7 @@ def update_field_dict(field_dict):
field_dict["refresh"] = True
if "value" in field_dict and callable(field_dict["value"]):
field_dict["value"] = field_dict["value"](field_dict.get("options", []))
field_dict["value"] = field_dict["value"]()
field_dict["refresh"] = True
# Let's check if "range_spec" is a RangeSpec object

View file

@ -403,13 +403,27 @@ export default function ParameterComponent({
data-testid={"textarea-" + data.node.template[name].name}
/>
) : (
<InputComponent
id={"input-" + index}
disabled={disabled}
password={data.node?.template[name].password ?? false}
value={data.node?.template[name].value ?? ""}
onChange={handleOnNewValue}
/>
<div className="mt-2 flex w-full items-center">
<div className="w-5/6 flex-grow">
<InputComponent
id={"input-" + index}
disabled={disabled}
password={data.node?.template[name].password ?? false}
value={data.node?.template[name].value ?? ""}
onChange={handleOnNewValue}
/>
</div>
{data.node?.template[name].refresh && (
<button
className="extra-side-bar-buttons ml-2 mt-1 w-1/6"
onClick={() => {
handleUpdateValues(name, data);
}}
>
<IconComponent name="RefreshCcw" />
</button>
)}
</div>
)}
</div>
) : left === true && type === "bool" ? (