Comments (2)
To fix the issue where Boolean values are incorrectly formatted for Python in the code export feature, you need to ensure that the Boolean values in the tweaksBuildedObject
are correctly converted from JavaScript's true
/false
to Python's True
/False
. You can achieve this by modifying the getPythonCode
function to replace these values in the JSON string.
Here's the updated code:
/**
* Function to get the python code for the API
* @param {string} flow - The current flow
* @param {any[]} tweak - The tweaks
* @returns {string} - The python code
*/
export default function getPythonCode(
flowName: string,
tweaksBuildedObject
): string {
const tweaksObject = tweaksBuildedObject[0];
const tweaksString = JSON.stringify(tweaksObject, null, 2)
.replace(/true/g, "True")
.replace(/false/g, "False");
return `from langflow.load import run_flow_from_json
TWEAKS = ${tweaksString}
result = run_flow_from_json(flow="${flowName}.json",
input_value="message",
fallback_to_env_vars=True, # False by default
tweaks=TWEAKS)`;
}
This modification ensures that the Boolean values are correctly formatted for Python when the code is exported. Additionally, the CodeTabsComponent
in src/frontend/src/components/codeTabsComponent/index.tsx
includes a switch to enable or disable tweaks, which should be considered when exporting the code [1][2][3][4][5].
To continue talking to Dosu, mention @dosu.
from langflow.
#2130
Bugfix.
from langflow.
Related Issues (20)
- [Feature Request] Add support for `dimensions` parameter in embedding models
- [Feature Request] Support secretes stored in Kubernetes
- [Feature Request] A generic SecretService to support store secrets
- langflow build hangs HOT 1
- [Tests] Add astra db integration tests
- How to implement timed updates of data to the knowledge base in Langflow HOT 1
- [Feature Requests] Support Astra Vectorize
- Error code 422 Unprocessable Entity, When Running cURL Code for Langflow Flow with TWEAKS HOT 1
- some advise HOT 1
- 对话AzureOpenAI 报错 HOT 3
- TWEAKS never work via API HOT 2
- If I want to execute a flow using a webhook in the form of a curl command, how should I do it? HOT 3
- Proposal: Enhancing the `get_messages` Method to Support Timestamp Filtering
- Chroma and Astra DB Search components not allowing Chat Input HOT 19
- [a58 bug] Chat Input stopped working with Azure OpenAI model/embedding component HOT 2
- [a58 bug] Azure OpenAI global variables passed via "--env-file" doesn't work correctly HOT 1
- Qdrant Search: Invalid Input from "Chat Input" in v1.0.0a58 HOT 3
- [Feature Request] Control Output Values of ChatMemory and MessageHistory Components
- Faiss search error HOT 2
- The outout of the Chat Input is not been recognized as text by OpenAI model HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langflow.