From 6fb0030a291c5a67e19cc169c677b0e257ea0021 Mon Sep 17 00:00:00 2001 From: Naveen Choudhary Date: Thu, 15 Jun 2023 23:08:22 -0500 Subject: [PATCH 01/16] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 522941f31..06ff71871 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ anthropic = "^0.2.9" multiprocess = "^0.70.14" -[tool.poetry.group.dev.dependencies] +[tool.poetry.dev-dependencies] black = "^23.1.0" ipykernel = "^6.21.2" mypy = "^1.1.1" From ccaed1f3a797562a8804a360d4a1db0365a1e415 Mon Sep 17 00:00:00 2001 From: Naveen Choudhary Date: Thu, 15 Jun 2023 23:25:49 -0500 Subject: [PATCH 02/16] Create Dockerfile --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..4c21515d0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM python:3.10-slim + +RUN apt-get update && apt-get install gcc g++ git make -y +RUN useradd -m -u 1000 user +USER user +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH + +WORKDIR $HOME/app + +COPY --chown=user . $HOME/app + +RUN pip install langflow>==0.0.86 -U --user +CMD ["python", "-m", "langflow", "--host", "0.0.0.0", "--port", "7860"] From f71e7d1f7a47ac6aaf37ce012743ad21fce3854e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 16 Jun 2023 19:56:09 -0300 Subject: [PATCH 03/16] =?UTF-8?q?=F0=9F=94=A5=20chore(frontend):=20remove?= =?UTF-8?q?=20prepare-commit-msg=20git=20hook=20The=20prepare-commit-msg?= =?UTF-8?q?=20git=20hook=20was=20removed=20from=20the=20frontend=20directo?= =?UTF-8?q?ry.=20This=20hook=20was=20not=20being=20used=20and=20was=20not?= =?UTF-8?q?=20necessary=20for=20the=20project's=20development=20workflow.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/.githooks/prepare-commit-msg | 1 - 1 file changed, 1 deletion(-) delete mode 120000 src/frontend/.githooks/prepare-commit-msg diff --git a/src/frontend/.githooks/prepare-commit-msg b/src/frontend/.githooks/prepare-commit-msg deleted file mode 120000 index 7aa890bb6..000000000 --- a/src/frontend/.githooks/prepare-commit-msg +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/node_modules/opencommit/out/cli.cjs \ No newline at end of file From 262a74f5d6d370c81c5a83c0b8e8eaeb68c1d661 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sat, 17 Jun 2023 17:58:38 -0300 Subject: [PATCH 04/16] Update README.md Added discord badge. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bd377896c..b410df620 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,9 @@ ~ A User Interface For [LangChain](https://github.com/hwchase17/langchain) ~ +

+Discord Server HuggingFace Spaces GitHub Contributors GitHub Last Commit From 6038bbee6a0e52724e03efe22d7c4a4800b4f374 Mon Sep 17 00:00:00 2001 From: Rodrigo Nader Date: Sun, 18 Jun 2023 02:31:26 -0300 Subject: [PATCH 05/16] Update README.md --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b410df620..130d59ee6 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,9 @@ # ⛓️ LangFlow -~ A User Interface For [LangChain](https://github.com/hwchase17/langchain) ~ - +~ An effortless way to experiment and prototype [LangChain](https://github.com/hwchase17/langchain) pipelines ~

-Discord Server -HuggingFace Spaces GitHub Contributors GitHub Last Commit @@ -16,10 +13,17 @@ Github License

+

+Discord Server +HuggingFace Spaces +

