diff --git a/.devcontainer/demo/devcontainer.json b/.devcontainer/demo/devcontainer.json
index 1febd3cf5..0fb998b81 100644
--- a/.devcontainer/demo/devcontainer.json
+++ b/.devcontainer/demo/devcontainer.json
@@ -1,32 +1,33 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
- "name": "LangChain Demo Container",
- // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
- "image": "mcr.microsoft.com/devcontainers/python:3.10",
- "features": {
- "ghcr.io/devcontainers/features/aws-cli:1": {},
- "ghcr.io/devcontainers/features/docker-in-docker": {},
- "ghcr.io/devcontainers/features/node": {}
- },
- "customizations": {
- "vscode": {
- "extensions": [
- "actboy168.tasks",
- "GitHub.copilot",
- "ms-python.python",
- "eamodio.gitlens"
- ]
- }
- },
- // Features to add to the dev container. More info: https://containers.dev/features.
- // "features": {},
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- // "forwardPorts": [],
- // Use 'postCreateCommand' to run commands after the container is created.
- "postCreateCommand": "pipx install 'langflow>=0.0.33' && langflow --host 0.0.0.0"
- // Configure tool-specific properties.
- // "customizations": {},
- // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
- // "remoteUser": "root"
-}
\ No newline at end of file
+ "name": "Langflow Demo Container",
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+ "image": "mcr.microsoft.com/devcontainers/python:3.10",
+ "features": {
+ "ghcr.io/devcontainers/features/aws-cli:1": {},
+ "ghcr.io/devcontainers/features/docker-in-docker": {},
+ "ghcr.io/devcontainers/features/node": {}
+ },
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "actboy168.tasks",
+ "GitHub.copilot",
+ "ms-python.python",
+ "eamodio.gitlens",
+ "GitHub.vscode-pull-request-github"
+ ]
+ }
+ },
+ // Features to add to the dev container. More info: https://containers.dev/features.
+ // "features": {},
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ // "forwardPorts": [],
+ // Use 'postCreateCommand' to run commands after the container is created.
+ "postCreateCommand": "pipx install 'langflow>=0.0.33' && langflow --host 0.0.0.0"
+ // Configure tool-specific properties.
+ // "customizations": {},
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+ // "remoteUser": "root"
+}
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 282ff4ad3..90966fb38 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,35 +1,41 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
- "name": "LangChain Dev Container",
- // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
- "image": "mcr.microsoft.com/devcontainers/universal:2-linux",
- "features": {
- "ghcr.io/devcontainers/features/aws-cli:1": {},
- "ghcr.io/devcontainers/features/docker-in-docker": {}
- },
- "customizations": {
- "vscode": {"extensions": [
- "actboy168.tasks",
- "GitHub.copilot",
- "ms-python.python",
- "sourcery.sourcery",
- "eamodio.gitlens"
- ]}
- },
+ "name": "Langflow Dev Container",
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.10-bullseye",
- // Features to add to the dev container. More info: https://containers.dev/features.
- // "features": {},
+ // Features to add to the dev container. More info: https://containers.dev/features.
+ "features": {
+ "ghcr.io/devcontainers/features/node": {},
+ "ghcr.io/devcontainers-contrib/features/poetry": {}
+ },
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- // "forwardPorts": [],
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ // "forwardPorts": [],
- // Use 'postCreateCommand' to run commands after the container is created.
- "postCreateCommand": "poetry install"
+ // Use 'postCreateCommand' to run commands after the container is created.
+ "postCreateCommand": "make install_frontend && make install_backend",
- // Configure tool-specific properties.
- // "customizations": {},
+ "containerEnv": {
+ "POETRY_VIRTUALENVS_IN_PROJECT": "true"
+ },
- // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
- // "remoteUser": "root"
+ // Configure tool-specific properties.
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "actboy168.tasks",
+ "GitHub.copilot",
+ "ms-python.python",
+ "sourcery.sourcery",
+ "eamodio.gitlens",
+ "ms-vscode.makefile-tools",
+ "GitHub.vscode-pull-request-github"
+ ]
+ }
+ }
+
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+ // "remoteUser": "root"
}
diff --git a/Makefile b/Makefile
index ff540da0d..3aeafdbe8 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,8 @@ format:
cd src/frontend && npm run format
lint:
- poetry run mypy .
+# skip .venv folder
+ poetry run mypy --exclude .venv .
poetry run black . --check
poetry run ruff . --fix
diff --git a/docs/docs/components/text-splitters.mdx b/docs/docs/components/text-splitters.mdx
index 6c91cc1a0..c6efe4553 100644
--- a/docs/docs/components/text-splitters.mdx
+++ b/docs/docs/components/text-splitters.mdx
@@ -1,11 +1,13 @@
-import Admonition from '@theme/Admonition';
+import Admonition from "@theme/Admonition";
# Text Splitters
-
- We appreciate your understanding as we polish our documentation โ it may contain some rough edges. Share your feedback or report issues to help us improve! ๐ ๏ธ๐
-
+
+ We appreciate your understanding as we polish our documentation โ it may
+ contain some rough edges. Share your feedback or report issues to help us
+ improve! ๐ ๏ธ๐
+
A text splitter is a tool that divides a document or text into smaller chunks or segments. It is used to break down large texts into more manageable pieces for analysis or processing.
@@ -22,13 +24,13 @@ The `CharacterTextSplitter` is used to split a long text into smaller chunks bas
- **chunk_overlap:** Determines the number of characters that overlap between consecutive chunks when splitting text. It specifies how much of the previous chunk should be included in the next chunk.
- For example, if the `chunk_overlap` is set to 20 and the `chunk_size` is set to 100, the splitter will create chunks of 100 characters each, but the last 20 characters of each chunk will overlap with the first 20 characters of the next chunk. This allows for a smoother transition between chunks and ensures that no information is lost โ defaults to `200`.
+ For example, if the `chunk_overlap` is set to 20 and the `chunk_size` is set to 100, the splitter will create chunks of 100 characters each, but the last 20 characters of each chunk will overlap with the first 20 characters of the next chunk. This allows for a smoother transition between chunks and ensures that no information is lost โ defaults to `200`.
- **chunk_size:** Determines the maximum number of characters in each chunk when splitting a text. It specifies the size or length of each chunk.
- For example, if the chunk_size is set to 100, the splitter will create chunks of 100 characters each. If the text is longer than 100 characters, it will be divided into multiple chunks of equal size, except for the last chunk, which may be smaller if there are remaining characters โdefaults to `1000`.
+ For example, if the chunk_size is set to 100, the splitter will create chunks of 100 characters each. If the text is longer than 100 characters, it will be divided into multiple chunks of equal size, except for the last chunk, which may be smaller if there are remaining characters โdefaults to `1000`.
-- **separator:** Specifies the character that will be used to split the text into chunks โ defaults to `.`
+- **separator:** Specifies the character that will be used to split the text into chunks โ defaults to `.`
---
@@ -44,6 +46,18 @@ Theย `RecursiveCharacterTextSplitter`ย splits the text by trying to keep paragra
- **chunk_size:** Determines the maximum number of characters in each chunk when splitting a text. It specifies the size or length of each chunk.
-- **separator_type:** The parameter allows the user to split the code with multiple language support. It supports various languages such as Text, Ruby, Python, Solidity, Java, and more. Defaults to `Text`.
+- **separators:** The `separators` in RecursiveCharacterTextSplitter are the characters used to split the text into chunks. The text splitter tries to create chunks based on splitting on the first character in the list of `separators`. If any chunks are too large, it moves on to the next character in the list and continues splitting. Defaults to ["\n\n", "\n", " ", ""].
-- **separators:** The `separators` in RecursiveCharacterTextSplitter are the characters used to split the text into chunks. The text splitter tries to create chunks based on splitting on the first character in the list of `separators`. If any chunks are too large, it moves on to the next character in the list and continues splitting. Defaults to `.`
\ No newline at end of file
+### LanguageRecursiveTextSplitter
+
+The `LanguageRecursiveTextSplitter` is a text splitter that splits the text into smaller chunks based on the (programming) language of the text.
+
+**Params**
+
+- **Documents:** Input documents to split.
+
+- **chunk_overlap:** Determines the number of characters that overlap between consecutive chunks when splitting text. It specifies how much of the previous chunk should be included in the next chunk.
+
+- **chunk_size:** Determines the maximum number of characters in each chunk when splitting a text. It specifies the size or length of each chunk.
+
+- **separator_type:** The parameter allows the user to split the code with multiple language support. It supports various languages such as Ruby, Python, Solidity, Java, and more. Defaults to `Python`.
diff --git a/docs/docs/components/utilities.mdx b/docs/docs/components/utilities.mdx
index f510990ce..593864213 100644
--- a/docs/docs/components/utilities.mdx
+++ b/docs/docs/components/utilities.mdx
@@ -1,10 +1,76 @@
-import Admonition from '@theme/Admonition';
+import Admonition from "@theme/Admonition";
# Utilities
-
- We appreciate your understanding as we polish our documentation โ it may contain some rough edges. Share your feedback or report issues to help us improve! ๐ ๏ธ๐
-
+
+ We appreciate your understanding as we polish our documentation โ it may
+ contain some rough edges. Share your feedback or report issues to help us
+ improve! ๐ ๏ธ๐
+
+ );
+}
diff --git a/src/frontend/src/components/genericIconComponent/index.tsx b/src/frontend/src/components/genericIconComponent/index.tsx
index 32647f159..a06707d74 100644
--- a/src/frontend/src/components/genericIconComponent/index.tsx
+++ b/src/frontend/src/components/genericIconComponent/index.tsx
@@ -7,5 +7,11 @@ export default function IconComponent({
iconColor,
}: IconComponentProps): JSX.Element {
const TargetIcon = nodeIconsLucide[name] ?? nodeIconsLucide["unknown"];
- return ;
+ return (
+
+ );
}
diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx
index eb8ca2b5f..a1f58789f 100644
--- a/src/frontend/src/components/inputListComponent/index.tsx
+++ b/src/frontend/src/components/inputListComponent/index.tsx
@@ -18,6 +18,9 @@ export default function InputListComponent({
}
}, [disabled]);
+ // @TODO Recursive Character Text Splitter - the value might be in string format, whereas the InputListComponent specifically requires an array format. To ensure smooth operation and prevent potential errors, it's crucial that we handle the conversion from a string to an array with the string as its element.
+ typeof value === 'string' ? value = [value] : value = value;
+
return (
void;
clearNotificationList: () => void;
removeFromNotificationList: (index: string) => void;
+ loading: boolean;
+ setLoading: (newState: boolean) => void;
};
//initial values to alertContextType
const initialValue: alertContextType = {
errorData: { title: "", list: [] },
setErrorData: () => {},
+ loading: true,
+ setLoading: () => {},
errorOpen: false,
setErrorOpen: () => {},
noticeData: { title: "", link: "" },
@@ -55,6 +59,7 @@ export function AlertProvider({ children }: { children: ReactNode }) {
list?: Array;
}>({ title: "", list: [] });
const [errorOpen, setErrorOpen] = useState(false);
+ const [loading, setLoading] = useState(true);
const [noticeData, setNoticeDataState] = useState<{
title: string;
link?: string;
@@ -141,6 +146,8 @@ export function AlertProvider({ children }: { children: ReactNode }) {
removeFromNotificationList,
clearNotificationList,
notificationList,
+ loading,
+ setLoading,
pushNotificationList,
setNotificationCenter,
notificationCenter,
diff --git a/src/frontend/src/contexts/index.tsx b/src/frontend/src/contexts/index.tsx
index f143df708..603a3516e 100644
--- a/src/frontend/src/contexts/index.tsx
+++ b/src/frontend/src/contexts/index.tsx
@@ -16,17 +16,17 @@ export default function ContextWrapper({ children }: { children: ReactNode }) {
-
-
-
+
+
+ {children}
-
-
-
+
+
+
diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx
index 5ea8c11c0..5f463c2c1 100644
--- a/src/frontend/src/contexts/tabsContext.tsx
+++ b/src/frontend/src/contexts/tabsContext.tsx
@@ -9,6 +9,7 @@ import {
} from "react";
import { addEdge } from "reactflow";
import ShortUniqueId from "short-unique-id";
+import { skipNodeUpdate } from "../constants/constants";
import {
deleteFlowFromDatabase,
downloadFlowsFromDatabase,
@@ -163,6 +164,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
function processFlowNodes(flow) {
if (!flow.data || !flow.data.nodes) return;
flow.data.nodes.forEach((node: NodeType) => {
+ if (skipNodeUpdate.includes(node.data.type)) return;
const template = templates[node.data.type];
if (!template) {
setErrorData({ title: `Unknown node type: ${node.data.type}` });
@@ -506,6 +508,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
const updateNodes = (nodes, edges) => {
nodes.forEach((node) => {
+ if (skipNodeUpdate.includes(node.data.type)) return;
const template = templates[node.data.type];
if (!template) {
setErrorData({ title: `Unknown node type: ${node.data.type}` });
diff --git a/src/frontend/src/contexts/typesContext.tsx b/src/frontend/src/contexts/typesContext.tsx
index d4523bf60..05346838d 100644
--- a/src/frontend/src/contexts/typesContext.tsx
+++ b/src/frontend/src/contexts/typesContext.tsx
@@ -1,8 +1,15 @@
-import { createContext, ReactNode, useEffect, useState } from "react";
+import {
+ createContext,
+ ReactNode,
+ useContext,
+ useEffect,
+ useState,
+} from "react";
import { Node } from "reactflow";
-import { getAll } from "../controllers/API";
+import { getAll, getHealth } from "../controllers/API";
import { APIKindType } from "../types/api";
import { typesContextType } from "../types/typesContext";
+import { alertContext } from "./alertContext";
//context to share types adn functions from nodes to flow
@@ -16,6 +23,8 @@ const initialValue: typesContextType = {
setTemplates: () => {},
data: {},
setData: () => {},
+ setFetchError: () => {},
+ fetchError: false,
};
export const typesContext = createContext(initialValue);
@@ -25,13 +34,10 @@ export function TypesProvider({ children }: { children: ReactNode }) {
const [reactFlowInstance, setReactFlowInstance] = useState(null);
const [templates, setTemplates] = useState({});
const [data, setData] = useState({});
+ const [fetchError, setFetchError] = useState(false);
+ const { setLoading } = useContext(alertContext);
useEffect(() => {
- let delay = 1000; // Start delay of 1 second
- let intervalId = null;
- let retryCount = 0; // Count of retry attempts
- const maxRetryCount = 5; // Max retry attempts
-
// We will keep a flag to handle the case where the component is unmounted before the API call resolves.
let isMounted = true;
@@ -39,7 +45,8 @@ export function TypesProvider({ children }: { children: ReactNode }) {
try {
const result = await getAll();
// Make sure to only update the state if the component is still mounted.
- if (isMounted) {
+ if (isMounted && result?.status === 200) {
+ setLoading(false);
setData(result.data);
setTemplates(
Object.keys(result.data).reduce((acc, curr) => {
@@ -68,22 +75,15 @@ export function TypesProvider({ children }: { children: ReactNode }) {
}, {})
);
}
- // Clear the interval if successful.
- clearInterval(intervalId);
} catch (error) {
console.error("An error has occurred while fetching types.");
+ await getHealth().catch((e) => {
+ setFetchError(true);
+ });
}
}
- // Start the initial interval.
- intervalId = setInterval(getTypes, delay);
-
- return () => {
- // This will clear the interval when the component unmounts, or when the dependencies of the useEffect hook change.
- clearInterval(intervalId);
- // Indicate that the component has been unmounted.
- isMounted = false;
- };
+ getTypes();
}, []);
function deleteNode(idx: string) {
@@ -108,6 +108,8 @@ export function TypesProvider({ children }: { children: ReactNode }) {
templates,
data,
setData,
+ fetchError,
+ setFetchError,
}}
>
{children}
diff --git a/src/frontend/src/pages/CommunityPage/index.tsx b/src/frontend/src/pages/CommunityPage/index.tsx
index c3d028314..30e7ac9d6 100644
--- a/src/frontend/src/pages/CommunityPage/index.tsx
+++ b/src/frontend/src/pages/CommunityPage/index.tsx
@@ -6,6 +6,7 @@ import { TabsContext } from "../../contexts/tabsContext";
import { useNavigate } from "react-router-dom";
import { CardComponent } from "../../components/cardComponent";
import IconComponent from "../../components/genericIconComponent";
+import Header from "../../components/headerComponent";
import { getExamples } from "../../controllers/API";
import { FlowType } from "../../types/flow";
export default function CommunityPage() {
@@ -42,61 +43,65 @@ export default function CommunityPage() {
handleExamples();
}, []);
return (
-
+
+ Discover and learn from shared examples by the Langflow community. We
+ welcome new example contributions that can help our community explore
+ new and powerful features.
-
-
- Discover and learn from shared examples by the Langflow community. We
- welcome new example contributions that can help our community explore
- new and powerful features.
-
-