Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and Enhance Modal, Button, and Layout Functionality #2064

Merged
merged 60 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7f371af
Added button as footer and a submit form
lucaseduoli May 24, 2024
bc5cd9e
Fixed submitting on storeApiKeyModal
lucaseduoli May 24, 2024
741731c
Added close button when submit is present
lucaseduoli May 24, 2024
47cbedc
Added Submit buttons in every modal, except confirmation
lucaseduoli May 24, 2024
da55854
fixed padding on deleteConfirmationModal
lucaseduoli May 24, 2024
b1a5fb5
Removed Pencil of name of node
lucaseduoli May 30, 2024
f5462b1
Made node description editable by clicking once and changed cursor type
lucaseduoli May 30, 2024
cd9429a
Changed message of terminal as Run Langflow.
lucaseduoli May 30, 2024
a119c37
Changed empty component to open New Project modal
lucaseduoli May 30, 2024
81f6120
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli May 31, 2024
5800801
Implemented unselect on escape
lucaseduoli Jun 1, 2024
ba779d5
Fixed save with my api keys coming as default
lucaseduoli Jun 1, 2024
d2cb545
Fixed scrolling not working in global variables dropdown
lucaseduoli Jun 1, 2024
6e55303
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli Jun 3, 2024
22775cc
Added description column to advanced tab
lucaseduoli Jun 3, 2024
3b8e72f
Removed shadow from card
lucaseduoli Jun 3, 2024
06a568f
Disabled accordion when it is empty
lucaseduoli Jun 3, 2024
cbe2a8a
Fixed tooltip that does not need removal of portal
lucaseduoli Jun 3, 2024
4b4800d
Fixed node toolbar allowing moving the nodes
lucaseduoli Jun 3, 2024
aa568f5
Fixed Endpoint Name labeling
lucaseduoli Jun 3, 2024
46872fe
Passed duplicate flow function to main page
lucaseduoli Jun 3, 2024
6a86872
Made Folders more pleasing
lucaseduoli Jun 3, 2024
6874f38
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli Jun 3, 2024
5b2791a
Formatting
lucaseduoli Jun 4, 2024
1f2cd32
Modularized Loading on buttons
lucaseduoli Jun 4, 2024
65ae9f0
Fixed bottom padding on settings pages
lucaseduoli Jun 4, 2024
eefac9e
Added Store API Key configuration on General Settings page
lucaseduoli Jun 4, 2024
3d8a0ac
Fixed sidebar buttons not being different when path is equal
lucaseduoli Jun 4, 2024
59c8eba
Fixed Button classes to allow loading
lucaseduoli Jun 4, 2024
b5d9e06
Fixed classes on Button to work with all of the current buttons
lucaseduoli Jun 4, 2024
9eacd3f
Fixed sidebar button to not look strange with the new Button classes
lucaseduoli Jun 4, 2024
c36053d
Fixed button not being able to handle multiple children when asChild …
lucaseduoli Jun 4, 2024
f1aaa16
Changed strategy to not have to apply classes to different div elemen…
lucaseduoli Jun 4, 2024
2c851a9
Fix naming of endpoint
lucaseduoli Jun 4, 2024
5b83bde
Returned loader to default, fixed buttons not working with asChild
lucaseduoli Jun 4, 2024
cad4c50
Fixed button layout to have loading the same size as the original button
lucaseduoli Jun 4, 2024
98e40f2
Fixed id scrolling when clicking from Store
lucaseduoli Jun 4, 2024
ee705b5
Added icons
lucaseduoli Jun 4, 2024
bb6578e
Fixed classes of sidebar to make it more like the main page
lucaseduoli Jun 4, 2024
c8fa4d8
Removed div that made an extra space
lucaseduoli Jun 4, 2024
9d49597
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli Jun 4, 2024
1719895
♻️ (reactflowUtils.ts): reorder imports for better readability
Cristhianzl Jun 4, 2024
e6c65af
Merge branch 'fix/minor_bugs' of https://github.com/langflow-ai/langf…
Cristhianzl Jun 4, 2024
4d738e2
Fixed icon not being on the end of the button when its text is not bi…
lucaseduoli Jun 4, 2024
9a9b088
Added redirect to langflow.store
lucaseduoli Jun 4, 2024
e383291
Removed store api key modal
lucaseduoli Jun 4, 2024
0ae32f8
♻️ (playwright.config.ts): disable fullyParallel and increase workers…
Cristhianzl Jun 4, 2024
5d7bf43
Merge branch 'fix/minor_bugs' of https://github.com/langflow-ai/langf…
Cristhianzl Jun 4, 2024
0e5460c
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli Jun 4, 2024
9e6f3a0
Made Submit button use loading of button
lucaseduoli Jun 4, 2024
42d22ae
fixed unnecessary code at Button
lucaseduoli Jun 4, 2024
49ce4b4
fixed button
lucaseduoli Jun 4, 2024
58d11af
Fixed loading not being of the right size
lucaseduoli Jun 4, 2024
898e9f1
♻️ (GeneralPage): refactor API calls into custom hooks for better mod…
Cristhianzl Jun 4, 2024
14a7e28
✨ (frontend): add switch-case-size helper for modal size management
Cristhianzl Jun 5, 2024
9bafb1f
Fixed success alert not appearing at front, and removed alert display…
lucaseduoli Jun 5, 2024
1cdc8e0
Changed debounce to use promise-debounce, making the Save promise wor…
lucaseduoli Jun 5, 2024
c2b58d4
Removed unused code from flowLogsModal
lucaseduoli Jun 5, 2024
f22b2b2
Merge remote-tracking branch 'origin/dev' into fix/minor_bugs
lucaseduoli Jun 5, 2024
6096c8b
🔧 (playwright.config.ts): reduce workers to 1 for CI to avoid resourc…
Cristhianzl Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 40 additions & 37 deletions docs/docs/components/custom.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import Admonition from "@theme/Admonition";
# Custom Components

