From 29a1af74e51b431abbb33655f58ed6ad24d12dd7 Mon Sep 17 00:00:00 2001 From: Gabriel Almeida Date: Fri, 17 Mar 2023 13:22:28 -0300 Subject: [PATCH 1/2] fix: added instructions for import/export --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 56b01a1a0..83da79a33 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,18 @@ Creating flows with LangFlow is easy. Simply drag sidebar components onto the ca Explore by editing prompt parameters, link chains and agents, track an agent's thought process, and export your flow. +Once you're done, you can export your flow as a JSON file to use with LangChain. +To do so, click the "Export" button in the top right corner of the canvas, then +in Python, you can load the flow with: + +```python +from langflow import load_flow_from_json + +flow = load_flow_from_json("path/to/flow.json") +# Now you can use it like any chain +flow("Hey, have you heard of LangFlow?") +``` + ## 👋 Contributing From cb965ca9ced7623aea28d0a12fd5bd2063aea224 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 20 Mar 2023 11:56:40 -0300 Subject: [PATCH 2/2] change place of the import/export buttons --- src/frontend/package.json | 3 +- .../src/controllers/NodesServices/index.ts | 4 +- .../components/tabsManagerComponent/index.tsx | 41 +++++++++++++++---- src/frontend/src/pages/FlowPage/index.tsx | 11 ----- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/frontend/package.json b/src/frontend/package.json index 494db2ed3..2a27406b4 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -53,5 +53,6 @@ "last 1 firefox version", "last 1 safari version" ] - } + }, + "proxy":"http://localhost:7860" } \ No newline at end of file diff --git a/src/frontend/src/controllers/NodesServices/index.ts b/src/frontend/src/controllers/NodesServices/index.ts index 3478d9d48..7a1fdb348 100644 --- a/src/frontend/src/controllers/NodesServices/index.ts +++ b/src/frontend/src/controllers/NodesServices/index.ts @@ -4,10 +4,10 @@ import axios, { AxiosResponse } from "axios"; const backendUrl = process.env.BACKEND || "http://localhost:5003"; export async function getAll():Promise> { - return await axios.get(`${backendUrl}/all`); + return await axios.get(`/all`); } export async function sendAll(data:sendAllProps) { console.log(data); - return await axios.post(`${backendUrl}/predict`, data); + return await axios.post(`/predict`, data); } \ No newline at end of file diff --git a/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx index 6b2e05b08..6396b753f 100644 --- a/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/tabsManagerComponent/index.tsx @@ -4,17 +4,24 @@ import TabComponent from "../tabComponent"; import { TabsContext } from "../../../../contexts/tabsContext"; import FlowPage from "../.."; import { darkContext } from "../../../../contexts/darkContext"; -import { BellIcon, MoonIcon, SunIcon } from "@heroicons/react/24/outline"; +import { + ArrowDownTrayIcon, + ArrowUpTrayIcon, + BellIcon, + MoonIcon, + SunIcon, +} from "@heroicons/react/24/outline"; import { PopUpContext } from "../../../../contexts/popUpContext"; import AlertDropdown from "../../../../alerts/alertDropDown"; import { alertContext } from "../../../../contexts/alertContext"; export default function TabsManagerComponent() { - const { flows, addFlow, tabIndex, setTabIndex } = useContext(TabsContext); + const { flows, addFlow, tabIndex, setTabIndex, uploadFlow, downloadFlow } = useContext(TabsContext); const { openPopUp } = useContext(PopUpContext); - const AlertWidth = 256 + const AlertWidth = 256; const { dark, setDark } = useContext(darkContext); - const {notificationCenter, setNotificationCenter} = useContext(alertContext) + const { notificationCenter, setNotificationCenter } = + useContext(alertContext); useEffect(() => { //create the first flow if (flows.length === 0) { @@ -43,6 +50,12 @@ export default function TabsManagerComponent() { flow={null} />
+ +
diff --git a/src/frontend/src/pages/FlowPage/index.tsx b/src/frontend/src/pages/FlowPage/index.tsx index 2cf11574f..6471621af 100644 --- a/src/frontend/src/pages/FlowPage/index.tsx +++ b/src/frontend/src/pages/FlowPage/index.tsx @@ -182,17 +182,6 @@ export default function FlowPage({ flow }:{flow:FlowType}) { > - uploadFlow()} - > - - - - downloadFlow()} - > - -