From 8a5525f465059b3474706e897ad01b893cb07942 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 19 Jun 2023 14:24:48 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(constants.tsx):=20add=20twe?= =?UTF-8?q?aks=20parameter=20to=20getPythonCode=20function=20to=20allow=20?= =?UTF-8?q?for=20customization=20of=20flow=20behavior=20The=20`getPythonCo?= =?UTF-8?q?de`=20function=20now=20accepts=20a=20`tweaks`=20parameter=20whi?= =?UTF-8?q?ch=20is=20used=20to=20customize=20the=20behavior=20of=20the=20f?= =?UTF-8?q?low.=20The=20`buildTweaks`=20function=20is=20called=20to=20gene?= =?UTF-8?q?rate=20the=20`tweaks`=20object=20which=20is=20then=20passed=20t?= =?UTF-8?q?o=20the=20`load=5Fflow=5Ffrom=5Fjson`=20function.=20This=20allo?= =?UTF-8?q?ws=20for=20more=20flexibility=20in=20the=20usage=20of=20the=20f?= =?UTF-8?q?low.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/constants.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 0e9a9ad3d..7017ac27e 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -121,9 +121,10 @@ export const getCurlCode = (flow: FlowType): string => { */ export const getPythonCode = (flow: FlowType): string => { const flowName = flow.name; + const tweaks = buildTweaks(flow); return `from langflow import load_flow_from_json - -flow = load_flow_from_json("${flowName}.json") +TWEAKS = ${JSON.stringify(tweaks, null, 2)} +flow = load_flow_from_json("${flowName}.json", tweaks=TWEAKS) # Now you can use it like any chain flow("Hey, have you heard of LangFlow?")`; };