<Admonition type="info" label="Tip">
Read the [Custom Component Guidelines](../administration/custom-component) for detailed information on custom components.
Read the [Custom Component Guidelines](../administration/custom-component) for
detailed information on custom components.
</Admonition>

Custom components let you extend Langflow by creating reusable and configurable components from a Python script.
Expand Down Expand Up @@ -31,57 +32,60 @@ This class is the foundation for creating custom components. It allows users to

The following types are supported in the build method:

| Supported Types |
| --------------------------------------------------------- |
| _`str`_, _`int`_, _`float`_, _`bool`_, _`list`_, _`dict`_ |
| _`langflow.field_typing.NestedDict`_ |
| _`langflow.field_typing.Prompt`_ |
| _`langchain.chains.base.Chain`_ |
| _`langchain.PromptTemplate`_ |
| Supported Types |
| ----------------------------------------------------------------- |
| _`str`_, _`int`_, _`float`_, _`bool`_, _`list`_, _`dict`_ |
| _`langflow.field_typing.NestedDict`_ |
| _`langflow.field_typing.Prompt`_ |
| _`langchain.chains.base.Chain`_ |
| _`langchain.PromptTemplate`_ |
| _`from langchain.schema.language_model import BaseLanguageModel`_ |
| _`langchain.Tool`_ |
| _`langchain.document_loaders.base.BaseLoader`_ |
| _`langchain.schema.Document`_ |
| _`langchain.text_splitters.TextSplitter`_ |
| _`langchain.vectorstores.base.VectorStore`_ |
| _`langchain.embeddings.base.Embeddings`_ |
| _`langchain.schema.BaseRetriever`_ |
| _`langchain.Tool`_ |
| _`langchain.document_loaders.base.BaseLoader`_ |
| _`langchain.schema.Document`_ |
| _`langchain.text_splitters.TextSplitter`_ |
| _`langchain.vectorstores.base.VectorStore`_ |
| _`langchain.embeddings.base.Embeddings`_ |
| _`langchain.schema.BaseRetriever`_ |

The difference between _`dict`_ and _`langflow.field_typing.NestedDict`_ is that one adds a simple key-value pair field, while the other opens a more robust dictionary editor.

