diff --git a/README.md b/README.md index 5547694a0..72bb7fcc6 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The easiest way to create and customize your flow - + # 📦 Installation diff --git a/docs/docs/components/custom.mdx b/docs/docs/components/custom.mdx index 112e40ed8..89966b186 100644 --- a/docs/docs/components/custom.mdx +++ b/docs/docs/components/custom.mdx @@ -82,6 +82,16 @@ The CustomComponent class serves as the foundation for creating custom component | _`info: str`_ | Adds a tooltip to the field. | | _`file_types: List[str]`_ | This is a requirement if the _`field_type`_ is _file_. Defines which file types will be accepted. For example, _json_, _yaml_ or _yml_. | | _`range_spec: langflow.field_typing.RangeSpec`_ | This is a requirement if the _`field_type`_ is _`float`_. Defines the range of values accepted and the step size. If none is defined, the default is _`[-1, 1, 0.1]`_. | + + + + Keys _`options`_ and _`value`_ can receive a method or function that returns a list of strings or a string, respectively. This is useful when you want to dynamically generate the options or the default value of a field. A refresh button will appear next to the field in the component, allowing the user to update the options or the default value. + + + + + + - The CustomComponent class also provides helpful methods for specific tasks (e.g., to load and use other flows from the Langflow platform): | Method Name | Description | @@ -96,6 +106,7 @@ The CustomComponent class serves as the foundation for creating custom component | -------------- | ----------------------------------------------------------------------------- | | _`status`_ | Displays the value it receives in the _`build`_ method. Useful for debugging. | | _`field_order`_ | Defines the order the fields will be displayed in the canvas. | + | _`icon`_ | Defines the emoji (for example, _`:rocket:`_) that will be displayed in the canvas. | diff --git a/docs/docs/index.mdx b/docs/docs/index.mdx index f0fee5009..512d2578b 100644 --- a/docs/docs/index.mdx +++ b/docs/docs/index.mdx @@ -1,6 +1,6 @@ # 👋 Welcome to Langflow -Langflow is an easy way to prototype [LangChain](https://github.com/hwchase17/langchain) flows. The drag-and-drop feature allows quick and effortless experimentation, while the built-in chat interface facilitates real-time interaction. It provides options to edit prompt parameters, create chains and agents, track thought processes, and export flows. +Langflow is an easy way to create flows. The drag-and-drop feature allows quick and effortless experimentation, while the built-in chat interface facilitates real-time interaction. It provides options to edit prompt parameters, create chains and agents, track thought processes, and export flows. import ThemedImage from "@theme/ThemedImage"; import useBaseUrl from "@docusaurus/useBaseUrl"; @@ -11,7 +11,7 @@ import ZoomableImage from "/src/theme/ZoomableImage.js"; diff --git a/img/new_langflow_demo.gif b/docs/static/img/new_langflow_demo.gif similarity index 100% rename from img/new_langflow_demo.gif rename to docs/static/img/new_langflow_demo.gif diff --git a/img/langflow-demo.gif b/img/langflow-demo.gif deleted file mode 100644 index 4cea58628..000000000 Binary files a/img/langflow-demo.gif and /dev/null differ diff --git a/img/langflow-screen.png b/img/langflow-screen.png deleted file mode 100644 index 49ef0b053..000000000 Binary files a/img/langflow-screen.png and /dev/null differ diff --git a/src/backend/langflow/interface/custom/utils.py b/src/backend/langflow/interface/custom/utils.py index c377a1c96..2511c08ca 100644 --- a/src/backend/langflow/interface/custom/utils.py +++ b/src/backend/langflow/interface/custom/utils.py @@ -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 diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 7201bba3b..533d60842 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -403,13 +403,27 @@ export default function ParameterComponent({ data-testid={"textarea-" + data.node.template[name].name} /> ) : ( - +
+
+ +
+ {data.node?.template[name].refresh && ( + + )} +
)} ) : left === true && type === "bool" ? (