+ -LangFlow is a GUI for [LangChain](https://github.com/hwchase17/langchain), designed with [react-flow](https://github.com/wbkd/react-flow) to provide an effortless way to experiment and prototype flows with drag-and-drop components and a chat box. + +

+

## 📦 Installation ### Locally From 7111bee8dbacff445f4519c77a8b7d25a87e02a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 18 Jun 2023 12:05:35 +0000 Subject: [PATCH 06/16] build(deps-dev): bump vite from 4.3.5 to 4.3.9 in /src/frontend Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.3.5 to 4.3.9. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.3.9/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- src/frontend/package-lock.json | 20 +++++++++++++++++--- src/frontend/package.json | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index 323cfdcc1..68f198dd6 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -80,7 +80,7 @@ "postcss": "^8.4.23", "tailwindcss": "^3.3.2", "typescript": "^5.0.2", - "vite": "^4.3.5" + "vite": "^4.3.9" } }, "node_modules/@adobe/css-tools": { @@ -5070,6 +5070,19 @@ "version": "1.0.0", "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.1", "license": "MIT" @@ -9552,8 +9565,9 @@ } }, "node_modules/vite": { - "version": "4.3.5", - "license": "MIT", + "version": "4.3.9", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.3.9.tgz", + "integrity": "sha512-qsTNZjO9NoJNW7KnOrgYwczm0WctJ8m/yqYAMAK9Lxt4SoySUfS5S8ia9K7JHpa3KEeMfyF8LoJ3c5NeBJy6pg==", "dependencies": { "esbuild": "^0.17.5", "postcss": "^8.4.23", diff --git a/src/frontend/package.json b/src/frontend/package.json index c6177ebb0..07fdb32f5 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -101,6 +101,6 @@ "postcss": "^8.4.23", "tailwindcss": "^3.3.2", "typescript": "^5.0.2", - "vite": "^4.3.5" + "vite": "^4.3.9" } } From 7b165ad5d2884eded9b752bd977aa5c49758405b Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Jun 2023 11:24:03 -0300 Subject: [PATCH 07/16] =?UTF-8?q?=F0=9F=90=9B=20fix(Dockerfile):=20remove?= =?UTF-8?q?=20unnecessary=20files=20after=20installing=20dependencies=20?= =?UTF-8?q?=F0=9F=9A=80=20chore(pyproject.toml):=20rename=20dev-dependenci?= =?UTF-8?q?es=20to=20dev.dependencies=20The=20Dockerfile=20now=20removes?= =?UTF-8?q?=20unnecessary=20files=20after=20installing=20dependencies=20to?= =?UTF-8?q?=20reduce=20the=20image=20size.=20The=20pyproject.toml=20file?= =?UTF-8?q?=20now=20uses=20the=20correct=20naming=20convention=20for=20dev?= =?UTF-8?q?=20dependencies,=20which=20is=20dev.dependencies=20instead=20of?= =?UTF-8?q?=20dev-dependencies.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c21515d0..afe112a40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM python:3.10-slim -RUN apt-get update && apt-get install gcc g++ git make -y +RUN apt-get update && apt-get install gcc g++ git make -y && apt-get clean \ + && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ diff --git a/pyproject.toml b/pyproject.toml index 8851a8231..366c09f73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ cachetools = "^5.3.1" types-cachetools = "^5.3.0.5" -[tool.poetry.dev-dependencies] +[tool.poetry.dev.dependencies] black = "^23.1.0" ipykernel = "^6.21.2" mypy = "^1.1.1" From 98f3c708e469654248215431185e45732afc2416 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Jun 2023 12:49:36 -0300 Subject: [PATCH 08/16] =?UTF-8?q?=F0=9F=9A=9A=20chore(pyproject.toml):=20m?= =?UTF-8?q?ove=20dev=20dependencies=20to=20group.dev=20The=20dev=20depende?= =?UTF-8?q?ncies=20were=20moved=20to=20the=20group.dev=20section=20to=20im?= =?UTF-8?q?prove=20the=20organization=20of=20the=20pyproject.toml=20file.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 366c09f73..4a383f6fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ cachetools = "^5.3.1" types-cachetools = "^5.3.0.5" -[tool.poetry.dev.dependencies] +[tool.poetry.group.dev.dependencies] black = "^23.1.0" ipykernel = "^6.21.2" mypy = "^1.1.1" From 825f2798c363eff58001ffe388c1732db3d641ad Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Jun 2023 16:03:25 -0300 Subject: [PATCH 09/16] =?UTF-8?q?=F0=9F=90=9B=20fix(chat.py):=20fix=20node?= =?UTF-8?q?=20to=20vertex=20variable=20name=20in=20stream=5Fbuild=20functi?= =?UTF-8?q?on=20=E2=9C=A8=20feat(chat.py):=20add=20progress=20logging=20to?= =?UTF-8?q?=20stream=5Fbuild=20function=20The=20variable=20node=20was=20re?= =?UTF-8?q?named=20to=20vertex=20to=20improve=20semantics=20and=20consiste?= =?UTF-8?q?ncy=20with=20the=20naming=20conventions.=20Progress=20logging?= =?UTF-8?q?=20was=20added=20to=20the=20stream=5Fbuild=20function=20to=20pr?= =?UTF-8?q?ovide=20feedback=20to=20the=20user=20on=20the=20progress=20of?= =?UTF-8?q?=20the=20build=20process.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(index.tsx): fix typo in setSuccessData function call ✨ feat(index.tsx): add success logging to handleBuild function A typo in the setSuccessData function call was fixed. Success logging was added to the handleBuild function to provide feedback to the user on the success of the build process. --- src/backend/langflow/api/v1/chat.py | 14 ++++++++++---- .../chatComponent/buildTrigger/index.tsx | 16 +++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/backend/langflow/api/v1/chat.py b/src/backend/langflow/api/v1/chat.py index 262defed6..ed0caeba2 100644 --- a/src/backend/langflow/api/v1/chat.py +++ b/src/backend/langflow/api/v1/chat.py @@ -87,10 +87,16 @@ async def stream_build(flow_id: str): logger.debug("Building langchain object") graph = Graph.from_payload(graph_data) - for node in graph.generator_build(): + number_of_nodes = len(graph.nodes) + for i, vertex in enumerate(graph.generator_build(), 1): try: - node.build() - params = node._built_object_repr() + log_dict = { + "log": f"Building node {vertex.vertex_type}", + "progress": round(i / number_of_nodes, 2), + } + yield f"data: {json.dumps(log_dict)}\n\n" + vertex.build() + params = vertex._built_object_repr() valid = True logger.debug( f"Building node {params[:50]}{'...' if len(params) > 50 else ''}" @@ -103,7 +109,7 @@ async def stream_build(flow_id: str): { "valid": valid, "params": params, - "id": node.id, + "id": vertex.id, } ) yield f"data: {response}\n\n" diff --git a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx index c9113dbd7..49ec2922f 100644 --- a/src/frontend/src/components/chatComponent/buildTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/buildTrigger/index.tsx @@ -1,4 +1,4 @@ -import { useState, useContext } from "react"; +import { useContext } from "react"; import { Transition } from "@headlessui/react"; import { Zap } from "lucide-react"; import { validateNodes } from "../../../utils"; @@ -22,7 +22,7 @@ export default function BuildTrigger({ }) { const { updateSSEData, isBuilding, setIsBuilding } = useSSE(); const { reactFlowInstance } = useContext(typesContext); - const { setErrorData } = useContext(alertContext); + const { setErrorData, setSuccessData } = useContext(alertContext); async function handleBuild(flow: FlowType) { try { @@ -81,10 +81,16 @@ export default function BuildTrigger({ eventSource.close(); return; + } else if (parsedData.log) { + // If the event is a log, log it + // TODO: implement the progress + setSuccessData({ title: parsedData.log }); + setSuccessData({ title: parsedData.progress }); + } else { + // Otherwise, process the data + const isValid = processStreamResult(parsedData); + validationResults.push(isValid); } - // Otherwise, process the data - const isValid = processStreamResult(parsedData); - validationResults.push(isValid); }; eventSource.onerror = (error) => { From c969bcca78603427fa40102bba7ac343baefc794 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Mon, 19 Jun 2023 19:33:07 -0300 Subject: [PATCH 10/16] Fixed spearator --- src/frontend/src/components/headerComponent/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/components/headerComponent/index.tsx b/src/frontend/src/components/headerComponent/index.tsx index 0d9459f45..168f73465 100644 --- a/src/frontend/src/components/headerComponent/index.tsx +++ b/src/frontend/src/components/headerComponent/index.tsx @@ -1,4 +1,4 @@ -import { BellIcon, Home, Users2 } from "lucide-react"; +import { BellIcon, Home, MoonIcon, SunIcon, Users2 } from "lucide-react"; import { useContext, useEffect, useState } from "react"; import { FaDiscord, FaGithub, FaTwitter } from "react-icons/fa"; import { Button } from "../ui/button"; @@ -12,6 +12,7 @@ import MenuBar from "./components/menuBar"; import { Link, useLocation, useParams } from "react-router-dom"; import { USER_PROJECTS_HEADER } from "../../constants"; import { getRepoStars } from "../../controllers/API"; +import { Separator } from "../ui/separator"; export default function Header() { const { flows, addFlow, tabId } = useContext(TabsContext); @@ -73,7 +74,7 @@ export default function Header() { href="https://github.com/logspace-ai/langflow" target="_blank" rel="noreferrer" - className="inline-flex items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background text-gray-600 dark:text-gray-300 border border-input hover:bg-accent hover:text-accent-foreground h-9 px-3 pr-0 rounded-md" + className="inline-flex shadow-sm items-center justify-center text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background text-gray-600 dark:text-gray-300 border border-input hover:bg-accent hover:text-accent-foreground h-9 px-3 pr-0 rounded-md" > Star @@ -97,7 +98,8 @@ export default function Header() { > - {/* */} +