<Admonition type="info">
Use the `Prompt` type by adding **kwargs to the build method.
If you want to add the values of the variables to the template you defined, format the `PromptTemplate` inside the `CustomComponent` class.
Use the `Prompt` type by adding **kwargs to the build method. If you want to
add the values of the variables to the template you defined, format the
`PromptTemplate` inside the `CustomComponent` class.
</Admonition>

<Admonition type="info">
Use base Python types without a handle by default. To add handles, use the `input_types` key in the `build_config` method.
Use base Python types without a handle by default. To add handles, use the
`input_types` key in the `build_config` method.
</Admonition>

**build_config:** Defines the configuration fields of the component. This method returns a dictionary where each key represents a field name and each value defines the field's behavior.

Supported keys for configuring fields:

| Key | Description |
| --------------------- | --------------------------------------------------- |
| `is_list` | Boolean indicating if the field can hold multiple values. |
| `options` | Dropdown menu options. |
| `multiline` | Boolean indicating if a field allows multiline input. |
| `input_types` | Allows connection handles for string fields. |
| `display_name` | Field name displayed in the UI. |
| `advanced` | Hides the field in the default UI view. |
| `password` | Masks input, useful for sensitive data. |
| `required` | Overrides the default behavior to make a field mandatory. |
| `info` | Tooltip for the field. |
| `file_types` | Accepted file types, useful for file fields. |
| `range_spec` | Defines valid ranges for float fields. |
| `title_case` | Boolean that controls field name capitalization. |
| `refresh_button` | Adds a refresh button that updates field values. |
| `real_time_refresh` | Updates the configuration as field values change. |
| `field_type` | Automatically set based on the build method's type hint. |
| Key | Description |
| ------------------- | --------------------------------------------------------- |
| `is_list` | Boolean indicating if the field can hold multiple values. |
| `options` | Dropdown menu options. |
| `multiline` | Boolean indicating if a field allows multiline input. |
| `input_types` | Allows connection handles for string fields. |
| `display_name` | Field name displayed in the UI. |
| `advanced` | Hides the field in the default UI view. |
| `password` | Masks input, useful for sensitive data. |
| `required` | Overrides the default behavior to make a field mandatory. |
| `info` | Tooltip for the field. |
| `file_types` | Accepted file types, useful for file fields. |
| `range_spec` | Defines valid ranges for float fields. |
| `title_case` | Boolean that controls field name capitalization. |
| `refresh_button` | Adds a refresh button that updates field values. |
| `real_time_refresh` | Updates the configuration as field values change. |
| `field_type` | Automatically set based on the build method's type hint. |

<Admonition type="info" label="Tip">
Use the `update_build_config` method to dynamically update configurations based on field values.
Use the `update_build_config` method to dynamically update configurations
based on field values.
</Admonition>

## Additional methods and attributes
Expand All @@ -99,4 +103,3 @@ The `CustomComponent` class also provides helpful methods for specific tasks (e.
- `status`: Shows values from the `build` method, useful for debugging.
- `field_order`: Controls the display order of fields.
- `icon`: Sets the canvas display icon.

2 changes: 1 addition & 1 deletion docs/docs/examples/chat-memory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ This component is available under the **Helpers** tab of the Langflow preview.
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/chat_memory.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/combine-text.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ This component is available under the **Helpers** tab of the Langflow preview.
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/combine_text.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/create-record.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ The **Create Record** component allows you to dynamically create a `Record` from
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/create_record.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/pass.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ The **Pass** component enables you to ignore one input and move forward with ano
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/pass.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/store-message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ The **Message History** component can then be used to retrieve stored messages.
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/store_message.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/sub-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ The **Sub Flow** component enables a user to select a previously built flow and
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/sub_flow.mp4" />
</div>
</div>
2 changes: 1 addition & 1 deletion docs/docs/examples/text-operator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ The **Text Operator** component simplifies logic. It evaluates the results from
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/text_operator.mp4" />
</div>
</div>
18 changes: 8 additions & 10 deletions docs/docs/getting-started/canvas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ Components are the building blocks of flows. They consist of inputs, outputs, an
<div style={{ marginBottom: "20px" }}>
During the flow creation process, you will notice handles (colored circles)
attached to one or both sides of a component. These handles represent the
availability to connect to other components. Hover over a handle to see connection details.
availability to connect to other components. Hover over a handle to see
connection details.
</div>

<div style={{ marginBottom: "20px" }}>
Expand Down Expand Up @@ -85,6 +86,7 @@ Build the flow by clicking the **![Playground icon](/logos/botmessage.svg)Playgr

Once the validation is complete, the status of each validated component should turn green (![Status icon](/logos/greencheck.svg)).
To debug, hover over the component status to see the outputs.

</div>

---
Expand Down Expand Up @@ -196,6 +198,7 @@ curl -X POST \
```

Result:

```
{"session_id":"f2eefd80-bb91-4190-9279-0d6ffafeaac4:53856a772b8e1cfcb3dd2e71576b5215399e95bae318d3c02101c81b7c252da3","outputs":[{"inputs":{"input_value":"is anybody there?"},"outputs":[{"results":{"result":"Arrr, me hearties! Aye, this be Captain [Your Name] speakin'. What be ye needin', matey?"},"artifacts":{"message":"Arrr, me hearties! Aye, this be Captain [Your Name] speakin'. What be ye needin', matey?","sender":"Machine","sender_name":"AI"},"messages":[{"message":"Arrr, me hearties! Aye, this be Captain [Your Name] speakin'. What be ye needin', matey?","sender":"Machine","sender_name":"AI","component_id":"ChatOutput-njtka"}],"component_display_name":"Chat Output","component_id":"ChatOutput-njtka"}]}]}%
```
Expand Down Expand Up @@ -231,9 +234,10 @@ A collection is a snapshot of flows available in a database.

Collections can be downloaded to local storage and uploaded for future use.

<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'center' }}>
<ReactPlayer playing controls url='/videos/langflow_collection.mp4'
/>
<div
style={{ marginBottom: "20px", display: "flex", justifyContent: "center" }}
>
<ReactPlayer playing controls url="/videos/langflow_collection.mp4" />
</div>

## Project
Expand Down Expand Up @@ -276,9 +280,3 @@ To see options for your project, in the upper left corner of the canvas, select
**Export** - Download your current project to your local machine as a `.json` file.

**Undo** or **Redo** - Undo or redo your last action.






14 changes: 4 additions & 10 deletions docs/docs/getting-started/flows-components-collections.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ThemedImage from '@theme/ThemedImage';
import useBaseUrl from '@docusaurus/useBaseUrl';
import ZoomableImage from '/src/theme/ZoomableImage.js';
import ReactPlayer from 'react-player';
import ThemedImage from "@theme/ThemedImage";
import useBaseUrl from "@docusaurus/useBaseUrl";
import ZoomableImage from "/src/theme/ZoomableImage.js";
import ReactPlayer from "react-player";

# 🖥️ Flows, components, collections, and projects

Expand All @@ -17,10 +17,4 @@ A [project](#project) can be a component or a flow. Projects are saved as part o

For example, the **OpenAI LLM** is a **component** of the **Basic prompting** flow, and the **flow** is stored in a **collection**.



## Component




15 changes: 12 additions & 3 deletions docs/docs/getting-started/install-langflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,40 @@ import Admonition from "@theme/Admonition";
# 📦 Install Langflow

<Admonition type="info">
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space using this link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true), to create your own Langflow workspace in minutes.
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space
using this
link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true),
to create your own Langflow workspace in minutes.
</Admonition>

Langflow requires [Python >=3.10](https://www.python.org/downloads/release/python-3100/) and [pip](https://pypi.org/project/pip/) or [pipx](https://pipx.pypa.io/stable/installation/) to be installed on your system.

Install Langflow with pip:

```bash
python -m pip install langflow -U
```

Install Langflow with pipx:

```bash
pipx install langflow --python python3.10 --fetch-missing-python
```
Pipx can fetch the missing Python version for you with `--fetch-missing-python`, but you can also install the Python version manually.

Pipx can fetch the missing Python version for you with `--fetch-missing-python`, but you can also install the Python version manually.

## Install Langflow pre-release

To install a pre-release version of Langflow:

pip:

```bash
python -m pip install langflow --pre --force-reinstall
```

pipx:

```bash
pipx install langflow --python python3.10 --fetch-missing-python --pip-args="--pre --force-reinstall"
```
Expand All @@ -52,11 +59,13 @@ python -m langflow --help
## ⛓️ Run Langflow

1. To run Langflow, enter the following command.

```bash
python -m langflow run
```

2. Confirm that a local Langflow instance starts by visiting `http://127.0.0.1:7860` in a Chromium-based browser.

```bash
│ Welcome to ⛓ Langflow │
│ │
Expand All @@ -83,4 +92,4 @@ You'll be presented with the following screen:
style={{ width: "100%", margin: "20px auto" }}
/>

Name your Space, define the visibility (Public or Private), and click on **Duplicate Space** to start the installation process. When installation is finished, you'll be redirected to the Space's main page to start using Langflow right away!
Name your Space, define the visibility (Public or Private), and click on **Duplicate Space** to start the installation process. When installation is finished, you'll be redirected to the Space's main page to start using Langflow right away!
33 changes: 17 additions & 16 deletions docs/docs/getting-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ This guide demonstrates how to build a basic prompt flow and modify that prompt

## Prerequisites

* [Langflow installed and running](./install-langflow.mdx)
- [Langflow installed and running](./install-langflow.mdx)

* [OpenAI API key](https://platform.openai.com)
- [OpenAI API key](https://platform.openai.com)

<Admonition type="info">
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space using this link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true) to create your own Langflow workspace in minutes.
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space
using this
link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true)
to create your own Langflow workspace in minutes.
</Admonition>

## Hello World - Basic Prompting
Expand Down Expand Up @@ -44,25 +47,25 @@ Examine the **Prompt** component. The **Template** field instructs the LLM to `A
This should be interesting...

4. To create an environment variable for the **OpenAI** component, in the **OpenAI API Key** field, click the **Globe** button, and then click **Add New Variable**.
1. In the **Variable Name** field, enter `openai_api_key`.
2. In the **Value** field, paste your OpenAI API Key (`sk-...`).
3. Click **Save Variable**.
1. In the **Variable Name** field, enter `openai_api_key`.
2. In the **Value** field, paste your OpenAI API Key (`sk-...`).
3. Click **Save Variable**.

## Run the basic prompting flow

1. Click the **Run** button.
The **Interaction Panel** opens, where you can chat with your bot.
The **Interaction Panel** opens, where you can chat with your bot.
2. Type a message and press Enter.
And... Ahoy! 🏴‍☠️
The bot responds in a piratical manner!
And... Ahoy! 🏴‍☠️
The bot responds in a piratical manner!

## Modify the prompt for a different result

1. To modify your prompt results, in the **Prompt** template, click the **Template** field.
The **Edit Prompt** window opens.
The **Edit Prompt** window opens.
2. Change `Answer the user as if you were a pirate` to a different character, perhaps `Answer the user as if you were Harold Abelson.`
3. Run the basic prompting flow again.
The response will be markedly different.
The response will be markedly different.

## Next steps

Expand All @@ -72,8 +75,6 @@ By adding Langflow components to your flow, you can create all sorts of interest

Here are a couple of examples:

* [Memory chatbot](/starter-projects/memory-chatbot.mdx)
* [Blog writer](/starter-projects/blog-writer.mdx)
* [Document QA](/starter-projects/document-qa.mdx)


- [Memory chatbot](/starter-projects/memory-chatbot.mdx)
- [Blog writer](/starter-projects/blog-writer.mdx)
- [Document QA](/starter-projects/document-qa.mdx)
5 changes: 4 additions & 1 deletion docs/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ Its intuitive interface allows for easy manipulation of AI building blocks, enab
- [Langflow Canvas](/getting-started/canvas) - Learn more about the Langflow canvas.

<Admonition type="info">
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space using this link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true) to create your own Langflow workspace in minutes.
Langflow v1.0 alpha is also available in HuggingFace Spaces. [Clone the space
using this
link](https://huggingface.co/spaces/Langflow/Langflow-Preview?duplicate=true)
to create your own Langflow workspace in minutes.
</Admonition>

## Learn more about Langflow 1.0
Expand Down
Loading
Loading